/* ==========================================================================
   School Management System — Design System
   ========================================================================== */

:root {
    /* Brand */
    --brand-50:  #eef2ff;
    --brand-100: #e0e7ff;
    --brand-200: #c7d2fe;
    --brand-300: #a5b4fc;
    --brand-400: #818cf8;
    --brand-500: #6366f1;
    --brand-600: #4f46e5;
    --brand-700: #4338ca;
    --brand-800: #3730a3;
    --brand-900: #312e81;

    --accent-500: #0d9488;
    --accent-600: #0f766e;

    --success-500: #16a34a;
    --success-100: #dcfce7;
    --warning-500: #d97706;
    --warning-100: #fef3c7;
    --danger-500:  #dc2626;
    --danger-100:  #fee2e2;
    --info-500:    #0284c7;
    --info-100:    #e0f2fe;

    /* Neutrals (slate) */
    --ink-900: #0f172a;
    --ink-800: #1e293b;
    --ink-700: #334155;
    --ink-600: #475569;
    --ink-500: #64748b;
    --ink-400: #94a3b8;
    --ink-300: #cbd5e1;
    --ink-200: #e2e8f0;
    --ink-100: #f1f5f9;
    --ink-50:  #f8fafc;

    --radius-sm: .5rem;
    --radius: .75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;

    --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, .04);
    --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, .07), 0 1px 2px -1px rgba(15, 23, 42, .06);
    --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, .08), 0 2px 6px -2px rgba(15, 23, 42, .05);
    --shadow-lg: 0 12px 28px -8px rgba(15, 23, 42, .14), 0 4px 10px -4px rgba(15, 23, 42, .06);

    /* Bootstrap overrides */
    --bs-primary: var(--brand-600);
    --bs-primary-rgb: 79, 70, 229;
    --bs-link-color: var(--brand-600);
    --bs-link-hover-color: var(--brand-700);
    --bs-body-font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --bs-body-color: var(--ink-700);
    --bs-body-bg: var(--ink-100);
    --bs-border-radius: var(--radius-sm);
    --bs-border-radius-lg: var(--radius);
    --bs-border-color: var(--ink-200);
}

* { -webkit-font-smoothing: antialiased; }

body {
    background: var(--ink-100);
    color: var(--ink-700);
    letter-spacing: -.01em;
}

h1, h2, h3, h4, h5, h6, .fw-bold, .fw-semibold {
    color: var(--ink-900);
    letter-spacing: -.02em;
}

a { text-decoration: none; }

/* Buttons */
.btn {
    font-weight: 600;
    border-radius: var(--radius-sm);
    padding: .55rem 1.1rem;
    transition: all .15s ease;
    letter-spacing: -.01em;
}
.btn-sm { padding: .35rem .75rem; }
.btn-primary {
    background: linear-gradient(180deg, var(--brand-600), var(--brand-700));
    border-color: var(--brand-700);
    box-shadow: 0 1px 2px rgba(79, 70, 229, .3), inset 0 1px 0 rgba(255,255,255,.12);
}
.btn-primary:hover, .btn-primary:focus {
    background: linear-gradient(180deg, var(--brand-500), var(--brand-600));
    border-color: var(--brand-700);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}
.btn-outline-primary { color: var(--brand-600); border-color: var(--brand-300); }
.btn-outline-primary:hover { background: var(--brand-600); border-color: var(--brand-600); }
.btn-outline-secondary { color: var(--ink-600); border-color: var(--ink-300); }
.btn-outline-secondary:hover { background: var(--ink-700); border-color: var(--ink-700); }
.btn-outline-danger { color: var(--danger-500); border-color: #fecaca; }
.btn-outline-danger:hover { background: var(--danger-500); border-color: var(--danger-500); }
.btn-light { background: #fff; border-color: var(--ink-200); box-shadow: var(--shadow-xs); }
.btn-light:hover { background: var(--ink-50); transform: translateY(-1px); }

/* Forms */
.form-control, .form-select {
    border-color: var(--ink-200);
    border-radius: var(--radius-sm);
    padding: .55rem .85rem;
    font-size: .925rem;
}
.form-control:focus, .form-select:focus {
    border-color: var(--brand-400);
    box-shadow: 0 0 0 .2rem rgba(79, 70, 229, .12);
}
.form-label { font-weight: 600; font-size: .825rem; color: var(--ink-700); margin-bottom: .35rem; }

/* Cards */
.card { border: 1px solid var(--ink-200); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }

/* Badges */
.badge { font-weight: 600; letter-spacing: .01em; border-radius: 999px; padding: .35em .75em; }

/* Alerts */
.alert { border: none; border-radius: var(--radius); box-shadow: var(--shadow-xs); }
.alert-success { background: var(--success-100); color: #14532d; }
.alert-danger { background: var(--danger-100); color: #7f1d1d; }

/* Tables */
.table { --bs-table-hover-bg: var(--ink-50); }
.table thead th {
    background: var(--ink-50);
    color: var(--ink-500);
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    font-weight: 700;
    border-bottom: 1px solid var(--ink-200);
    padding: .85rem 1rem;
}
.table td { padding: .85rem 1rem; vertical-align: middle; border-color: var(--ink-100); }

/* Pagination */
.pagination .page-link { border-color: var(--ink-200); color: var(--ink-600); border-radius: var(--radius-sm); margin: 0 .15rem; }
.pagination .page-item.active .page-link { background: var(--brand-600); border-color: var(--brand-600); }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--ink-300); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-400); }

/* ==========================================================================
   Portal shell (sidebar + topbar)
   ========================================================================== */

.app-shell { min-height: 100vh; }

.app-sidebar {
    width: 268px;
    background: linear-gradient(195deg, var(--ink-900), #1a1f38 65%);
    color: var(--ink-300);
    padding: 1.35rem 1rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    flex-shrink: 0;
}
.app-sidebar::-webkit-scrollbar { width: 6px; }
.app-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); }

