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

:root {
  --brand: #1d4ed8;
  --brand-hover: #1e40af;
  --brand-light: #dbeafe;
  --gray-50: #f8fafc; --gray-100: #f1f5f9; --gray-200: #e2e8f0;
  --gray-300: #cbd5e1; --gray-400: #94a3b8; --gray-500: #64748b;
  --gray-600: #475569; --gray-700: #334155; --gray-800: #1e293b; --gray-900: #0f172a;
  --green: #10b981; --green-light: #d1fae5;
  --red: #ef4444;   --red-light: #fee2e2;
  --yellow: #f59e0b; --yellow-light: #fef3c7;
  --blue-light: #dbeafe;
  --topbar-h: 60px;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,.10);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background: var(--gray-50); color: var(--gray-800); font-size: 14px; }
a { color: inherit; text-decoration: none; }

/* ── TOPBAR ── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h);
  background: var(--brand); z-index: 200;
  display: flex; align-items: center; padding: 0 24px; gap: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.topbar-brand {
  display: flex; align-items: center; gap: 10px; color: #fff;
  font-weight: 700; font-size: 16px; white-space: nowrap; padding-right: 32px;
  border-right: 1px solid rgba(255,255,255,.2); margin-right: 8px;
  text-decoration: none;
}
.topbar-brand img.logo { height: 36px; width: auto; border-radius: 6px; object-fit: contain; }
.topbar-brand .icon { font-size: 22px; }
.topbar-nav { display: flex; align-items: center; gap: 2px; flex: 1; }

/* Dropdown fix: ponte invisível entre botão e menu */
.nav-group { position: relative; }
.nav-group-btn {
  display: flex; align-items: center; gap: 6px; padding: 8px 14px;
  color: rgba(255,255,255,.85); border-radius: 7px; cursor: pointer;
  font-size: 13.5px; font-weight: 500; border: none; background: none;
  transition: all .15s; white-space: nowrap;
}
.nav-group-btn:hover, .nav-group-btn.active { background: rgba(255,255,255,.15); color: #fff; }
.nav-group-btn .arrow { font-size: 10px; margin-left: 2px; transition: transform .2s; }
.nav-group:hover .nav-group-btn .arrow { transform: rotate(180deg); }
.nav-dropdown {
  position: absolute; top: 100%; left: 0;
  padding-top: 6px;           /* ← ponte: hover não some ao passar para o menu */
  min-width: 210px; z-index: 300;
  display: none; pointer-events: none;
}
.nav-dropdown-inner {
  background: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow-md); border: 1px solid var(--gray-200);
  overflow: hidden; pointer-events: auto;
}
.nav-group:hover .nav-dropdown { display: block; pointer-events: auto; }
.nav-dropdown a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; color: var(--gray-700); font-size: 13.5px;
  transition: background .1s;
}
.nav-dropdown a:hover { background: var(--gray-50); color: var(--brand); }
.nav-dropdown a .icon { width: 20px; text-align: center; }
.nav-dropdown-divider { height: 1px; background: var(--gray-200); margin: 4px 0; }

.topbar-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.topbar-user { display: flex; align-items: center; gap: 8px; color: rgba(255,255,255,.9); }
.topbar-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,.2); border: 2px solid rgba(255,255,255,.3);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: #fff; overflow: hidden;
}
.topbar-avatar img { width: 100%; height: 100%; object-fit: cover; }
.topbar-user-info .name { font-size: 13px; font-weight: 600; }
.topbar-user-info .role { font-size: 11px; color: rgba(255,255,255,.65); }
.topbar-logout {
  color: rgba(255,255,255,.8); font-size: 13px; padding: 6px 12px;
  border-radius: 6px; border: 1px solid rgba(255,255,255,.25);
  transition: all .15s;
}
.topbar-logout:hover { background: rgba(255,255,255,.15); color: #fff; }
.topbar-year {
  font-size: 12px; color: rgba(255,255,255,.7);
  padding: 4px 10px; background: rgba(255,255,255,.1); border-radius: 20px;
}

/* ── MAIN CONTENT ── */
.page-wrap { padding-top: calc(var(--topbar-h) + 24px); padding-bottom: 40px; }
.container { max-width: 1300px; margin: 0 auto; padding: 0 24px; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-title { font-size: 20px; font-weight: 700; color: var(--gray-900); display: flex; align-items: center; gap: 8px; }
.page-subtitle { font-size: 13px; color: var(--gray-500); margin-top: 2px; }

/* ── CARDS ── */
.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--gray-200); }
.card-body { padding: 20px; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--gray-100); display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 15px; font-weight: 600; color: var(--gray-800); }
.card-footer { padding: 12px 20px; border-top: 1px solid var(--gray-100); background: var(--gray-50); border-radius: 0 0 var(--radius) var(--radius); }

