/* ===================================================================
   School CMS — Admin Design System
   Palette: deep academic teal sidebar, warm brass accent, cream canvas
   Type: Poppins (headings/brand) + Inter (UI/body)
=================================================================== */

:root {
    --ink-900: #0e2e2c;
    --ink-800: #123c39;
    --ink-700: #17524d;
    --brass-500: #c79a3f;
    --brass-600: #b1872f;
    --canvas: #f6f5f1;
    --paper: #ffffff;
    --line: #e7e4db;
    --text-900: #1f2622;
    --text-600: #5b665f;
    --text-400: #93998f;
    --success: #2f8f6a;
    --danger: #c5573b;
    --warning: #c79a3f;
    --info: #3b7fc5;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px rgba(14, 46, 44, 0.06);
    --shadow-md: 0 8px 24px rgba(14, 46, 44, 0.08);
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--canvas);
    color: var(--text-900);
    font-size: 14.5px;
}

h1, h2, h3, h4, h5, .brand-text {
    font-family: 'Poppins', sans-serif;
    color: var(--ink-900);
}

a { text-decoration: none; }

/* ---------- Shell layout ---------- */
.admin-shell {
    display: grid;
    grid-template-columns: 268px 1fr;
    min-height: 100vh;
}

.admin-sidebar {
    background: linear-gradient(180deg, var(--ink-900) 0%, var(--ink-800) 100%);
    color: #d8e8e4;
    padding: 0 0 32px;
    overflow-y: auto;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--brass-500);
    color: var(--ink-900);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    flex-shrink: 0;
}

.brand-text {
    color: #fff;
    font-weight: 600;
    font-size: 15px;
    line-height: 1.3;
}

.sidebar-nav { padding: 16px 12px; }

.nav-section { margin-bottom: 6px; }

.nav-section-title {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(216, 232, 228, 0.45);
    padding: 14px 12px 6px;
    margin: 0;
    font-weight: 600;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: rgba(216, 232, 228, 0.82);
    font-size: 13.6px;
    font-weight: 500;
    position: relative;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-link i { width: 16px; text-align: center; font-size: 13px; opacity: 0.85; }

.nav-link:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }

.nav-link.active {
    background: var(--brass-500);
    color: var(--ink-900);
    font-weight: 600;
}

.nav-link.active i { opacity: 1; }

.nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: 10.5px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 20px;
}

/* ---------- Main area ---------- */
.admin-main { display: flex; flex-direction: column; min-width: 0; }

.admin-topbar {
    height: 64px;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 20;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 18px;
    color: var(--ink-800);
}

.topbar-spacer { flex: 1; }

.topbar-actions { display: flex; align-items: center; gap: 6px; }

.topbar-link {
    width: 38px; height: 38px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-600);
    transition: background 0.15s ease;
}
.topbar-link:hover { background: var(--canvas); color: var(--ink-800); }

.topbar-profile {
    display: flex; align-items: center; gap: 9px;
    background: none; border: none;
    padding: 6px 10px 6px 6px;
    border-radius: 999px;
    margin-left: 6px;
}
.topbar-profile:hover { background: var(--canvas); }
.topbar-profile img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.topbar-profile span { font-weight: 600; font-size: 13.5px; color: var(--text-900); }

.admin-content { padding: 28px 32px 60px; }

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}
.content-header h1 { font-size: 22px; font-weight: 600; margin: 0; }
.breadcrumb-trail { font-size: 12.5px; color: var(--text-600); margin-top: 4px; }

/* ---------- Cards ---------- */
.card-panel {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}
.card-panel-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.card-panel-header h2 { font-size: 16px; margin: 0; font-weight: 600; }
.card-panel-body { padding: 22px; }

/* ---------- Stat cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 14px;
}
.stat-icon {
    width: 46px; height: 46px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    background: rgba(199, 154, 63, 0.12);
    color: var(--brass-600);
    flex-shrink: 0;
}
.stat-card .num { font-size: 22px; font-weight: 700; font-family: 'Poppins', sans-serif; color: var(--ink-900); line-height: 1.1; }
.stat-card .label { font-size: 12.5px; color: var(--text-600); margin-top: 2px; }

/* ---------- Forms ---------- */
.form-label { font-weight: 600; font-size: 13px; color: var(--text-900); margin-bottom: 6px; }
.form-control, .form-select {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    font-size: 13.6px;
}
.form-control:focus, .form-select:focus {
    border-color: var(--brass-500);
    box-shadow: 0 0 0 3px rgba(199, 154, 63, 0.15);
}
.lang-tabs .nav-link { border-radius: var(--radius-sm) var(--radius-sm) 0 0; font-weight: 600; font-size: 13px; }
.field-group { margin-bottom: 18px; }