.app-brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    color: #fff;
    font-weight: 700;
    font-size: 1.05rem;
    padding: .4rem .5rem 1.1rem;
    letter-spacing: -.02em;
}
.app-brand .app-brand-icon {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(145deg, var(--brand-400), var(--brand-600));
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    font-size: 1.05rem;
    flex-shrink: 0;
}

.nav-section-label {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 700;
    color: rgba(203, 213, 225, .45);
    padding: 1rem .75rem .35rem;
}

.app-sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: .65rem;
    color: rgba(226, 232, 240, .78);
    font-size: .875rem;
    font-weight: 500;
    padding: .55rem .75rem;
    border-radius: var(--radius-sm);
    margin-bottom: .1rem;
    transition: all .12s ease;
}
.app-sidebar .nav-link i { font-size: 1.05rem; width: 20px; text-align: center; opacity: .85; }
.app-sidebar .nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.app-sidebar .nav-link.active {
    background: linear-gradient(180deg, var(--brand-500), var(--brand-600));
    color: #fff;
    box-shadow: var(--shadow-sm);
}
.app-sidebar .nav-link.active i { opacity: 1; }

.app-topbar {
    background: rgba(255,255,255,.85);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--ink-200);
    padding: .85rem 1.75rem;
    position: sticky;
    top: 0;
    z-index: 20;
}
.app-topbar .page-title { font-weight: 700; font-size: 1.05rem; color: var(--ink-900); }

.user-chip {
    display: flex; align-items: center; gap: .6rem;
    padding: .3rem .5rem;
    border-radius: 999px;
}
.user-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: linear-gradient(145deg, var(--brand-400), var(--brand-700));
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .85rem; flex-shrink: 0;
}

.app-main { padding: 1.75rem; max-width: 1400px; }

/* Stat cards */
.stat-card {
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.4rem;
    border: 1px solid var(--ink-200);
    box-shadow: var(--shadow-sm);
    background: #fff;
    position: relative;
    overflow: hidden;
    transition: transform .15s ease, box-shadow .15s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon {
    width: 44px; height: 44px;
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
    margin-bottom: .75rem;
}
.stat-icon.bg-brand { background: var(--brand-100); color: var(--brand-600); }
.stat-icon.bg-success { background: var(--success-100); color: var(--success-500); }
.stat-icon.bg-warning { background: var(--warning-100); color: var(--warning-500); }
.stat-icon.bg-danger { background: var(--danger-100); color: var(--danger-500); }
.stat-icon.bg-info { background: var(--info-100); color: var(--info-500); }
.stat-label { font-size: .8rem; color: var(--ink-500); font-weight: 600; }
.stat-value { font-size: 1.65rem; font-weight: 800; color: var(--ink-900); line-height: 1.2; }
.stat-trend { font-size: .78rem; font-weight: 600; }

.section-card {
    background: #fff;
    border: 1px solid var(--ink-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.4rem;
}
.section-card-title {
    font-weight: 700;
    font-size: .95rem;
    color: var(--ink-900);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.list-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: .7rem 0;
    border-bottom: 1px solid var(--ink-100);
}
.list-row:last-child { border-bottom: none; }

.avatar-sm {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--brand-100); color: var(--brand-700);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .75rem;
}

.empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--ink-400);
}
.empty-state i { font-size: 2rem; opacity: .5; margin-bottom: .5rem; display: block; }

/* ==========================================================================
   Auth
   ========================================================================== */

