/* ============================================================================
   FOUNDATION ADICLASSES — GLOBAL DESIGN SYSTEM
   app/static/css/main.css

   This file is the single source of truth for color, type, radius, shadow,
   and spacing. Every other stylesheet (auth.css, dashboard.css, slides.css,
   omr.css, analysis.css, admin.css, users.css) consumes these custom
   properties instead of hardcoding values. Brand: orange + blue, Verdana-led
   body font, Poppins for display/headings (close cousin of the site's
   rounded-geometric display face, freely available on Google Fonts).
============================================================================ */

:root {
    /* ---- Brand palette (orange / blue mix, matches adiclasses.com) ---- */
    --blue: #0d6efd;
    --blue-dark: #0a4fb5;
    --blue-deep: #062f6e;
    --blue-light: #e8f1ff;
    --blue-mid: #cfe2ff;

    --orange: #ff6600;
    --orange-dark: #e05a00;
    --orange-light: #fff2e8;
    --orange-mid: #ffd9b8;

    --primary: var(--blue);
    --primary-dark: var(--blue-dark);
    --primary-light: var(--blue-light);
    --accent: var(--orange);
    --accent-dark: var(--orange-dark);

    /* ---- Semantic colors ---- */
    --success: #16a34a;
    --success-light: #e8f8ee;
    --warning: #d97706;
    --warning-light: #fef3e2;
    --danger: #dc2626;
    --danger-light: #fdecec;
    --info: #0891b2;
    --info-light: #e6f7fa;

    /* ---- Neutral surface scale ---- */
    --bg-app: #f4f7fb;
    --bg-surface: #ffffff;
    --bg-surface-alt: #f8fafc;
    --border-color: #e2e8f0;

    --text-primary: #1a2332;
    --text-secondary: #55637a;
    --text-muted: #94a3b8;

    /* ---- Geometry ---- */
    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 20px;
    --radius-pill: 50px;

    --shadow-sm: 0 2px 8px rgba(13, 45, 96, 0.06);
    --shadow: 0 6px 20px rgba(13, 45, 96, 0.10);
    --shadow-lg: 0 16px 40px rgba(13, 45, 96, 0.16);
    --shadow-orange: 0 6px 18px rgba(255, 102, 0, 0.22);
    --shadow-blue: 0 6px 18px rgba(13, 110, 253, 0.22);

    /* ---- Type ---- */
    --font-body: Verdana, Geneva, "Segoe UI", Arial, sans-serif;
    --font-display: "Poppins", Verdana, sans-serif;

    /* ---- Layout ---- */
    --navbar-height: 68px;
    --toolbar-height: 54px;
    --sidebar-width: 268px;
    --footer-whatsapp-size: 58px;

    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-bs-theme="dark"] {
    --bg-app: #0c1424;
    --bg-surface: #16213a;
    --bg-surface-alt: #101a2e;
    --border-color: #263450;
    --text-primary: #eef2f9;
    --text-secondary: #b7c2d6;
    --text-muted: #7c8aa8;
    --blue-light: #142a4d;
    --blue-mid: #1c3868;
    --orange-light: #2e2013;
}

/* ---------------------------------------------------------------------- */
/* Reset & base                                                            */
/* ---------------------------------------------------------------------- */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background: var(--bg-app);
    color: var(--text-primary);
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 15px;
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    color: var(--text-primary);
}

a { text-decoration: none; color: var(--blue); }
a:hover { color: var(--blue-dark); }

button { font-family: var(--font-body); cursor: pointer; }

code {
    background: rgba(0, 0, 0, 0.05);
    padding: 0.15em 0.45em;
    border-radius: var(--radius-sm);
    color: var(--blue-dark);
}

