/* =======================================================================
   ADIS PORTAL — Design System
   "Ashwamedh's Dream" — a horse loosed toward the horizon, unbounded reach.
   The recurring signature is the horizon-line: a thin amber-to-transparent
   rule marking the edge of every section, a small echo of the school's name.
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@500;600&display=swap');

:root {
    /* -- Color: ink/dusk base, cool cloud surface, amber horizon accent -- */
    --ink: #101A33;
    --ink-soft: #3A4664;
    --ink-faint: #8891A8;
    --cloud: #F3F5FA;
    --cloud-dim: #E8EBF3;
    --paper: #FFFFFF;
    --line: #E1E5F0;

    --amber: #D9822B;
    --amber-deep: #B8691C;
    --amber-wash: #FBEEDD;

    --teal: #256B58;
    --teal-wash: #E4F2EE;
    --clay: #B94A3D;
    --clay-wash: #FBEAE7;

    /* Bootstrap variable overrides so existing .btn-primary / .text-primary /
       .bg-success / .progress-bar etc. inherit the ADIS palette everywhere,
       including markup generated dynamically by script.js */
    --bs-primary: var(--ink);
    --bs-primary-rgb: 16, 26, 51;
    --bs-success: var(--teal);
    --bs-success-rgb: 37, 107, 88;
    --bs-danger: var(--clay);
    --bs-danger-rgb: 185, 74, 61;
    --bs-warning: var(--amber);
    --bs-warning-rgb: 217, 130, 43;
    --bs-body-color: var(--ink);
    --bs-body-bg: var(--cloud);
    --bs-border-radius: 12px;
    --bs-border-radius-sm: 8px;
    --bs-border-radius-lg: 16px;
    --bs-link-color: var(--amber-deep);

    /* Legacy variable names already referenced elsewhere in the app */
    --primary-blue: var(--ink);
    --dark-blue: var(--ink);
    --light-bg: var(--cloud);
    --success-green: var(--teal);
    --danger-red: var(--clay);
    --card-shadow: 0 6px 20px rgba(16, 26, 51, 0.08);

    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
}

* { -webkit-tap-highlight-color: transparent; }

html, body {
    background-color: var(--cloud);
    color: var(--ink);
    font-family: var(--font-body);
    overflow-x: hidden;
    touch-action: pan-y;
}

h1, h2, h3, h4, h5, h6, .fw-bold {
    font-family: var(--font-display);
    letter-spacing: -0.01em;
}

/* The signature element: a horizon rule. Used sparingly — under section
   titles and behind the login card — never as generic decoration. */
.horizon-rule {
    height: 3px;
    width: 56px;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--amber) 0%, transparent 100%);
    margin: 6px 0 18px;
}

section h3.fw-bold, .content-area > .section-panel > h3.fw-bold {
    position: relative;
    padding-bottom: 14px;
}
.section-panel > h3.fw-bold::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    width: 56px;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--amber) 0%, transparent 100%);
}

/* ---------------------------------------------------------------------
   Splash & Maintenance
   --------------------------------------------------------------------- */
#splash-screen {
    position: fixed; inset: 0;
    background: radial-gradient(120% 120% at 50% 0%, #1B2A4D 0%, var(--ink) 60%);
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    z-index: 9999; color: white; transition: opacity 0.5s ease-out;
}
#splash-screen h3 { font-family: var(--font-display); font-weight: 600; margin-top: 4px; }
#splash-screen p { color: rgba(255,255,255,0.6); font-family: var(--font-body); font-size: 0.85rem; }

.loader {
    border: 3px solid rgba(16,26,51,0.1);
    border-top: 3px solid var(--amber);
    border-radius: 50%;
    width: 36px; height: 36px;
    animation: spin 0.9s linear infinite;
    margin-bottom: 18px;
}
#splash-screen .loader { border-color: rgba(255,255,255,0.15); border-top-color: var(--amber); }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

#maintenance-screen { background: var(--paper); }
#maintenance-screen i { color: var(--amber); }

/* ---------------------------------------------------------------------
   Login
   --------------------------------------------------------------------- */
#login-page {
    height: 100vh; display: flex; align-items: center; justify-content: center;
    background:
        radial-gradient(80% 60% at 50% 0%, rgba(217,130,43,0.25) 0%, transparent 60%),
        linear-gradient(180deg, #0B1428 0%, #101A33 55%, #16223F 100%);
    padding: 20px; position: relative; overflow: hidden;
}
#login-page::before {
    content: "";
    position: absolute; left: 0; right: 0; bottom: 0;
    height: 40%;
    background: linear-gradient(180deg, transparent 0%, rgba(217,130,43,0.08) 100%);
    pointer-events: none;
}
/* the horizon, literally, behind the login card */
#login-page::after {
    content: "";
    position: absolute; left: 0; right: 0; top: 38%;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, rgba(217,130,43,0.55) 50%, transparent 100%);
    z-index: 1;
}

