/* ============================================================
   app.css — ACE | ENES / ENEB
   Aesthetic: Terminal/Industrial — precision tool look
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&family=Inter:wght@400;500;600;700&display=swap');

/* ── Dark Mode (default) ───────────────────────────────────── */
:root {
  --bg:          #0d0f14;
  --bg-panel:    #13161e;
  --bg-card:     #1a1d27;
  --bg-hover:    #1f2335;
  --border:      #252838;
  --border-hi:   #363b5e;
  --text:        #c8ccd8;
  --text-dim:    #5c6070;
  --text-hi:     #e8eaf0;
  --accent:      #4f8ef7;
  --accent-glow: rgba(79,142,247,.18);
  --green:       #3dca7a;
  --yellow:      #f5c842;
  --orange:      #f5864a;
  --red:         #f54a4a;
  --purple:      #9b7ef5;
  --font-mono:   'JetBrains Mono', 'Courier New', monospace;
  --font-ui:     'Inter', system-ui, sans-serif;
  --radius:      6px;
  --radius-lg:   10px;
  --shadow:      0 4px 24px rgba(0,0,0,.5);
}

/* ── Light Mode ────────────────────────────────────────────── */
[data-theme="light"] {
  --bg:          #f0f2f7;
  --bg-panel:    #ffffff;
  --bg-card:     #f8f9fc;
  --bg-hover:    #e8ecf4;
  --border:      #d0d5e8;
  --border-hi:   #a8b2d0;
  --text:        #3a3f52;
  --text-dim:    #8890a8;
  --text-hi:     #1a1f2e;
  --accent:      #2563eb;
  --accent-glow: rgba(37,99,235,.12);
  --green:       #16a34a;
  --yellow:      #d97706;
  --orange:      #ea580c;
  --red:         #dc2626;
  --purple:      #7c3aed;
  --shadow:      0 4px 16px rgba(0,0,0,.08);
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }
body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  transition: background .2s, color .2s;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; opacity: .85; }

/* ── Layout ─────────────────────────────────────────────────── */
.app-shell { display: grid; grid-template-rows: auto 1fr; min-height: 100vh; }

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .6rem 1.5rem;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 200;
}
.topbar-brand {
  display: flex; align-items: center; gap: .5rem;
  font-family: var(--font-mono); font-weight: 700; font-size: .95rem;
  color: var(--text-hi); letter-spacing: .02em; text-decoration: none;
}
.topbar-brand:hover { text-decoration: none; opacity: 1; }
.topbar-brand .brand-icon { color: var(--accent); font-size: 1.1rem; }

/* Nav links */
.topbar-nav { display: flex; align-items: center; gap: .25rem; margin-left: 1.5rem; }
.nav-link {
  padding: .4rem .7rem; border-radius: var(--radius);
  font-size: .8rem; font-weight: 500; color: var(--text-dim);
  transition: all .15s; white-space: nowrap;
}
.nav-link:hover { color: var(--text-hi); background: var(--bg-hover); text-decoration: none; }
.nav-link.active { color: var(--accent); background: var(--accent-glow); }

/* Dropdown */
.nav-dropdown { position: relative; }
.nav-dropdown-menu {
  display: none;
  position: absolute; top: calc(100% + 6px); left: 0;
  min-width: 220px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  z-index: 300;
  padding: .4rem;
}
.nav-dropdown.open .nav-dropdown-menu { display: block; }
.nav-dropdown-menu a {
  display: block; padding: .45rem .75rem;
  font-size: .8rem; color: var(--text);
  border-radius: var(--radius); transition: background .1s;
}
.nav-dropdown-menu a:hover { background: var(--bg-hover); text-decoration: none; color: var(--text-hi); }
.nav-dropdown-menu .separator { height: 1px; background: var(--border); margin: .3rem 0; }

/* Right side of topbar */
.topbar-right { display: flex; align-items: center; gap: .5rem; margin-left: auto; }
.topbar-user {
  font-family: var(--font-mono); font-size: .75rem;
  color: var(--text-dim); display: flex; align-items: center; gap: .4rem;
}
.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-dim); display: inline-block; flex-shrink: 0;
}
.status-dot.live { background: var(--green); box-shadow: 0 0 6px var(--green); }