.skip-link {
    position: absolute; top: -40px; left: 0;
    background: var(--blue); color: #fff;
    padding: 0.5rem 1rem; z-index: 2000; border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { top: 0; }

/* ---------------------------------------------------------------------- */
/* Layout shells                                                           */
/* ---------------------------------------------------------------------- */
.main-content {
    flex: 1;
    padding-top: calc(var(--navbar-height) + 1.25rem);
    padding-bottom: 2.5rem;
    min-height: 100vh;
}

.auth-page-content {
    flex: 1;
    display: flex;
    min-height: 100vh;
}

@media (max-width: 768px) {
    .main-content { padding-top: calc(var(--navbar-height) + 0.75rem); }
}

/* ---------------------------------------------------------------------- */
/* Navbar                                                                  */
/* ---------------------------------------------------------------------- */
.app-navbar {
    background: linear-gradient(120deg, var(--blue-deep) 0%, var(--blue) 100%);
    height: var(--navbar-height);
    box-shadow: var(--shadow);
    padding: 0 0.5rem;
}

.brand-logo-img { height: 38px; width: auto; display: block; }

.brand-text {
    color: #fff;
    font-weight: 700;
    font-size: 1.05rem;
    font-family: var(--font-display);
    letter-spacing: 0.2px;
}
.brand-text span { color: var(--orange-mid); }

.app-navbar .nav-link {
    color: rgba(255, 255, 255, 0.88) !important;
    font-weight: 500;
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.85rem !important;
    transition: var(--transition);
}
.app-navbar .nav-link:hover,
.app-navbar .nav-link.active {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.14);
}
.app-navbar .nav-link.admin-link { color: var(--orange-mid) !important; }

.app-navbar .dropdown-menu {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 0.5rem;
    margin-top: 0.5rem;
}
.app-navbar .dropdown-item {
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.85rem;
    font-size: 0.9rem;
}
.app-navbar .dropdown-item:hover { background: var(--blue-light); color: var(--blue-dark); }
.app-navbar .dropdown-item.text-danger:hover { background: var(--danger-light); }

.navbar-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: linear-gradient(135deg, var(--orange), var(--blue));
    color: #fff; font-weight: 700;
    display: flex; align-items: center; justify-content: center; font-size: 0.9rem;
    flex-shrink: 0;
}
.notification-badge {
    position: absolute; top: 2px; right: 2px;
    font-size: 0.6rem; padding: 0.2rem 0.4rem; border-radius: 10px;
}
.notification-dropdown { width: 340px; max-height: 420px; overflow-y: auto; }
.notification-list { max-height: 300px; overflow-y: auto; }
.notification-item { white-space: normal; }
.notification-item.unread { background: var(--blue-light); }

