/* ============================================================
   ECOAchronos — Folha de Estilos Principal
   Instituto ECOA PUC-Rio
   ============================================================ */

/* --- Variáveis de design --- */
:root {
  --ecoa-primary: #1565c0;
  --ecoa-primary-dark: #0d47a1;
  --ecoa-primary-light: #e3f2fd;
  --ecoa-secondary: #2e7d32;
  --ecoa-accent: #ef6c00;
  --ecoa-bg: #f0f4f8;
  --ecoa-surface: #ffffff;
  --ecoa-text: #1a1a2e;
  --ecoa-text-muted: #6b7280;
  --ecoa-border: #e2e8f0;
  --ecoa-navbar-h: 60px;
  --ecoa-footer-h: 40px;
  --ecoa-radius: 12px;
  --ecoa-radius-sm: 8px;
  --ecoa-shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.05);
  --ecoa-shadow-hover: 0 4px 12px rgba(21,101,192,.15);
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.9375rem;
  color: var(--ecoa-text);
  background-color: var(--ecoa-bg);
  padding-top: var(--ecoa-navbar-h);
  padding-bottom: var(--ecoa-footer-h);
  min-height: 100vh;
}

a { color: var(--ecoa-primary); }
a:hover { color: var(--ecoa-primary-dark); }

.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.cursor-pointer { cursor: pointer; }

/* --- Navbar --- */
.ecoa-navbar {
  background: linear-gradient(135deg, var(--ecoa-primary-dark) 0%, var(--ecoa-primary) 100%);
  height: var(--ecoa-navbar-h);
  border-bottom: 2px solid rgba(255,255,255,.08);
  box-shadow: 0 2px 12px rgba(0,0,0,.15);
  z-index: 1040;
}

.brand-icon { font-size: 1.25rem; color: #90caf9; }
.brand-text { font-size: 1.125rem; font-weight: 700; letter-spacing: -0.3px; }
.ecoa-brasao-logo { height: 36px; width: auto; object-fit: contain; }
.brand-divider { display:inline-block; width:1px; height:28px; background:rgba(255,255,255,.3); margin: 0 2px; }

.ecoa-navbar .nav-link {
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.4rem 0.75rem;
  border-radius: var(--ecoa-radius-sm);
  transition: background .2s, color .2s;
  color: rgba(255,255,255,.82) !important;
}
.ecoa-navbar .nav-link:hover,
.ecoa-navbar .nav-link.active {
  background: rgba(255,255,255,.12);
  color: #fff !important;
}

/* Avatar do usuário */
.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  font-weight: 700;
  font-size: 0.875rem;
  color: #fff;
  border: 2px solid rgba(255,255,255,.4);
}

/* --- Offcanvas mobile --- */
.ecoa-offcanvas {
  background: var(--ecoa-primary-dark);
  color: #fff;
  width: 260px !important;
}
.ecoa-offcanvas .offcanvas-title { color: #fff; font-weight: 700; }
.sidebar-link {
  color: rgba(255,255,255,.82) !important;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.55rem 0.9rem;
  border-radius: var(--ecoa-radius-sm);
  transition: background .2s;
}
.sidebar-link:hover { background: rgba(255,255,255,.12); color: #fff !important; }
.sidebar-divider { border-color: rgba(255,255,255,.15); }

/* --- Main content --- */
.main-content {
  min-height: calc(100vh - var(--ecoa-navbar-h) - var(--ecoa-footer-h));
}

/* --- Page header --- */
.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  color: var(--ecoa-text);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.page-subtitle { font-size: 0.875rem; margin-top: 0.25rem; }

/* --- Cards --- */
.page-card {
  background: var(--ecoa-surface);
  border-radius: var(--ecoa-radius);
  box-shadow: var(--ecoa-shadow);
  border: 1px solid var(--ecoa-border);
  overflow: hidden;
}
.page-card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--ecoa-border);
  background: linear-gradient(to right, #f8fafc, var(--ecoa-surface));
}
.page-card-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  color: var(--ecoa-text);
}
.page-card-body { padding: 1.25rem; }
.page-card-footer {
  padding: 0.875rem 1.25rem;
  border-top: 1px solid var(--ecoa-border);
  background: #f8fafc;
}

/* --- Stat cards --- */
.stat-card {
  background: var(--ecoa-surface);
  border-radius: var(--ecoa-radius);
  box-shadow: var(--ecoa-shadow);
  border: 1px solid var(--ecoa-border);
  transition: box-shadow .2s, transform .2s;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.stat-card:hover {
  box-shadow: var(--ecoa-shadow-hover);
  transform: translateY(-2px);
}
.stat-card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--ecoa-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(to right, var(--ecoa-primary-light), var(--ecoa-surface));
}
.stat-card-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  color: var(--ecoa-primary-dark);
}
.stat-card-body { padding: 1rem 1.25rem; flex: 1; }
.stat-card-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--ecoa-border);
  background: #f8fafc;
}

/* --- Mini stats --- */
.mini-stat {
  border-radius: var(--ecoa-radius-sm);
  padding: 0.75rem 0.5rem;
  border: 1px solid transparent;
}
.mini-stat-value {
  font-size: 1.375rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 0.2rem;
}
.mini-stat-label {
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--ecoa-text-muted);
}