/* Theme toggle */
.theme-toggle {
  background: none; border: 1px solid var(--border);
  border-radius: var(--radius); padding: .35rem .5rem;
  cursor: pointer; color: var(--text-dim); font-size: .85rem;
  transition: all .15s; line-height: 1;
}
.theme-toggle:hover { border-color: var(--border-hi); color: var(--text-hi); }

/* Mobile hamburger */
.menu-toggle {
  display: none; background: none; border: 1px solid var(--border);
  border-radius: var(--radius); padding: .35rem .5rem;
  cursor: pointer; color: var(--text-dim); font-size: 1rem; line-height: 1;
}

/* ── Main content ───────────────────────────────────────────── */
.main-content { max-width: 1400px; margin: 0 auto; padding: 1.5rem; width: 100%; }

/* ── Page header ────────────────────────────────────────────── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem; gap: 1rem;
}
.page-title {
  font-family: var(--font-mono); font-size: 1.1rem; font-weight: 700;
  color: var(--text-hi); display: flex; align-items: center; gap: .5rem;
}
.page-title .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.page-subtitle { font-size: .8rem; color: var(--text-dim); margin-top: .2rem; }

/* ── Stat cards ─────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem; margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.1rem 1.2rem;
  position: relative; overflow: hidden; transition: border-color .2s;
}
.stat-card:hover { border-color: var(--border-hi); }
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 2px; background: var(--accent); opacity: .6;
}
.stat-card.green::before  { background: var(--green); }
.stat-card.yellow::before { background: var(--yellow); }
.stat-card.red::before    { background: var(--red); }
.stat-card.purple::before { background: var(--purple); }
.stat-card.orange::before { background: var(--orange); }
.stat-label {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .09em;
  color: var(--text-dim); font-weight: 600; margin-bottom: .3rem;
}
.stat-value {
  font-family: var(--font-mono); font-size: 1.9rem; font-weight: 700;
  color: var(--text-hi); line-height: 1.1;
}
.stat-sub { font-size: .72rem; color: var(--text-dim); margin-top: .3rem; line-height: 1.5; }

/* ── Panel ──────────────────────────────────────────────────── */
.panel {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.25rem;
  margin-bottom: 1rem;
}
.panel-title {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .09em;
  font-weight: 700; color: var(--text-dim); margin-bottom: .9rem;
  display: flex; align-items: center; gap: .5rem;
}
.panel-title .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

/* ── Toolbar / filter bar ───────────────────────────────────── */
.toolbar {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem;
  margin-bottom: 1.25rem; padding: 1rem 1.25rem;
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.filter-group { display: flex; flex-direction: column; gap: .3rem; }
.filter-group label {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-dim); font-weight: 600;
}
.toolbar-actions { display: flex; align-items: center; gap: .5rem; margin-left: auto; }

/* ── Form controls ──────────────────────────────────────────── */
.form-control {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-hi);
  font-family: var(--font-mono); font-size: .82rem;
  padding: .45rem .75rem; transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.form-control:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-control::placeholder { color: var(--text-dim); }

select.form-control { cursor: pointer; }

.form-label {
  display: block; font-size: .72rem; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-dim); font-weight: 600;
  margin-bottom: .35rem;
}
.form-group { margin-bottom: 1rem; }