/* ── STATS ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #fff; border-radius: var(--radius); padding: 20px; border: 1px solid var(--gray-200); display: flex; align-items: center; gap: 16px; }
.stat-icon { width: 50px; height: 50px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.stat-value { font-size: 26px; font-weight: 700; line-height: 1; color: var(--gray-900); }
.stat-label { font-size: 12px; color: var(--gray-500); margin-top: 3px; }

/* ── TABLES ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th { text-align: left; padding: 10px 14px; font-size: 11px; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: .06em; background: var(--gray-50); border-bottom: 2px solid var(--gray-200); white-space: nowrap; }
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--gray-100); font-size: 13.5px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #fafbfc; }

/* ── BADGES ── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 500; white-space: nowrap; }
.badge-green  { background: var(--green-light); color: #065f46; }
.badge-red    { background: var(--red-light); color: #991b1b; }
.badge-yellow { background: var(--yellow-light); color: #92400e; }
.badge-blue   { background: var(--blue-light); color: #1e40af; }
.badge-gray   { background: var(--gray-100); color: var(--gray-600); }
.badge-purple { background: #ede9fe; color: #5b21b6; }

/* ── BUTTONS ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 7px; font-size: 13.5px; font-weight: 500; cursor: pointer; border: none; text-decoration: none; transition: all .15s; white-space: nowrap; font-family: inherit; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); border: 1px solid var(--gray-200); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { filter: brightness(1.05); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { filter: brightness(1.05); }
.btn-warning { background: var(--yellow); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn-xs { padding: 3px 8px; font-size: 11.5px; border-radius: 5px; }
.btn-outline { background: transparent; border: 1.5px solid var(--brand); color: var(--brand); }
.btn-outline:hover { background: var(--brand); color: #fff; }

/* ── FORMS ── */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.span-2 { grid-column: span 2; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: 12px; font-weight: 600; color: var(--gray-600); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="tel"], input[type="color"], select, textarea {
  width: 100%; padding: 8px 11px; border: 1.5px solid var(--gray-200);
  border-radius: 7px; font-size: 13.5px; font-family: inherit;
  color: var(--gray-800); background: #fff; transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(29,78,216,.08); }
textarea { resize: vertical; min-height: 80px; }
.form-section { font-size: 11px; font-weight: 700; color: var(--gray-400); text-transform: uppercase; letter-spacing: .08em; padding: 16px 0 4px; border-top: 1px solid var(--gray-100); margin-top: 4px; grid-column: 1/-1; }
.form-hint { font-size: 11.5px; color: var(--gray-400); margin-top: 2px; }
.input-group { display: flex; gap: 6px; }
.input-group input { flex: 1; }

/* ── ALERTS ── */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 13.5px; display: flex; align-items: center; gap: 10px; }
.alert-success { background: var(--green-light); color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger   { background: var(--red-light); color: #991b1b; border: 1px solid #fca5a5; }
.alert-warning  { background: var(--yellow-light); color: #92400e; border: 1px solid #fde68a; }
.alert-info     { background: var(--blue-light); color: #1e40af; border: 1px solid #bfdbfe; }

/* ── MODALS ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 500; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.open { display: flex; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-md); }
.modal-sm { max-width: 420px; }
.modal-md { max-width: 600px; }
.modal-lg { max-width: 860px; }
.modal-header { padding: 18px 22px; border-bottom: 1px solid var(--gray-200); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: #fff; z-index: 1; }
.modal-title { font-size: 16px; font-weight: 700; }
.modal-body { padding: 22px; }
.modal-footer { padding: 14px 22px; border-top: 1px solid var(--gray-200); display: flex; justify-content: flex-end; gap: 8px; background: var(--gray-50); border-radius: 0 0 14px 14px; }
.close-btn { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--gray-400); padding: 2px 6px; border-radius: 5px; line-height: 1; }
.close-btn:hover { background: var(--gray-100); color: var(--gray-700); }

/* ── PHOTO UPLOAD ── */
.photo-upload { display: flex; align-items: center; gap: 16px; }
.photo-preview { width: 80px; height: 80px; border-radius: 50%; background: var(--gray-100); border: 2px dashed var(--gray-300); display: flex; align-items: center; justify-content: center; font-size: 28px; overflow: hidden; flex-shrink: 0; cursor: pointer; }
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-upload-btn { font-size: 13px; color: var(--brand); cursor: pointer; font-weight: 500; }

/* ── LOGO UPLOAD ── */
.logo-preview { height: 80px; background: var(--gray-100); border: 2px dashed var(--gray-300); border-radius: 10px; display: flex; align-items: center; justify-content: center; overflow: hidden; margin-bottom: 8px; }
.logo-preview img { max-height: 72px; max-width: 100%; object-fit: contain; }

/* ── UTILS ── */
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.mt-2 { margin-top: 8px; } .mt-4 { margin-top: 16px; }
.text-sm { font-size: 12px; } .text-xs { font-size: 11px; }
.text-muted { color: var(--gray-500); } .text-right { text-align: right; } .text-center { text-align: center; }
.font-bold { font-weight: 700; } .font-semibold { font-weight: 600; } .font-medium { font-weight: 500; }
.color-green { color: var(--green); } .color-red { color: var(--red); } .color-brand { color: var(--brand); }
.w-full { width: 100%; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.progress-bar { height: 6px; background: var(--gray-200); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; background: var(--brand); transition: width .3s; }
.empty-state { text-align: center; padding: 48px 24px; color: var(--gray-400); }
.empty-state .icon { font-size: 40px; margin-bottom: 10px; }
.empty-state p { font-size: 14px; }
.search-bar { padding: 8px 12px; border: 1.5px solid var(--gray-200); border-radius: 7px; font-size: 13px; width: 240px; font-family: inherit; }
.search-bar:focus { outline: none; border-color: var(--brand); }
.divider { height: 1px; background: var(--gray-100); margin: 16px 0; }
.chip { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; background: var(--gray-100); color: var(--gray-600); }

/* ── LOGIN PAGES ── */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-bg-admin    { background: linear-gradient(135deg, #0f172a 0%, #1d4ed8 100%); }
.login-bg-professor{ background: linear-gradient(135deg, #064e3b 0%, #0f766e 100%); }
.login-bg-aluno    { background: linear-gradient(135deg, #3b0764 0%, #7c3aed 100%); }
.login-card { background: #fff; border-radius: 20px; padding: 44px; width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo .school-logo { max-height: 80px; max-width: 200px; object-fit: contain; margin: 0 auto 12px; display: block; }
.login-logo .emoji-icon { font-size: 56px; line-height: 1; display: block; margin-bottom: 10px; }
.login-logo h1 { font-size: 22px; font-weight: 700; color: var(--gray-900); }
.login-logo p { color: var(--gray-500); font-size: 13px; margin-top: 4px; }
.login-portal-badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 14px; border-radius: 20px; font-size: 12px; font-weight: 600; margin-top: 10px; }
.login-portal-badge.admin    { background: #dbeafe; color: #1e40af; }
.login-portal-badge.professor{ background: #d1fae5; color: #065f46; }
.login-portal-badge.aluno    { background: #ede9fe; color: #5b21b6; }
.login-other-portals { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--gray-100); text-align: center; }
.login-other-portals p { font-size: 12px; color: var(--gray-400); margin-bottom: 10px; }
.login-other-portals .portal-links { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.portal-link { display: inline-flex; align-items: center; gap: 5px; padding: 6px 14px; border-radius: 20px; font-size: 12px; font-weight: 500; border: 1.5px solid; text-decoration: none; transition: all .15s; }
.portal-link:hover { transform: translateY(-1px); }
.portal-link.admin    { border-color: #1d4ed8; color: #1d4ed8; }
.portal-link.professor{ border-color: #0f766e; color: #0f766e; }
.portal-link.aluno    { border-color: #7c3aed; color: #7c3aed; }

/* ── PORTAL DO PROFESSOR ── */
.topbar-prof { background: #0f766e; }
.topbar-aluno { background: #7c3aed; }
.portal-badge { background: rgba(255,255,255,.15); padding: 3px 10px; border-radius: 20px; font-size: 11px; color: rgba(255,255,255,.9); }

/* ── BOLETIM ── */
.boletim-table th { background: var(--brand); color: #fff; }
.boletim-table td { text-align: center; }
.boletim-table td:first-child { text-align: left; font-weight: 500; }

/* ── NOTA CARDS ── */
.nota-big { font-size:28px;font-weight:800;line-height:1; }
.disc-card { background:#fff;border-radius:10px;border:1px solid var(--gray-200);overflow:hidden;margin-bottom:12px; }
.disc-header { padding:12px 16px;background:var(--gray-50);border-bottom:1px solid var(--gray-200);display:flex;justify-content:space-between;align-items:center; }
.disc-body { padding:12px 16px; }
.media-badge { font-size:22px;font-weight:800; }

/* ── PRINT ── */
@media print {
  .topbar, .no-print { display: none !important; }
  .page-wrap { padding-top: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .topbar-nav { display: none; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .container { padding: 0 12px; }
}