.login-card {
    background: var(--paper);
    padding: 44px 36px 32px;
    border-radius: 20px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.35);
    width: 100%; max-width: 400px;
    text-align: center; position: relative; z-index: 2;
}
.login-mark {
    width: 60px; height: 60px; margin: 0 auto;
    border-radius: 50%;
    background: linear-gradient(150deg, var(--ink) 0%, #1B2A4D 100%);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 8px 20px rgba(16,26,51,0.25);
}
.login-mark i { color: var(--amber); font-size: 1.4rem; }
.login-card .school-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--ink);
    margin-top: 14px;
    letter-spacing: 0.01em;
}
.subtitle { color: var(--amber-deep); font-size: 0.85rem; margin: 2px 0 0; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.tagline { font-size: 0.82rem; color: var(--ink-faint); margin: 10px 0 26px; font-family: var(--font-body); }

.input-group { position: relative; margin-bottom: 14px; text-align: left; }
.input-group i.left-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--ink-faint); font-size: 0.9rem; }
.input-group input {
    width: 100%; padding: 13px 15px 13px 44px;
    border: 1.5px solid var(--line); border-radius: 12px;
    font-size: 0.95rem; transition: 0.2s; box-sizing: border-box;
    background: var(--cloud);
}
.input-group input:focus {
    outline: none; border-color: var(--amber); background: var(--paper);
    box-shadow: 0 0 0 3px var(--amber-wash);
}
#togglePass { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); cursor: pointer; color: var(--ink-faint); z-index: 5; }
.creator-tag { position: absolute; bottom: 22px; left: 0; right: 0; text-align: center; color: rgba(255,255,255,0.45); z-index: 2; font-size: 0.78rem; }

#loginBtn.btn-primary {
    background: var(--ink); border: none; border-radius: 12px;
    letter-spacing: 0.04em; font-size: 0.85rem;
    transition: transform 0.15s ease, background 0.15s ease;
}
#loginBtn.btn-primary:hover { background: var(--amber-deep); transform: translateY(-1px); }
#loginBtn.btn-primary:active { transform: translateY(0); }

/* ---------------------------------------------------------------------
   App shell — top bar, sidebar, bottom nav
   --------------------------------------------------------------------- */
#main-app { display: none; }

.top-bar {
    background: var(--paper); padding: 14px 18px; border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 1000;
    display: flex; align-items: center; justify-content: space-between;
}
.top-bar h6#header-title { font-family: var(--font-display); font-weight: 600; font-size: 1.02rem; margin: 0; }
.menu-icon { color: var(--ink); transition: transform 0.3s ease; display: inline-block; cursor: pointer; }

#global-search.form-control {
    border-radius: 20px; border: 1.5px solid var(--line); background: var(--cloud);
}

.sidebar {
    position: fixed; left: -320px; top: 0; height: 100vh; width: 280px;
    background: var(--paper); color: var(--ink);
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2000; padding: 20px; overflow-y: auto;
    box-shadow: 4px 0 24px rgba(16,26,51,0.12);
}
.sidebar.active { left: 0; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(16,26,51,0.45); z-index: 1500; backdrop-filter: blur(2px); }
.sidebar-overlay.active { display: block; }

.profile-section {
    background: linear-gradient(165deg, var(--ink) 0%, #1B2A4D 100%);
    color: white; padding: 22px 18px; border-radius: 16px; margin-bottom: 22px; text-align: center;
    position: relative; overflow: hidden;
}
.profile-section::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
    background: linear-gradient(90deg, var(--amber) 0%, transparent 90%);
}
.profile-img-container { position: relative; width: 76px; height: 76px; margin: 0 auto 12px; }
.profile-img {
    width: 100%; height: 100%; background: rgba(255,255,255,0.12);
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 1.8rem; color: var(--amber); border: 2px solid rgba(255,255,255,0.25);
    object-fit: cover; overflow: hidden;
}
.edit-icon {
    position: absolute; bottom: 0; right: 0; background: var(--amber); color: var(--ink);
    border-radius: 50%; width: 26px; height: 26px; display: flex; align-items: center;
    justify-content: center; font-size: 0.8rem; cursor: pointer; border: 2px solid var(--ink);
}
.editable-field { display: flex; align-items: center; justify-content: center; gap: 8px; }
.editable-field h5 { color: white; font-size: 1.05rem; }
.edit-btn { cursor: pointer; color: var(--amber); font-size: 0.85rem; }
.role-badge {
    font-size: 0.65rem; padding: 4px 10px; border-radius: 20px;
    background: rgba(217,130,43,0.18); color: var(--amber);
    font-weight: 700; letter-spacing: 0.08em; font-family: var(--font-body);
}
.profile-details { margin-top: 14px; border-top: 1px solid rgba(255,255,255,0.15); padding-top: 12px; text-align: left; }
.profile-details p { color: rgba(255,255,255,0.75); }
.profile-details strong { color: rgba(255,255,255,0.95); font-weight: 600; }