/* --- Tables --- */
.table thead th {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--ecoa-text-muted);
  border-bottom: 2px solid var(--ecoa-border);
  background: #f8fafc;
}
.table tbody tr { transition: background .15s; }
.table-hover tbody tr:hover { background: var(--ecoa-primary-light); }

/* --- Buttons override --- */
.btn-primary {
  background: var(--ecoa-primary);
  border-color: var(--ecoa-primary);
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--ecoa-primary-dark);
  border-color: var(--ecoa-primary-dark);
}
.btn-outline-primary { color: var(--ecoa-primary); border-color: var(--ecoa-primary); }
.btn-outline-primary:hover { background: var(--ecoa-primary); border-color: var(--ecoa-primary); }

/* --- Badges --- */
.badge { font-weight: 500; }

/* --- Progress bars --- */
.progress {
  background-color: var(--ecoa-border);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar { border-radius: 999px; transition: width .6s ease; }

/* --- Empty state --- */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
}

/* --- Messages --- */
.messages-container { margin-bottom: 1.25rem; }
.alert { border-radius: var(--ecoa-radius-sm); font-size: 0.9rem; }
.alert-success { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.alert-danger, .alert-error { background: #fef2f2; border-color: #fecaca; color: #dc2626; }
.alert-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.alert-info { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }

/* --- Form styles --- */
.form-control, .form-select {
  border-color: var(--ecoa-border);
  border-radius: var(--ecoa-radius-sm);
  font-size: 0.9rem;
  transition: border-color .2s, box-shadow .2s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--ecoa-primary);
  box-shadow: 0 0 0 3px rgba(21,101,192,.12);
}
.form-label { font-size: 0.875rem; color: var(--ecoa-text); margin-bottom: 0.3rem; }
.form-text { font-size: 0.8rem; }

/* Turmas/students grid */
.turmas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.4rem;
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--ecoa-border);
  border-radius: var(--ecoa-radius-sm);
  padding: 0.75rem;
  background: #f8fafc;
}

/* --- Detail list --- */
.detail-list { margin: 0; }
.detail-list dt { font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; color: var(--ecoa-text-muted); margin-top: 0.75rem; }
.detail-list dd { margin: 0; font-size: 0.9rem; }

/* --- Footer --- */
.ecoa-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--ecoa-footer-h);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ecoa-surface);
  border-top: 1px solid var(--ecoa-border);
  z-index: 1030;
  padding: 0;
}
.footer-brand { font-size: 0.8rem; font-weight: 600; color: var(--ecoa-primary); }
.footer-lbi { font-size: 0.75rem; color: var(--ecoa-text-muted); }
.footer-link { color: var(--ecoa-text-muted); text-decoration: underline dotted; }
.footer-link:hover { color: var(--ecoa-primary); }

/* --- Auth screens --- */
.auth-body {
  background: linear-gradient(135deg, var(--ecoa-primary-dark) 0%, #1a237e 50%, var(--ecoa-secondary) 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  padding-top: 0;
}
.auth-wrapper {
  width: 100%;
  max-width: 420px;
}
.auth-card {
  background: var(--ecoa-surface);
  border-radius: var(--ecoa-radius);
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  overflow: hidden;
}
.auth-header {
  background: linear-gradient(135deg, var(--ecoa-primary-dark), var(--ecoa-primary));
  padding: 2rem 1.5rem 1.5rem;
  color: white;
}
.auth-logo { font-size: 2.5rem; color: #90caf9; }
.auth-brand { font-size: 1.5rem; font-weight: 700; color: white; margin: 0; }
.auth-subtitle { font-size: 0.85rem; color: rgba(255,255,255,.7); margin: 0.25rem 0 0; }
.auth-body-inner { padding: 1.75rem 1.5rem; }
.auth-footer { font-size: 0.78rem; color: rgba(255,255,255,.6); }
.auth-footer a { color: rgba(255,255,255,.8); }
.auth-footer a:hover { color: white; }

/* --- Breadcrumbs --- */
.breadcrumb { font-size: 0.85rem; }
.breadcrumb-item a { color: var(--ecoa-primary); text-decoration: none; }
.breadcrumb-item a:hover { text-decoration: underline; }

/* --- Dropdown --- */
.dropdown-menu {
  border: 1px solid var(--ecoa-border);
  border-radius: var(--ecoa-radius-sm);
  box-shadow: var(--ecoa-shadow);
  font-size: 0.875rem;
}
.dropdown-item { padding: 0.45rem 1rem; }
.dropdown-item:hover { background: var(--ecoa-primary-light); }

/* --- Scrollbar (webkit) --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--ecoa-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--ecoa-text-muted); }

/* --- Focus visible (acessibilidade LBI) --- */
:focus-visible {
  outline: 3px solid var(--ecoa-accent);
  outline-offset: 2px;
  border-radius: 3px;
}
.btn:focus-visible { outline: 3px solid var(--ecoa-accent); }

/* --- Skip link acessibilidade --- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 9999;
  padding: 0.5rem 1rem;
  background: var(--ecoa-accent);
  color: white;
  border-radius: var(--ecoa-radius-sm);
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { top: 0.5rem; }

/* --- Responsivo mobile --- */
@media (max-width: 576px) {
  body { font-size: 0.875rem; }
  .page-title { font-size: 1.25rem; }
  .page-card-body { padding: 1rem; }
  .stat-card-header, .stat-card-body, .stat-card-footer { padding: 0.875rem 1rem; }
}