/* ---------- Buttons ---------- */
.btn-primary {
    background: var(--ink-800);
    border-color: var(--ink-800);
    font-weight: 600;
    font-size: 13.5px;
}
.btn-primary:hover { background: var(--ink-900); border-color: var(--ink-900); }
.btn-brass {
    background: var(--brass-500);
    border-color: var(--brass-500);
    color: var(--ink-900);
    font-weight: 600;
}
.btn-brass:hover { background: var(--brass-600); color: var(--ink-900); }
.btn-soft-primary { background: rgba(23, 82, 77, 0.08); color: var(--ink-700); border: none; }
.btn-soft-primary:hover { background: rgba(23, 82, 77, 0.16); color: var(--ink-800); }
.btn-soft-danger { background: rgba(197, 87, 59, 0.08); color: var(--danger); border: none; }
.btn-soft-danger:hover { background: rgba(197, 87, 59, 0.16); }

/* ---------- Alerts ---------- */
.alert-flash {
    padding: 13px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 13.6px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}
.alert-flash-success { background: rgba(47, 143, 106, 0.1); color: var(--success); border: 1px solid rgba(47, 143, 106, 0.25); }
.alert-flash-error { background: rgba(197, 87, 59, 0.1); color: var(--danger); border: 1px solid rgba(197, 87, 59, 0.25); }

/* ---------- Table ---------- */
table.dataTable { font-size: 13.4px; }
table.dataTable thead th {
    background: var(--canvas);
    color: var(--text-600);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--line) !important;
}
table.dataTable tbody td { vertical-align: middle; padding: 12px 10px; }

/* ---------- Auth pages ---------- */
.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top left, #1a4a44 0%, var(--ink-900) 60%);
    padding: 24px;
}
.auth-card {
    background: var(--paper);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 420px;
    padding: 40px 36px;
}
.auth-brand { text-align: center; margin-bottom: 28px; }
.auth-brand .brand-mark { margin: 0 auto 14px; }

@media (max-width: 992px) {
    .admin-shell { grid-template-columns: 1fr; }
    .admin-sidebar {
        position: fixed; left: 0; top: 0; z-index: 50;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        width: 268px;
    }
    .admin-sidebar.open { transform: translateX(0); }
    .sidebar-toggle { display: block; }
}

/* ── Extra fixes from dashboard audit ── */
.topbar-badge {
    position: absolute;
    top: 4px; right: 4px;
    width: 16px; height: 16px;
    border-radius: 50%;
    background: var(--danger);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
.topbar-link { position: relative; }

.breadcrumb-trail {
    font-size: 12.5px;
    color: var(--text-600);
    margin-top: 4px;
}
.breadcrumb-trail a { color: var(--ink-700); }
.breadcrumb-trail a:hover { color: var(--brass-500); }

/* DataTables fixes */
div.dataTables_wrapper div.dataTables_filter input {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    font-size: 13px;
    margin-left: 6px;
}
div.dataTables_wrapper div.dataTables_filter input:focus {
    border-color: var(--brass-500);
    outline: none;
    box-shadow: 0 0 0 3px rgba(199,154,63,.15);
}
div.dataTables_wrapper div.dataTables_length select {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    font-size: 13px;
}
.dataTables_info { font-size: 12.5px; color: var(--text-600); }
.page-link { color: var(--ink-700); }
.page-item.active .page-link { background: var(--ink-800); border-color: var(--ink-800); }

/* Alert flash improvements */
.alert-flash { animation: slideDown .3s ease; }
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Lang tabs */
.lang-tabs .nav-link { color: var(--text-600); border: 1px solid var(--line); margin-right: 4px; }
.lang-tabs .nav-link.active { background: var(--ink-800); color: #fff; border-color: var(--ink-800); }

/* Sidebar active glow */
.nav-link.active { box-shadow: 0 2px 8px rgba(199,154,63,.25); }

/* Form control focus */
.form-control:focus, .form-select:focus {
    border-color: var(--brass-500);
    box-shadow: 0 0 0 3px rgba(199,154,63,.15);
}

/* Card panel improvements */
.card-panel { border-radius: 12px; overflow: hidden; }
.card-panel-header h2 { color: var(--ink-800); }

/* Mobile sidebar overlay */
@media (max-width: 992px) {
    .admin-sidebar.open ~ .admin-main::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.4);
        z-index: 49;
    }
}
