/* ============================================================
   AULAS  –  main.css
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:           #f7f8fc;
  --surface:      #ffffff;
  --surface-2:    #f0f2f8;
  --border:       #e2e5f0;
  --border-2:     #c8cedf;
  --text-1:       #111827;
  --text-2:       #4b5563;
  --text-3:       #9ca3af;
  --accent:       #2563eb;
  --accent-2:     #1d4ed8;
  --accent-light: #dbeafe;
  --accent-text:  #1e40af;
  --admin-color:     #7c3aed;
  --professor-color: #0891b2;
  --pai-color:       #059669;
  --aluno-color:     #d97706;
  --success:  #16a34a;
  --warning:  #d97706;
  --danger:   #dc2626;
  --info:     #0891b2;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:    0 4px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 28px rgba(0,0,0,.12);
  --radius:    8px;
  --radius-lg: 14px;
  --nav-h:     60px;
  --font-sans: 'Plus Jakarta Sans', system-ui, sans-serif;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-1);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 99px; }

/* ── Navbar ─────────────────────────────────────────────────── */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  padding: 0 20px;
  box-shadow: var(--shadow-sm);
}

.navbar-brand {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-weight: 700; font-size: 18px;
  color: var(--text-1);
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
  margin-right: 24px;
}
.brand-icon { font-size: 22px; color: var(--accent); line-height: 1; }

.nav-links {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  gap: 2px;
  list-style: none;
  -webkit-flex: 1;
  flex: 1;
}
.nav-links a {
  display: block;
  padding: 6px 12px;
  text-decoration: none;
  font-size: 14px; font-weight: 500;
  color: var(--text-2);
  border-radius: var(--radius);
  -webkit-transition: background .15s, color .15s;
  transition: background .15s, color .15s;
}
.nav-links a:hover, .nav-links a.active {
  background: var(--accent-light);
  color: var(--accent-text);
}

/* User menu */
.nav-user { margin-left: auto; position: relative; }

.user-btn {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 6px 12px;
  cursor: pointer;
  -webkit-transition: border-color .15s, box-shadow .15s;
  transition: border-color .15s, box-shadow .15s;
}
.user-btn:hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }

.user-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 12px; font-weight: 700;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
}
.user-name-short { font-size: 14px; font-weight: 500; }
.user-role-badge {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 99px;
  background: var(--accent-light);
  color: var(--accent-text);
  font-weight: 600;
}

.papel-admin     .user-role-badge { background: #ede9fe; color: var(--admin-color); }
.papel-professor .user-role-badge { background: #e0f7fa; color: var(--professor-color); }
.papel-pai       .user-role-badge { background: #d1fae5; color: var(--pai-color); }
.papel-aluno     .user-role-badge { background: #fef3c7; color: var(--aluno-color); }

.user-dropdown {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 200;
}

.dropdown-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: -webkit-flex;
  display: flex;
  -webkit-flex-direction: column;
  flex-direction: column;
  gap: 2px;
}
.dropdown-header strong { font-size: 14px; }
.dropdown-header span { font-size: 12px; color: var(--text-3); }

.user-dropdown a {
  display: block; padding: 10px 16px;
  text-decoration: none; font-size: 14px; color: var(--text-2);
  -webkit-transition: background .12s;
  transition: background .12s;
}
.user-dropdown a:hover { background: var(--surface-2); }
.user-dropdown .logout-link { color: var(--danger); }
.user-dropdown .logout-link:hover { background: #fef2f2; }

.hamburger {
  display: none;
  -webkit-flex-direction: column;
  flex-direction: column;
  gap: 5px;
  background: none; border: none; cursor: pointer; padding: 8px;
}
.hamburger span {
  display: block; width: 22px; height: 2px;
  background: var(--text-1); border-radius: 2px;
  -webkit-transition: .2s; transition: .2s;
}

/* ── Layout ─────────────────────────────────────────────────── */
.page-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: calc(var(--nav-h) + 32px) 20px 48px;
}

.page-header {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: flex-start;
  align-items: flex-start;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
}
.page-header h1 { font-size: 24px; font-weight: 700; letter-spacing: -.4px; }
.page-header p  { color: var(--text-2); font-size: 14px; margin-top: 2px; }

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  gap: 12px;
}
.card-header h2 { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }

/* ── Stat cards ─────────────────────────────────────────────── */
.stats-grid {
  display: -webkit-flex;
  display: flex;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 28px;
}
.stats-grid > * {
  -webkit-flex: 1 1 160px;
  flex: 1 1 160px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: -webkit-flex;
  display: flex;
  -webkit-flex-direction: column;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow-sm);
  -webkit-transition: box-shadow .2s, -webkit-transform .2s;
  transition: box-shadow .2s, transform .2s;
}
.stat-card:hover { box-shadow: var(--shadow); -webkit-transform: translateY(-1px); transform: translateY(-1px); }
.stat-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; color: var(--text-3); }
.stat-value { font-size: 32px; font-weight: 700; letter-spacing: -1px; line-height: 1; }
.stat-sub   { font-size: 12px; color: var(--text-3); }
.stat-card.accent  { border-color: var(--accent);  }
.stat-card.accent  .stat-value { color: var(--accent); }
.stat-card.success { border-color: var(--success); }
.stat-card.success .stat-value { color: var(--success); }
.stat-card.warning { border-color: var(--warning); }
.stat-card.warning .stat-value { color: var(--warning); }
.stat-card.purple  { border-color: var(--admin-color); }
.stat-card.purple  .stat-value { color: var(--admin-color); }