.auth-page {
    min-height: 100vh;
    display: flex;
}
.auth-side {
    flex: 1.1;
    background: radial-gradient(circle at 20% 20%, rgba(255,255,255,.08), transparent 40%),
                linear-gradient(160deg, var(--brand-700), var(--ink-900) 70%);
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 3rem;
    position: relative;
    overflow: hidden;
}
.auth-side::before {
    content: '';
    position: absolute;
    width: 420px; height: 420px;
    border-radius: 50%;
    background: rgba(255,255,255,.05);
    top: -120px; right: -140px;
}
.auth-side::after {
    content: '';
    position: absolute;
    width: 280px; height: 280px;
    border-radius: 50%;
    background: rgba(255,255,255,.05);
    bottom: -80px; left: -80px;
}
.auth-form-side {
    flex: 1;
    display: flex; align-items: center; justify-content: center;
    padding: 2rem;
    background: #fff;
}
.auth-card { width: 100%; max-width: 400px; }

/* ==========================================================================
   Public website
   ========================================================================== */

.public-nav {
    background: rgba(255,255,255,.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--ink-200);
    position: sticky; top: 0; z-index: 30;
}
.public-nav .navbar-brand { font-weight: 800; color: var(--ink-900); }
.public-nav .nav-link { font-weight: 600; color: var(--ink-600) !important; font-size: .9rem; }
.public-nav .nav-link:hover { color: var(--brand-600) !important; }

.hero {
    background:
        radial-gradient(circle at 15% 25%, rgba(255,255,255,.10), transparent 45%),
        radial-gradient(circle at 85% 75%, rgba(255,255,255,.08), transparent 40%),
        linear-gradient(135deg, var(--brand-700), var(--ink-900) 80%);
    color: #fff;
    padding: 5.5rem 0 6rem;
    position: relative;
}
.hero .eyebrow {
    text-transform: uppercase; letter-spacing: .12em; font-size: .78rem;
    font-weight: 700; color: var(--brand-200);
}
.hero h1 { font-weight: 800; letter-spacing: -.03em; color: #fff; }
.hero p.lead { color: rgba(255,255,255,.82); }

.section-heading .eyebrow {
    text-transform: uppercase; letter-spacing: .1em; font-size: .75rem;
    font-weight: 700; color: var(--brand-600);
}
.section-heading h2 { font-weight: 800; letter-spacing: -.02em; color: var(--ink-900); }

.card-post {
    border: 1px solid var(--ink-200);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-lg);
    transition: transform .18s ease, box-shadow .18s ease;
    overflow: hidden;
}
.card-post:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.card-post .card-post-media {
    height: 150px;
    background: linear-gradient(135deg, var(--brand-100), var(--brand-50));
    display: flex; align-items: center; justify-content: center;
    color: var(--brand-400); font-size: 2.2rem;
}

.badge-soft-brand { background: var(--brand-100); color: var(--brand-700); }
.badge-soft-success { background: var(--success-100); color: #166534; }
.badge-soft-warning { background: var(--warning-100); color: #92400e; }
.badge-soft-danger { background: var(--danger-100); color: #991b1b; }
.badge-soft-info { background: var(--info-100); color: #075985; }
.badge-soft-secondary { background: var(--ink-100); color: var(--ink-600); }

.cta-band {
    background: linear-gradient(120deg, var(--brand-600), var(--accent-600));
    border-radius: var(--radius-xl);
    color: #fff;
    padding: 3rem;
}

.site-footer { background: var(--ink-900); color: var(--ink-400); }
.site-footer a { color: var(--ink-300); }
.site-footer a:hover { color: #fff; }
.site-footer h5, .site-footer h6 { color: #fff; }
.footer-brand { display: flex; align-items: center; gap: .55rem; color: #fff; font-weight: 700; font-size: 1.1rem; }
.site-footer .btn-outline-secondary {
    width: 36px; height: 36px; padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border-color: rgba(255,255,255,.15); color: var(--ink-300);
}
.site-footer .btn-outline-secondary:hover { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }

/* Modal polish */
.modal-content { border: none; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.modal-header { border-bottom: 1px solid var(--ink-100); padding: 1.1rem 1.4rem; }
.modal-body { padding: 1.4rem; }
.modal-footer { border-top: 1px solid var(--ink-100); padding: 1rem 1.4rem; }

/* Utility */
.text-muted-soft { color: var(--ink-500) !important; }
.rounded-xl { border-radius: var(--radius-lg) !important; }

@media (max-width: 991.98px) {
    .app-sidebar { position: fixed; left: 0; z-index: 40; transform: translateX(-100%); transition: transform .2s ease; }
    .app-sidebar.show { transform: translateX(0); }
    .auth-side { display: none; }
}