/* ---------------------------------------------------------------------- */
/* Footer (dashboard side) + WhatsApp float                                */
/* ---------------------------------------------------------------------- */
.app-footer {
    background: linear-gradient(135deg, #0d1f3a, #133566);
    color: rgba(255, 255, 255, 0.85);
    padding: 2.25rem 1.5rem 1.25rem;
    margin-top: 2rem;
}
.app-footer a { color: rgba(255, 255, 255, 0.75); }
.app-footer a:hover { color: #fff; }
.app-footer h4, .app-footer h6 { color: #fff; }
.app-footer .footer-brand-mark { color: var(--orange-mid); }
.app-footer .footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    margin-top: 1.5rem; padding-top: 1.25rem;
    font-size: 0.82rem; color: rgba(255, 255, 255, 0.55);
}
.app-footer .social-row a {
    width: 34px; height: 34px; border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: inline-flex; align-items: center; justify-content: center;
    margin-right: 0.5rem; transition: var(--transition);
}
.app-footer .social-row a:hover { background: var(--orange); transform: translateY(-2px); }

.whatsapp-float {
    position: fixed;
    bottom: 1.75rem;
    right: 1.75rem;
    width: var(--footer-whatsapp-size);
    height: var(--footer-whatsapp-size);
    border-radius: 50%;
    background: #25d366;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 8px 20px rgba(37, 211, 102, 0.4);
    z-index: 950;
    transition: var(--transition);
    color: #fff; font-size: 1.6rem;
}
.whatsapp-float:hover { transform: scale(1.08); color: #fff; }

.scroll-to-top {
    position: fixed;
    bottom: 1.75rem;
    left: 1.75rem;
    width: 46px; height: 46px;
    background: var(--blue);
    color: #fff; border: none; border-radius: 50%;
    font-size: 1.2rem; font-weight: 700;
    box-shadow: var(--shadow-blue);
    opacity: 0; visibility: hidden;
    transition: var(--transition);
    z-index: 900;
}
.scroll-to-top.visible { opacity: 1; visibility: visible; }
.scroll-to-top:hover { background: var(--blue-dark); transform: translateY(-3px); }

/* ---------------------------------------------------------------------- */
/* Cards, sections, headers                                                */
/* ---------------------------------------------------------------------- */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}
.card-header {
    background: var(--bg-surface-alt);
    border-bottom: 1px solid var(--border-color);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
    font-family: var(--font-display);
}
.card.shadow-hover { transition: var(--transition); }
.card.shadow-hover:hover { box-shadow: var(--shadow-lg); transform: translateY(-3px); }

.page-header { margin-bottom: 1.5rem; }
.page-title {
    font-weight: 700; font-size: 1.6rem;
    display: flex; align-items: center; gap: 0.6rem;
}
.page-title i { color: var(--orange); }
.section-label {
    font-size: 0.78rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--text-secondary); margin-bottom: 0.75rem;
}

.hero-banner {
    background: linear-gradient(135deg, var(--blue) 0%, var(--blue-deep) 100%);
    border-radius: var(--radius-lg);
    padding: 2.25rem 2.5rem;
    color: #fff;
    box-shadow: var(--shadow-blue);
    position: relative;
    overflow: hidden;
}
.hero-banner::before {
    content: ""; position: absolute; top: -60px; right: -60px;
    width: 220px; height: 220px; background: rgba(255, 255, 255, 0.08); border-radius: 50%;
}
.hero-banner::after {
    content: ""; position: absolute; bottom: -50px; left: 25%;
    width: 180px; height: 180px; background: rgba(255, 102, 0, 0.16); border-radius: 50%;
}
.hero-banner h1, .hero-banner h2 { color: #fff; font-family: var(--font-display); font-weight: 800; }
.hero-banner p { opacity: 0.92; }

/* ---------------------------------------------------------------------- */
/* Buttons                                                                 */
/* ---------------------------------------------------------------------- */
.btn { border-radius: var(--radius-sm); font-weight: 600; font-family: var(--font-body); }

.btn-primary { background: var(--blue); border-color: var(--blue); }
.btn-primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }

.btn-accent, .btn-orange {
    background: var(--orange); border-color: var(--orange); color: #fff;
}
.btn-accent:hover, .btn-orange:hover {
    background: var(--orange-dark); border-color: var(--orange-dark); color: #fff;
}

.btn-outline-primary { color: var(--blue); border-color: var(--blue); }
.btn-outline-primary:hover { background: var(--blue); border-color: var(--blue); }

/* ---------------------------------------------------------------------- */
/* Badges, stat chips, tooltips                                            */
/* ---------------------------------------------------------------------- */
.badge-soft-primary { background: var(--blue-light); color: var(--blue-dark); }
.badge-soft-success { background: var(--success-light); color: var(--success); }
.badge-soft-warning { background: var(--warning-light); color: var(--warning); }
.badge-soft-danger  { background: var(--danger-light); color: var(--danger); }
.badge-soft-info    { background: var(--info-light); color: var(--info); }
.badge-soft-orange  { background: var(--orange-light); color: var(--orange-dark); }
.badge-soft-secondary { background: rgba(100, 116, 139, 0.12); color: #475569; }

.stat-chip {
    display: flex; align-items: center; gap: 0.875rem;
    background: var(--bg-surface); border: 1px solid var(--border-color);
    border-radius: var(--radius); padding: 0.9rem 1.25rem;
}
.stat-chip-icon {
    width: 46px; height: 46px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; flex-shrink: 0;
}
.stat-chip-data strong { display: block; font-size: 1.4rem; font-weight: 800; font-family: var(--font-display); }
.stat-chip-data span { font-size: 0.78rem; color: var(--text-secondary); }

.tooltip-inner {
    background: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.7rem;
}

/* ---------------------------------------------------------------------- */
/* Sidebar (shared shape — left admin/content sidebar OR right util rail)  */
/* ---------------------------------------------------------------------- */
.app-sidebar {
    width: var(--sidebar-width);
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    position: sticky;
    top: var(--navbar-height);
    height: calc(100vh - var(--navbar-height));
    overflow-y: auto;
    flex-shrink: 0;
    z-index: 100;
    transition: var(--transition-slow);
}
.app-sidebar.sidebar-right { border-right: none; border-left: 1px solid var(--border-color); }
.app-sidebar::-webkit-scrollbar { width: 5px; }
.app-sidebar::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }

.sidebar-section { padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--border-color); }
.sidebar-section:last-child { border-bottom: none; }
.sidebar-title {
    font-size: 0.7rem; font-weight: 700; color: var(--text-muted);
    letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 0.75rem;
}

@media (max-width: 992px) {
    .app-sidebar {
        position: fixed; left: calc(-1 * var(--sidebar-width)); top: 0;
        height: 100vh; z-index: 1040; box-shadow: 4px 0 24px rgba(0, 0, 0, 0.16);
    }
    .app-sidebar.active { left: 0; }
    .app-sidebar.sidebar-right { left: auto; right: calc(-1 * var(--sidebar-width)); }
    .app-sidebar.sidebar-right.active { right: 0; }
}