/* ── Tabelas ────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .6px;
  color: var(--text-3);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-1);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-2); }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: -webkit-inline-flex;
  display: inline-flex;
  -webkit-align-items: center;
  align-items: center;
  padding: 3px 9px; border-radius: 99px;
  font-size: 11px; font-weight: 600;
  white-space: nowrap;
}
.badge-admin     { background: #ede9fe; color: var(--admin-color); }
.badge-professor { background: #e0f7fa; color: var(--professor-color); }
.badge-pai       { background: #d1fae5; color: var(--pai-color); }
.badge-aluno     { background: #fef3c7; color: var(--aluno-color); }
.badge-success   { background: #dcfce7; color: var(--success); }
.badge-danger    { background: #fee2e2; color: var(--danger); }
.badge-info      { background: #e0f2fe; color: var(--info); }
.badge-neutral   { background: var(--surface-2); color: var(--text-2); }

/* Notas */
.nota-muito-bom { color: #16a34a; font-weight: 600; }
.nota-bom       { color: #2563eb; font-weight: 600; }
.nota-suf       { color: #d97706; font-weight: 600; }
.nota-insuf     { color: #dc2626; font-weight: 600; }

/* ── Botões ─────────────────────────────────────────────────── */
.btn {
  display: -webkit-inline-flex;
  display: inline-flex;
  -webkit-align-items: center;
  align-items: center;
  gap: 6px;
  padding: 9px 18px; border-radius: var(--radius);
  font-family: var(--font-sans); font-size: 14px; font-weight: 600;
  cursor: pointer; border: 1px solid transparent;
  text-decoration: none; line-height: 1.4;
  -webkit-transition: background .15s, box-shadow .15s;
  transition: background .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn:active { opacity: .85; }

.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); box-shadow: 0 0 0 3px var(--accent-light); }
.btn-secondary { background: var(--surface-2); color: var(--text-1); border-color: var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-ghost { background: transparent; color: var(--text-2); border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); color: var(--text-1); }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-xs { padding: 3px 9px; font-size: 12px; }

/* ── Formulários ────────────────────────────────────────────── */
.form-group { display: -webkit-flex; display: flex; -webkit-flex-direction: column; flex-direction: column; gap: 5px; margin-bottom: 18px; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--text-2); }

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  font-family: var(--font-sans); font-size: 14px;
  color: var(--text-1); background: var(--surface);
  -webkit-transition: border-color .15s, box-shadow .15s;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.form-control::-webkit-input-placeholder { color: var(--text-3); }
.form-control::placeholder { color: var(--text-3); }
textarea.form-control { resize: vertical; min-height: 90px; }

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239ca3af' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

.form-row { display: -webkit-flex; display: flex; gap: 16px; -webkit-flex-wrap: wrap; flex-wrap: wrap; }
.form-row > * { -webkit-flex: 1 1 200px; flex: 1 1 200px; }

.form-hint  { font-size: 12px; color: var(--text-3); }
.form-error { font-size: 12px; color: var(--danger); }

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.45);
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  -webkit-transition: opacity .2s;
  transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 540px;
  max-height: 90vh; overflow-y: auto;
  -webkit-transform: translateY(20px);
  transform: translateY(20px);
  -webkit-transition: -webkit-transform .2s;
  transition: transform .2s;
}
.modal-overlay.open .modal { -webkit-transform: none; transform: none; }

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: space-between;
  justify-content: space-between;
}
.modal-header h3 { font-size: 17px; font-weight: 700; }
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-3); font-size: 22px; line-height: 1;
  padding: 4px; border-radius: var(--radius);
  -webkit-transition: color .15s; transition: color .15s;
}
.modal-close:hover { color: var(--text-1); background: var(--surface-2); }
.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: -webkit-flex;
  display: flex;
  -webkit-justify-content: flex-end;
  justify-content: flex-end;
  gap: 10px;
}

/* ── Pesquisa ────────────────────────────────────────────────── */
.search-bar {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
}
.search-input-wrap { position: relative; -webkit-flex: 1; flex: 1; min-width: 200px; }
.search-input-wrap .search-icon {
  position: absolute; left: 11px; top: 50%;
  -webkit-transform: translateY(-50%);
  transform: translateY(-50%);
  color: var(--text-3); pointer-events: none; font-size: 15px;
}
.search-input-wrap input {
  width: 100%; padding: 9px 12px 9px 34px;
  border: 1px solid var(--border-2); border-radius: var(--radius);
  font-family: var(--font-sans); font-size: 14px;
  outline: none;
  -webkit-transition: border-color .15s, box-shadow .15s;
  transition: border-color .15s, box-shadow .15s;
}
.search-input-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* ── Login page ─────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 400px;
  padding: 40px 36px;
}
.login-brand { text-align: center; margin-bottom: 32px; }
.login-brand h1 { font-size: 26px; font-weight: 700; letter-spacing: -.5px; }
.login-brand p  { font-size: 13px; color: var(--text-3); margin-top: 4px; }