.nav-link {
    color: var(--ink-soft); cursor: pointer; margin-bottom: 3px; padding: 11px 14px;
    border-radius: 10px; text-decoration: none; display: flex; align-items: center;
    transition: 0.15s; font-weight: 500; font-size: 0.92rem;
}
.nav-link i { width: 20px; color: var(--ink-faint); transition: 0.15s; }
.nav-link:hover { background: var(--amber-wash); color: var(--amber-deep); }
.nav-link:hover i { color: var(--amber-deep); }
.nav-link.text-danger { color: var(--clay) !important; }
.nav-link.text-danger i { color: var(--clay); }

/* ---------------------------------------------------------------------
   Content area & cards
   --------------------------------------------------------------------- */
.content-area { max-width: 800px; margin: 20px auto; padding: 0 16px; padding-bottom: 104px; }
.section-panel { display: none; animation: slideUp 0.3s ease-out; }
.active-panel { display: block; }
@keyframes slideUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.card {
    border: none; border-radius: 16px; box-shadow: var(--card-shadow);
    margin-bottom: 15px; background: var(--paper); padding: 20px;
}
.card h6 { font-family: var(--font-display); font-weight: 600; color: var(--ink); margin-bottom: 12px; }

.form-control, .form-select {
    border: 1.5px solid var(--line); border-radius: 10px; font-size: 0.92rem;
    background: var(--cloud);
}
.form-control:focus, .form-select:focus {
    border-color: var(--amber); box-shadow: 0 0 0 3px var(--amber-wash); background: var(--paper);
}

.btn { border-radius: 10px; font-weight: 600; font-size: 0.88rem; }
.btn-primary { background: var(--ink); border-color: var(--ink); }
.btn-primary:hover, .btn-primary:focus { background: var(--amber-deep); border-color: var(--amber-deep); }
.btn-success { background: var(--teal); border-color: var(--teal); }
.btn-danger { background: var(--clay); border-color: var(--clay); }
.btn-warning { background: var(--amber); border-color: var(--amber); color: white; }
.btn-outline-success { color: var(--teal); border-color: var(--teal); }
.btn-outline-success:hover { background: var(--teal); border-color: var(--teal); }
.btn-outline-danger { color: var(--clay); border-color: var(--clay); }
.btn-outline-danger:hover { background: var(--clay); border-color: var(--clay); }
.btn-outline-primary { color: var(--ink); border-color: var(--ink); }
.btn-outline-primary:hover { background: var(--ink); border-color: var(--ink); }
.btn-light { background: var(--cloud); border-color: var(--line); color: var(--ink); }

/* IDs, fee amounts, dates — the utility "data voice" */
small.text-muted, .role-badge, #user-display-id, #user-display-class {
    font-family: var(--font-mono);
}

.progress { border-radius: 20px; background: var(--cloud-dim); }
.progress-bar { background: var(--teal); font-family: var(--font-mono); font-size: 0.78rem; font-weight: 600; }

.bg-primary { background: var(--ink) !important; }
.bg-success { background: var(--teal) !important; }
.bg-danger { background: var(--clay) !important; }
.text-primary { color: var(--ink) !important; }
.text-success { color: var(--teal) !important; }
.text-danger { color: var(--clay) !important; }
.text-muted { color: var(--ink-faint) !important; }

.bottom-nav {
    position: fixed; bottom: 0; left: 0; width: 100%; height: 68px;
    background: var(--paper); display: flex; justify-content: space-around; align-items: center;
    border-top: 1px solid var(--line); z-index: 999; padding-bottom: 4px;
    box-shadow: 0 -4px 18px rgba(16,26,51,0.06);
}
.nav-item { text-align: center; color: var(--ink-faint); cursor: pointer; font-size: 0.7rem; flex: 1; transition: 0.15s; font-weight: 500; }
.nav-item.active { color: var(--amber-deep); font-weight: 700; }
.nav-item i { font-size: 1.2rem; margin-bottom: 3px; display: block; }