/* ---------------------------------------------------------------------- */
/* Sticky sub-toolbar (grade/subject pickers, filters)                     */
/* ---------------------------------------------------------------------- */
.sticky-toolbar {
    position: sticky; top: var(--navbar-height);
    background: var(--bg-surface);
    border-bottom: 2px solid var(--blue-mid);
    z-index: 999;
    box-shadow: 0 3px 12px rgba(13, 110, 253, 0.08);
}
.sticky-toolbar .toolbar-inner {
    padding: 0.65rem 1.25rem; display: flex; align-items: center; gap: 1rem;
    min-height: var(--toolbar-height); overflow-x: auto;
}
.toolbar-pill {
    background: var(--bg-app); border: 2px solid var(--border-color);
    color: var(--text-primary); padding: 0.3rem 0.85rem;
    border-radius: var(--radius-pill); font-weight: 700; font-size: 0.82rem;
    white-space: nowrap; transition: var(--transition);
}
.toolbar-pill:hover { border-color: var(--blue); color: var(--blue); transform: translateY(-2px); }
.toolbar-pill.active {
    background: linear-gradient(135deg, var(--blue), var(--blue-dark));
    color: #fff; border-color: transparent; box-shadow: var(--shadow-blue);
}

/* ---------------------------------------------------------------------- */
/* Modals                                                                   */
/* ---------------------------------------------------------------------- */
.modal-content { border: none; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.modal-header { border-bottom: 1px solid var(--border-color); }
.modal-header .modal-title { font-family: var(--font-display); font-weight: 700; }
.modal-footer { border-top: 1px solid var(--border-color); }

/* ---------------------------------------------------------------------- */
/* File drop area (shared across upload pages)                             */
/* ---------------------------------------------------------------------- */
.file-drop-area {
    position: relative; border: 2px dashed var(--border-color);
    border-radius: var(--radius); padding: 2rem 1rem; text-align: center;
    cursor: pointer; transition: var(--transition); color: var(--text-secondary);
}
.file-drop-area:hover, .file-drop-area.drag-over {
    border-color: var(--blue); background: var(--blue-light); color: var(--blue-dark);
}
.file-drop-area input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ---------------------------------------------------------------------- */
/* Loading overlay + toasts + flash                                        */
/* ---------------------------------------------------------------------- */
.loading-overlay {
    position: fixed; inset: 0; z-index: 9999; background: var(--bg-app);
    display: flex; align-items: center; justify-content: center;
    transition: opacity 0.4s ease;
}
.loading-overlay.fade-out { opacity: 0; pointer-events: none; }
.spinner-ring {
    width: 48px; height: 48px; border: 4px solid var(--border-color);
    border-top-color: var(--orange); border-radius: 50%; animation: spin 0.8s linear infinite;
}
.loading-text { margin-top: 1rem; color: var(--text-secondary); text-align: center; }
@keyframes spin { to { transform: rotate(360deg); } }

.flash-messages-container .alert {
    position: relative; overflow: hidden; border-radius: var(--radius);
    border: none; box-shadow: var(--shadow-sm);
}
.toast-progress-bar {
    position: absolute; bottom: 0; left: 0; height: 3px;
    background: rgba(0, 0, 0, 0.15); animation: toast-shrink 5s linear forwards;
}
@keyframes toast-shrink { from { width: 100%; } to { width: 0%; } }

.toast-notification-custom {
    background: linear-gradient(135deg, #1e293b, #334155);
    color: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg);
}

/* ---------------------------------------------------------------------- */
/* Utility                                                                  */
/* ---------------------------------------------------------------------- */
.text-soft { color: var(--text-secondary); }
.text-brand-orange { color: var(--orange); }
.text-brand-blue { color: var(--blue); }
.cursor-pointer { cursor: pointer; }
.empty-state i { opacity: 0.45; }
.empty-state { padding: 2.5rem 1rem; text-align: center; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }

.error-page-wrapper {
    display: flex; align-items: center; justify-content: center;
    min-height: 70vh; padding: 2rem;
}
.error-page-content { max-width: 480px; text-align: center; }
.error-code {
    font-size: 5rem; font-weight: 800; color: var(--blue);
    font-family: var(--font-display); line-height: 1; margin-bottom: 0.5rem;
}

.flash-container {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    width: 500px;
    z-index: 9999;
}