/* ── Alertas ─────────────────────────────────────────────────── */
.alert {
  padding: 11px 14px; border-radius: var(--radius);
  font-size: 13px; margin-bottom: 16px;
  border: 1px solid;
}
.alert-error   { background: #fef2f2; border-color: #fecaca; color: var(--danger); }
.alert-success { background: #f0fdf4; border-color: #bbf7d0; color: var(--success); }
.alert-info    { background: #eff6ff; border-color: #bfdbfe; color: var(--info); }

/* ── Dashboard ──────────────────────────────────────────────── */
.dashboard-grid {
  display: -webkit-flex;
  display: flex;
  gap: 20px;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
}
.dashboard-grid > * { -webkit-flex: 1 1 300px; flex: 1 1 300px; }

.recent-item {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.recent-item:last-child { border-bottom: none; }
.recent-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); -webkit-flex-shrink: 0; flex-shrink: 0; }
.recent-info { -webkit-flex: 1; flex: 1; min-width: 0; }
.recent-info strong { display: block; font-size: 13px; font-weight: 600; }
.recent-info span { font-size: 12px; color: var(--text-3); }
.recent-time { font-size: 12px; color: var(--text-3); white-space: nowrap; }

/* ── Aluno header ────────────────────────────────────────────── */
.aluno-header {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
}
.aluno-avatar {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--accent); color: #fff;
  font-size: 26px; font-weight: 700;
  display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center;
  -webkit-justify-content: center; justify-content: center;
  -webkit-flex-shrink: 0; flex-shrink: 0;
}
.aluno-meta strong { font-size: 20px; font-weight: 700; display: block; }
.aluno-meta span   { font-size: 13px; color: var(--text-3); }

/* ── Tabs ────────────────────────────────────────────────────── */
.tabs {
  display: -webkit-flex;
  display: flex;
  gap: 2px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}
.tab-btn {
  padding: 9px 16px; background: none; border: none;
  font-family: var(--font-sans); font-size: 14px; font-weight: 500;
  color: var(--text-2); cursor: pointer;
  border-radius: var(--radius) var(--radius) 0 0;
  position: relative;
  -webkit-transition: color .15s; transition: color .15s;
}
.tab-btn:hover { color: var(--accent); background: var(--accent-light); }
.tab-btn.active { color: var(--accent); font-weight: 700; }
.tab-btn.active::after {
  content: ''; position: absolute; bottom: -2px; left: 0; right: 0;
  height: 2px; background: var(--accent); border-radius: 2px;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-3); }
.empty-state .empty-icon { font-size: 36px; display: block; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ── Toast ──────────────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 300;
  display: -webkit-flex; display: flex;
  -webkit-flex-direction: column; flex-direction: column;
  gap: 8px;
}
.toast {
  min-width: 260px; max-width: 360px;
  padding: 13px 16px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center;
  gap: 10px; cursor: pointer;
}
.toast-success { background: #16a34a; color: #fff; }
.toast-error   { background: var(--danger); color: #fff; }
.toast-info    { background: var(--accent); color: #fff; }

/* ── Chips ───────────────────────────────────────────────────── */
.chip-list { display: -webkit-flex; display: flex; -webkit-flex-wrap: wrap; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 4px 11px; border-radius: 99px;
  border: 1px solid var(--border);
  font-size: 12px; font-weight: 500; color: var(--text-2);
  background: var(--surface);
}
.chip.selected { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav-links {
    display: none;
    -webkit-flex-direction: column; flex-direction: column;
    position: fixed; top: var(--nav-h); left: 0; right: 0;
    background: var(--surface); border-bottom: 1px solid var(--border);
    padding: 12px; gap: 2px;
    box-shadow: var(--shadow);
  }
  .nav-links.open { display: -webkit-flex; display: flex; }
  .nav-links a { padding: 10px 14px; }
  .hamburger { display: -webkit-flex; display: flex; margin-left: auto; }
  .nav-user  { display: none; }
  .page-wrapper { padding-top: calc(var(--nav-h) + 20px); padding-left: 14px; padding-right: 14px; }
  .modal { max-width: 100%; }
  .login-card { padding: 28px 22px; }
  .aluno-header > div:last-child { width: 100%; }
}

@media (max-width: 480px) {
  .stats-grid > * { -webkit-flex: 1 1 100%; flex: 1 1 100%; }
  .page-header { -webkit-flex-direction: column; flex-direction: column; }
}

@media print {
  .navbar, .btn, .modal-overlay, .toast-container { display: none !important; }
  .page-wrapper { padding-top: 0; }
}
