/* =====================================================================
   Jagdish Memorial Public School — Staff Portal (C-Panel) Stylesheet
   Loaded together with style.css, which supplies color tokens, buttons,
   form fields, and card/alert styles. This file adds the dashboard
   shell: sidebar, topbar, data tables, and stat cards.

   Signature motif: the sidebar carries a thin gold "ledger margin"
   rule — a quiet nod to a school register/attendance book, echoed in
   the monospace figures used for every data stat.
   ===================================================================== */

:root {
    --portal-font-mono: 'IBM Plex Mono', 'Courier New', monospace;
    --sidebar-width: 264px;
}

body.portal-body { background: var(--ivory-50); }

/* ---------- Shell layout ---------- */
.portal-shell { display: flex; min-height: 100vh; }

.portal-sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--navy-900);
    color: #C7D2E4;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    padding: 26px 0 26px 34px;
    position: relative;
}
/* ledger margin rule */
.portal-sidebar::before {
    content: '';
    position: absolute;
    top: 0; bottom: 0; left: 24px;
    width: 1px;
    background: repeating-linear-gradient(180deg, rgba(201,162,75,0.55) 0 6px, transparent 6px 12px);
}

.portal-brand { display: flex; align-items: center; gap: 10px; padding-right: 20px; margin-bottom: 30px; }
.portal-brand span { font-family: var(--font-display); font-size: 1rem; color: #fff; line-height: 1.2; }
.portal-brand small { display: block; font-family: var(--font-body); font-size: 0.68rem; letter-spacing: 0.08em; color: var(--gold-300); text-transform: uppercase; }

.portal-nav { display: flex; flex-direction: column; gap: 2px; padding-right: 16px; }
.portal-nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 14px; border-radius: 10px 0 0 10px;
    color: #B9C4D8; font-size: 0.92rem; font-weight: 500;
}
.portal-nav a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.portal-nav a.active { background: var(--ivory-50); color: var(--navy-900); font-weight: 700; }
.portal-nav .nav-icon { width: 20px; text-align: center; }
.portal-nav-group-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; color: #6E7C99; margin: 20px 0 8px 14px; }

.portal-sidebar-foot { margin-top: 30px; padding: 16px 20px 0 14px; border-top: 1px solid rgba(255,255,255,0.08); font-size: 0.78rem; color: #7C88A3; }

/* ---------- Main area ---------- */
.portal-main { flex: 1; min-width: 0; }
.portal-topbar {
    background: var(--paper-white);
    border-bottom: 1px solid var(--line);
    padding: 16px 32px;
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
}
.portal-topbar h1 { font-size: 1.3rem; margin: 0; }
.portal-user { display: flex; align-items: center; gap: 12px; }
.portal-user-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--navy-900); color: var(--gold-300); display: flex; align-items: center; justify-content: center; font-weight: 700; }
.role-tag { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; }
.role-tag.vice_principal { background: #F1E4C4; color: #8A6A16; }
.role-tag.class_teacher { background: #DCEAF7; color: #1B5A8A; }
.role-tag.staff { background: #E4E7EE; color: #4A5063; }

.portal-content { padding: 32px; max-width: 1280px; }
.mobile-toggle { display: none; background: var(--navy-900); color: #fff; border: 0; width: 40px; height: 40px; border-radius: 8px; font-size: 1.2rem; cursor: pointer; }

@media (max-width: 900px) {
    .portal-sidebar { position: fixed; z-index: 400; transform: translateX(-100%); transition: transform 0.2s ease; }
    .portal-sidebar.open { transform: translateX(0); }
    .mobile-toggle { display: inline-flex; align-items: center; justify-content: center; }
    .portal-content { padding: 20px; }
}

/* ---------- Stat cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 32px; }
@media (max-width: 960px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .stat-grid { grid-template-columns: 1fr; } }
.stat-card {
    background: var(--navy-900);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    color: #fff;
    position: relative;
    overflow: hidden;
}
.stat-card .stat-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: #AEB9CE; margin-bottom: 10px; }
.stat-card .stat-value { font-family: var(--portal-font-mono); font-size: 2.1rem; font-weight: 700; color: var(--gold-300); }
.stat-card .stat-icon { position: absolute; right: 16px; top: 16px; font-size: 1.6rem; opacity: 0.35; }
.stat-card.light { background: var(--paper-white); border: 1px solid var(--line); color: var(--ink-800); }
.stat-card.light .stat-label { color: var(--ink-600); }
.stat-card.light .stat-value { color: var(--navy-900); }

/* ---------- Class-count bar chart (pure CSS) ---------- */
.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 200px; padding: 10px 6px 0; overflow-x: auto; }
.bar-chart-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; min-width: 40px; height: 100%; }
.bar-chart-fill { width: 26px; border-radius: 6px 6px 0 0; background: linear-gradient(180deg, var(--gold-300), var(--gold-500)); }
.bar-chart-count { font-family: var(--portal-font-mono); font-size: 0.78rem; margin-bottom: 4px; color: var(--navy-900); font-weight: 700; }
.bar-chart-label { font-size: 0.68rem; margin-top: 8px; color: var(--ink-600); text-align: center; max-width: 50px; }

/* ---------- Panel / section card ---------- */
.panel { background: var(--paper-white); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 26px; margin-bottom: 26px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.panel-head h2 { margin: 0; font-size: 1.15rem; }

/* ---------- Data table ---------- */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.data-table th {
    text-align: left; padding: 12px 14px; background: var(--ivory-50);
    color: var(--navy-900); font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.04em;
    border-bottom: 2px solid var(--line);
}
table.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data-table tr:hover td { background: #FBFAF6; }
.table-actions { display: flex; gap: 6px; }
.icon-btn {
    width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line);
    background: var(--paper-white); display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 0.85rem; color: var(--ink-600);
}
.icon-btn:hover { border-color: var(--gold-500); color: var(--navy-900); }
.icon-btn.danger:hover { border-color: var(--danger); color: var(--danger); }
.status-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 0.76rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.status-pill.active { background: #E7F3ED; color: var(--success); }
.status-pill.inactive { background: #F1E4E3; color: var(--danger); }

.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 20px; }
.toolbar select, .toolbar input[type="search"] { max-width: 220px; }
.count-chip { font-family: var(--portal-font-mono); background: var(--ivory-50); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; font-size: 0.82rem; color: var(--navy-900); }

.empty-state { text-align: center; padding: 50px 20px; color: var(--ink-600); }
.empty-state .glyph { font-size: 2.4rem; margin-bottom: 10px; }

/* ---------- Login screen ---------- */
.login-shell {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: radial-gradient(circle at 20% 20%, rgba(201,162,75,0.15), transparent 40%), var(--navy-900);
    padding: 24px;
}
.login-card {
    width: 100%; max-width: 420px;
    background: var(--paper-white);
    border-radius: var(--radius-lg);
    padding: 40px 36px;
    box-shadow: var(--shadow-lift);
}
.login-card .crest { display: block; margin: 0 auto 16px; }
.login-card h1 { text-align: center; font-size: 1.35rem; margin-bottom: 4px; }
.login-card .sub { text-align: center; color: var(--ink-600); font-size: 0.88rem; margin-bottom: 26px; }
.login-secure-note { display: flex; align-items: center; gap: 8px; font-size: 0.78rem; color: var(--ink-600); background: var(--ivory-50); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-top: 20px; }
.login-back { display: block; text-align: center; margin-top: 18px; font-size: 0.85rem; color: var(--navy-900); font-weight: 600; }