/* checkbox */
.form-check { display: flex; align-items: center; gap: .5rem; }
.form-check input[type=checkbox] { accent-color: var(--accent); width: 14px; height: 14px; cursor: pointer; }
.form-check label { font-size: .82rem; color: var(--text); cursor: pointer; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem 1rem; border-radius: var(--radius);
  border: 1px solid transparent; cursor: pointer;
  font-family: var(--font-ui); font-size: .82rem; font-weight: 600;
  transition: all .15s; white-space: nowrap; text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary   { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { filter: brightness(1.1); color: #fff; }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--border-hi); }
.btn-secondary:hover { background: var(--bg-hover); color: var(--text-hi); }
.btn-danger    { background: rgba(245,74,74,.15); color: var(--red); border-color: rgba(245,74,74,.3); }
.btn-danger:hover { background: rgba(245,74,74,.25); }
.btn-success   { background: rgba(61,202,122,.15); color: var(--green); border-color: rgba(61,202,122,.3); }
.btn-success:hover { background: rgba(61,202,122,.25); }
.btn-sm { padding: .3rem .65rem; font-size: .75rem; }
.btn-lg { padding: .65rem 1.4rem; font-size: .9rem; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn:active { transform: scale(.97); }

/* ── Tables ─────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .8rem; }
thead th {
  padding: .5rem .75rem; text-align: left;
  font-size: .67rem; text-transform: uppercase; letter-spacing: .09em;
  color: var(--text-dim); font-weight: 700;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--border); transition: background .1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }
tbody tr.row-separator td { border-top: 2px solid var(--border-hi); }
tbody td {
  padding: .55rem .75rem; color: var(--text);
  font-size: .8rem; vertical-align: middle;
}
td.mono { font-family: var(--font-mono); }
td.dim  { color: var(--text-dim); }
td.hi   { color: var(--text-hi); font-weight: 600; }
td.green { color: var(--green); font-family: var(--font-mono); font-weight: 700; }
td.red   { color: var(--red);   font-family: var(--font-mono); font-weight: 700; }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: .15rem .55rem; border-radius: 999px;
  font-size: .67rem; font-weight: 700;
  font-family: var(--font-mono); letter-spacing: .02em;
}
.badge-ok     { background: rgba(61,202,122,.15); color: var(--green); }
.badge-warn   { background: rgba(245,200,66,.15);  color: var(--yellow); }
.badge-danger { background: rgba(245,74,74,.15);   color: var(--red); }
.badge-info   { background: rgba(79,142,247,.15);  color: var(--accent); }
.badge-purple { background: rgba(155,126,245,.15); color: var(--purple); }

/* ── Alerts ─────────────────────────────────────────────────── */
.alert {
  padding: .85rem 1.1rem; border-radius: var(--radius);
  font-size: .82rem; margin-bottom: 1rem;
  display: flex; align-items: flex-start; gap: .6rem;
}
.alert-success { background: rgba(61,202,122,.1);  border: 1px solid rgba(61,202,122,.3);  color: var(--green); }
.alert-error   { background: rgba(245,74,74,.1);   border: 1px solid rgba(245,74,74,.3);   color: var(--red); }
.alert-info    { background: rgba(79,142,247,.1);  border: 1px solid rgba(79,142,247,.3);  color: var(--accent); }
.alert-warning { background: rgba(245,200,66,.1);  border: 1px solid rgba(245,200,66,.3);  color: var(--yellow); }

/* ── Cards (generic) ─────────────────────────────────────────── */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  margin-bottom: 1rem;
}
.card-header {
  padding: .75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-size: .75rem; text-transform: uppercase; letter-spacing: .08em;
  font-weight: 700; color: var(--text-dim);
  display: flex; align-items: center; gap: .5rem;
}
.card-body { padding: 1.25rem; }

/* ── Auth card ───────────────────────────────────────────────── */
.auth-shell {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: var(--bg); padding: 1rem;
}
.auth-logo {
  font-family: var(--font-mono); font-size: 1.3rem; font-weight: 700;
  color: var(--text-hi); margin-bottom: 1.5rem; text-align: center;
}
.auth-logo span { color: var(--accent); }
.auth-card {
  width: 100%; max-width: 400px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 2rem;
  box-shadow: var(--shadow);
}
.auth-card h2 {
  font-size: .82rem; text-transform: uppercase; letter-spacing: .09em;
  color: var(--text-dim); font-weight: 700; margin-bottom: 1.5rem;
}

/* ── Public consulta pages ───────────────────────────────────── */
.public-shell {
  min-height: 100vh; background: var(--bg);
  display: flex; flex-direction: column;
}
.public-header {
  background: var(--bg-panel); border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
  display: flex; align-items: center; gap: 1rem;
}
.public-header img { height: 48px; }
.public-header-text h1 {
  font-family: var(--font-mono); font-size: .9rem; font-weight: 700;
  color: var(--text-hi);
}
.public-header-text p { font-size: .75rem; color: var(--text-dim); }
.public-content {
  max-width: 860px; margin: 2rem auto; padding: 0 1rem; width: 100%;
}

/* Student info card */
.student-card {
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.student-card .field { display: flex; gap: .5rem; margin-bottom: .4rem; font-size: .82rem; }
.student-card .field strong { color: var(--text-dim); min-width: 120px; }
.student-card .field span  { color: var(--text-hi); font-family: var(--font-mono); }

/* ── Search bar (public) ─────────────────────────────────────── */
.search-box {
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.search-box h2 {
  font-size: .75rem; text-transform: uppercase; letter-spacing: .09em;
  color: var(--text-dim); font-weight: 700; margin-bottom: .9rem;
}
.search-input-group { display: flex; gap: .5rem; }
.search-input-group .form-control { flex: 1; font-size: 1rem; padding: .65rem .9rem; }

/* ── Nota/grade display ──────────────────────────────────────── */
.nota-disponivel { color: var(--text-hi); font-family: var(--font-mono); font-weight: 700; font-size: 1.1rem; }
.nota-pendente   { color: var(--text-dim); font-size: .78rem; display: flex; align-items: center; gap: .35rem; }
.nota-faltou     { color: var(--red); font-family: var(--font-mono); font-weight: 700; }

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state {
  padding: 3rem; text-align: center;
  color: var(--text-dim); font-size: .85rem;
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: .75rem; opacity: .4; }

/* ── Not-found page ──────────────────────────────────────────── */
.notfound-card {
  background: var(--bg-card); border: 1px solid rgba(245,74,74,.3);
  border-radius: var(--radius-lg); padding: 2rem 1.5rem;
  text-align: center; margin-top: 2rem;
}
.notfound-card .code {
  font-family: var(--font-mono); font-size: 3rem; font-weight: 700;
  color: var(--red); opacity: .7;
}
.notfound-card p { color: var(--text-dim); font-size: .9rem; margin-top: .5rem; }

/* ── Tab nav ─────────────────────────────────────────────────── */
.tab-nav {
  display: flex; gap: .25rem; margin-bottom: 1rem;
  border-bottom: 1px solid var(--border); padding-bottom: 0;
}
.tab-btn {
  background: none; border: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  padding: .5rem .9rem; cursor: pointer;
  font-family: var(--font-ui); font-size: .78rem; font-weight: 600;
  color: var(--text-dim); transition: all .15s; letter-spacing: .02em;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Meta bar (info strip) ───────────────────────────────────── */
.meta-bar {
  display: flex; flex-wrap: wrap; gap: .5rem 1.25rem;
  padding: .6rem .9rem;
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 1.25rem;
  font-family: var(--font-mono); font-size: .72rem; color: var(--text-dim);
}
.meta-bar strong { color: var(--text); }

/* ── Loader ──────────────────────────────────────────────────── */
#loader {
  position: fixed; inset: 0;
  background: rgba(13,15,20,.85);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 999; gap: 1rem;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
#loader.active { opacity: 1; pointer-events: all; }
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader-text { font-family: var(--font-mono); font-size: .8rem; color: var(--text-dim); }

/* ── File list ───────────────────────────────────────────────── */
.file-row {
  display: flex; align-items: center; gap: 1rem;
  padding: .6rem .75rem; border-bottom: 1px solid var(--border);
  font-size: .8rem;
}
.file-row:last-child { border-bottom: none; }
.file-name { font-family: var(--font-mono); color: var(--text-hi); flex: 1; }
.file-meta { color: var(--text-dim); font-size: .72rem; }

/* ── Progress bar ────────────────────────────────────────────── */
.bar-cell { display: flex; align-items: center; gap: .5rem; min-width: 120px; }
.bar-bg { flex: 1; height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 3px; opacity: .8; transition: width .4s; }

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ── Animations ──────────────────────────────────────────────── */
.fade-in { animation: fadeIn .3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .topbar-nav { display: none; }
  .topbar-nav.open { display: flex; flex-direction: column; width: 100%; }
  .menu-toggle { display: block; }
  .main-content { padding: 1rem; }
  .stat-value { font-size: 1.5rem; }
  .toolbar { gap: .5rem; }
  .search-input-group { flex-direction: column; }
  .page-header { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 600px) {
  .topbar { padding: .6rem 1rem; }
  .auth-card { padding: 1.5rem; }
}