/* Announcement / directory / material cards get a touch of the horizon
   rule too, so the motif reads as a system, not a one-off login flourish */
#announcement-list .card:not(:last-child),
#student-directory-container .card:not(:last-child) {
    border-bottom: 2px solid transparent;
    border-image: linear-gradient(90deg, var(--amber-wash) 0%, transparent 70%) 1;
}

/* Chat threads (Phase 2C) */
.chat-messages-box {
    max-height: 55vh; overflow-y: auto; padding: 10px;
    background: var(--cloud-dim); border-radius: 10px; border: 1px solid var(--line);
}
.chat-bubble {
    max-width: 80%; padding: 8px 12px; border-radius: 14px; margin-bottom: 8px;
    font-size: 0.9rem; word-wrap: break-word;
}
.chat-bubble-mine {
    background: var(--ink); color: white; margin-left: auto; border-bottom-right-radius: 3px;
}
.chat-bubble-theirs {
    background: var(--paper); border: 1px solid var(--line); color: var(--ink); border-bottom-left-radius: 3px;
}
.chat-bubble-time {
    font-size: 0.65rem; opacity: 0.65; margin-top: 2px; font-family: var(--font-mono);
}

/* Owner Panel: income & growth cards (Phase 2C) */
.growth-bars {
    display: flex; align-items: flex-end; gap: 6px; height: 90px; padding-top: 8px;
}
.growth-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; }
.growth-bar-fill {
    width: 100%; background: var(--teal); border-radius: 4px 4px 0 0; min-height: 2px;
    transition: height 0.3s ease;
}
.growth-bar-label { font-size: 0.62rem; color: var(--ink-faint); margin-top: 4px; font-family: var(--font-mono); }
.income-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 0.85rem; }
.income-row:last-child { border-bottom: none; }
.income-pct-bar { background: var(--cloud-dim); border-radius: 6px; height: 6px; overflow: hidden; margin-top: 3px; }
.income-pct-fill { height: 100%; background: var(--amber); }

@media (prefers-reduced-motion: reduce) {
    *, .section-panel, .loader { animation: none !important; transition: none !important; }
}

/* ===================================================================
   Phase 6A additions: notification category tabs, Quick Action FAB,
   bottom-nav "More" sheet, and a shared empty/error state style —
   visual pass keeps the existing Ink/Amber/Teal palette but leans on
   amber only for primary actions, not everywhere.
   =================================================================== */
.notif-cat-btn {
    background: var(--cloud-dim, #eef0f5);
    color: var(--ink, #101A33);
    border: none;
    border-radius: 999px;
    font-size: 0.72rem;
    padding: 3px 10px;
    white-space: nowrap;
}
.notif-cat-btn.active {
    background: var(--amber, #D9822B);
    color: #fff;
    font-weight: 600;
}
.sp-tab-btn {
    background: var(--cloud-dim, #eef0f5);
    color: var(--ink, #101A33);
    border: none;
    border-radius: 10px;
    font-size: 0.8rem;
    padding: 6px 14px;
}
.sp-tab-btn.active {
    background: var(--amber, #D9822B);
    color: #fff;
    font-weight: 600;
}

.state-empty, .state-error {
    text-align: center;
    padding: 24px 12px;
    color: var(--ink-faint, #6b7280);
    font-size: 0.85rem;
}
.state-error { color: var(--clay-red, #B94A3D); }
.state-error .btn { margin-top: 8px; }

/* Quick Action floating button */
#quick-action-fab {
    position: fixed;
    right: 18px;
    bottom: 84px;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: var(--amber, #D9822B);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    box-shadow: 0 6px 18px rgba(217,130,43,0.45);
    z-index: 14000;
    cursor: pointer;
    border: none;
}
#quick-action-menu {
    display: none;
    position: fixed;
    right: 18px;
    bottom: 148px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.18);
    z-index: 14000;
    min-width: 220px;
    overflow: hidden;
}
#quick-action-menu .qa-item {
    padding: 10px 14px;
    font-size: 0.85rem;
    cursor: pointer;
    border-bottom: 1px solid var(--line, #eee);
}
#quick-action-menu .qa-item:last-child { border-bottom: none; }
#quick-action-menu .qa-item:hover { background: var(--cloud-dim, #f3f5fa); }

#more-nav-sheet {
    display: none;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: #fff;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -6px 24px rgba(0,0,0,0.18);
    z-index: 14500;
    padding: 14px;
    max-height: 60vh;
    overflow-y: auto;
}
#more-nav-sheet .more-item {
    padding: 12px 8px;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--line, #eee);
    cursor: pointer;
}
#more-nav-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(16,26,51,0.35);
    z-index: 14400;
}

