/* ===================================================================
   FutureX — professional glassmorphism theme
   =================================================================== */
:root {
    --fx-primary: #2563eb;          /* blue-600 */
    --fx-primary-2: #4338ca;        /* indigo-700 */
    --fx-green: #059669;
    --fx-amber: #d97706;
    --fx-cyan: #0891b2;
    --fx-slate: #475569;

    --fx-ink: #0f172a;              /* slate-900 */
    --fx-muted: #64748b;           /* slate-500 */

    --fx-sidebar-w: 264px;

    --glass-bg: rgba(255, 255, 255, 0.70);
    --glass-bg-strong: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.75);
    --line: rgba(15, 23, 42, 0.08);
    --glass-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    --radius: 18px;
    --radius-sm: 12px;

    --ease: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--fx-ink);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
    background: #eef2f7;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Subtle professional colour field behind the frosted glass */
body::before, body::after {
    content: ""; position: fixed; z-index: -2; border-radius: 50%;
    filter: blur(90px); opacity: .35; pointer-events: none;
}
body::before {
    width: 50vw; height: 50vw; top: -16vw; left: -12vw;
    background: radial-gradient(circle at 30% 30%, #93b4f5, #2563eb 70%, transparent 72%);
}
body::after {
    width: 46vw; height: 46vw; bottom: -18vw; right: -10vw;
    background: radial-gradient(circle at 70% 70%, #a5b4fc, #4338ca 70%, transparent 72%);
}
.bg-fixed-tint {
    position: fixed; inset: 0; z-index: -3;
    background: linear-gradient(165deg, #f3f6fb 0%, #eaeef6 55%, #eef2f9 100%);
}

/* ---------- Layout shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.app-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
@media (min-width: 992px) { .app-main { margin-left: var(--fx-sidebar-w); } }

/* Glass surfaces (NOT modals — modals stay solid & opaque for usability) */
.app-sidebar, .app-topbar, .app-footer, .card, .auth-card {
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    backdrop-filter: blur(18px) saturate(160%);
}

/* ---------- Sidebar ---------- */
.app-sidebar {
    width: var(--fx-sidebar-w);
    background: var(--glass-bg);
    border-right: 1px solid var(--line);
    display: flex; flex-direction: column; padding: 0;
}
@media (min-width: 992px) {
    .app-sidebar { position: fixed; top: 0; left: 0; bottom: 0; z-index: 1030; }
}
.sidebar-brand {
    display: flex; align-items: center; gap: .7rem;
    padding: 1.15rem 1.25rem; font-size: 1.25rem; font-weight: 700;
    letter-spacing: -.02em; color: var(--fx-ink);
}
.brand-mark {
    display: inline-grid; place-items: center; width: 40px; height: 40px;
    background: linear-gradient(135deg, var(--fx-primary), var(--fx-primary-2));
    border-radius: 11px; color: #fff; font-size: 1.1rem;
    box-shadow: 0 6px 16px rgba(37,99,235,.35);
}
.sidebar-nav { padding: .75rem; gap: .2rem; flex: 1 1 auto; }
.sidebar-nav .nav-link {
    color: #334155; display: flex; align-items: center; gap: .85rem;
    border-radius: 11px; padding: .65rem .9rem; font-weight: 600; font-size: .94rem;
    transition: background .2s var(--ease), color .2s, transform .12s var(--ease);
}
.sidebar-nav .nav-link i { font-size: 1.15rem; width: 1.5rem; text-align: center; }
.sidebar-nav .nav-link:hover { background: rgba(37,99,235,.08); color: var(--fx-primary); }
.sidebar-nav .nav-link:active { transform: scale(.98); }
.sidebar-nav .nav-link.active {
    background: linear-gradient(135deg, var(--fx-primary), var(--fx-primary-2));
    color: #fff; box-shadow: 0 8px 18px rgba(37,99,235,.32);
}
.sidebar-footer { padding: .75rem; border-top: 1px solid var(--line); }
.sidebar-footer .nav-link { display: flex; align-items: center; gap: .6rem; border-radius: 11px; padding: .6rem .9rem; font-weight: 600; }
.sidebar-footer .nav-link:hover { background: rgba(220,38,38,.08); }

/* ---------- Topbar ---------- */
.app-topbar {
    display: flex; align-items: center; gap: .75rem;
    background: var(--glass-bg-strong); border-bottom: 1px solid var(--line);
    padding: .6rem 1.1rem; position: sticky; top: 0; z-index: 1020;
}
.topbar-title { font-size: 1.15rem; font-weight: 700; letter-spacing: -.02em; margin: 0; }
.avatar {
    display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, var(--fx-primary), var(--fx-primary-2)); color: #fff; font-weight: 700;
}
.topbar-user small { font-size: .7rem; line-height: 1; }
.app-topbar .btn-light { background: rgba(255,255,255,.7); border: 1px solid var(--line); border-radius: 11px; }

/* ---------- Content ---------- */
/* NOTE: no transform/opacity animation here — it would trap fixed-position
   modals in a stacking context and let the backdrop cover them. */
.app-content { padding: 1.35rem; flex: 1 1 auto; }
.app-footer { padding: .85rem 1.35rem; background: var(--glass-bg); border-top: 1px solid var(--line); }

/* ---------- Cards ---------- */
.card {
    background: var(--glass-bg); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--glass-shadow);
    transition: transform .25s var(--ease), box-shadow .25s var(--ease);
    animation: cardIn .45s var(--ease) both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.row > [class*="col"]:nth-child(2) .card { animation-delay: .05s; }
.row > [class*="col"]:nth-child(3) .card { animation-delay: .10s; }
.row > [class*="col"]:nth-child(4) .card { animation-delay: .15s; }
.row > [class*="col"]:nth-child(5) .card { animation-delay: .20s; }
.row > [class*="col"]:nth-child(6) .card { animation-delay: .25s; }
.card:hover { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(15,23,42,.12); }

.stat-card { display: flex; align-items: center; gap: 1rem; }
.stat-icon {
    display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 14px;
    font-size: 1.5rem; color: #fff; box-shadow: 0 8px 18px rgba(15,23,42,.12);
}
.stat-value { font-size: 1.65rem; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.stat-label { color: var(--fx-muted); font-size: .85rem; font-weight: 500; }

.bg-grad-1 { background: linear-gradient(135deg,#2563eb,#4338ca); }
.bg-grad-2 { background: linear-gradient(135deg,#059669,#047857); }
.bg-grad-3 { background: linear-gradient(135deg,#d97706,#b45309); }
.bg-grad-4 { background: linear-gradient(135deg,#4f46e5,#3730a3); }
.bg-grad-5 { background: linear-gradient(135deg,#0891b2,#0e7490); }

/* ---------- Tables ---------- */
.table-card { overflow: hidden; }
.table { --bs-table-bg: transparent; margin: 0; }
.table > :not(caption) > * > * { padding: .8rem 1rem; background: transparent; }
.table thead th {
    background: rgba(15,23,42,.03); color: var(--fx-muted);
    font-size: .73rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 700;
    border-bottom: 1px solid var(--line);
}
.table-hover > tbody > tr { transition: background .15s var(--ease); }
.table-hover > tbody > tr:hover > * { background: rgba(37,99,235,.05); }
.table tbody tr { border-color: var(--line); }

/* ---------- Buttons ---------- */
.btn { border-radius: 11px; font-weight: 600; transition: transform .1s var(--ease), box-shadow .2s, filter .15s; }
.btn:active { transform: scale(.97); }
.btn-primary { background: linear-gradient(135deg, var(--fx-primary), var(--fx-primary-2)); border: none; box-shadow: 0 6px 16px rgba(37,99,235,.28); }
.btn-primary:hover { filter: brightness(1.06); box-shadow: 0 8px 20px rgba(37,99,235,.36); }
.btn-light { background: rgba(255,255,255,.85); border: 1px solid var(--line); }
.btn-outline-secondary { border-color: rgba(15,23,42,.2); color: #334155; }
.btn-outline-secondary:hover { background: rgba(15,23,42,.05); color: var(--fx-ink); border-color: rgba(15,23,42,.28); }
.btn-outline-primary { color: var(--fx-primary); border-color: rgba(37,99,235,.45); }
.btn-outline-primary:hover { background: var(--fx-primary); border-color: var(--fx-primary); }
.btn-link { color: var(--fx-primary); text-decoration: none; font-weight: 600; }

/* segmented control for attendance radios */
.btn-group { background: rgba(15,23,42,.06); border-radius: 12px; padding: 1px; }
.btn-group .btn-check + .btn { border-radius: 10px !important; margin: 2px; border: none; background: transparent; color: #334155; font-weight: 600; }
.btn-check:checked + .btn-outline-success { background: var(--fx-green); color:#fff; }
.btn-check:checked + .btn-outline-danger  { background: #dc2626; color:#fff; }
.btn-check:checked + .btn-outline-warning { background: var(--fx-amber); color:#fff; }

/* ---------- Forms ---------- */
.form-control, .form-select {
    border-radius: 11px; border: 1px solid rgba(15,23,42,.15);
    background: #fff; padding: .58rem .85rem;
    transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus { border-color: var(--fx-primary); box-shadow: 0 0 0 3px rgba(37,99,235,.16); }
.input-group-text { border-radius: 11px; background: #f8fafc; border: 1px solid rgba(15,23,42,.15); }
.form-label { font-weight: 600; font-size: .86rem; color: #334155; margin-bottom: .35rem; }
select[multiple].form-select { padding: .35rem; }
select[multiple] option { padding: .4rem .5rem; border-radius: 8px; }

/* ---------- Badges ---------- */
.badge { border-radius: 8px; font-weight: 600; padding: .4em .65em; }

/* ---------- Modal (SOLID & OPAQUE — always usable above the backdrop) ---------- */
.modal { z-index: 1060; }
.modal-backdrop { z-index: 1050; }
.modal-backdrop.show { opacity: .5; }
.modal-content {
    background: #ffffff;            /* fully opaque */
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 24px 60px rgba(15,23,42,.28);
}
.modal-header, .modal-footer { border-color: var(--line); }
.modal.fade .modal-dialog { transition: transform .3s var(--ease), opacity .25s; transform: translateY(16px); }
.modal.show .modal-dialog { transform: none; }
.dropdown-menu { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--glass-shadow); }

/* ---------- Alerts ---------- */
.alert { border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--glass-bg-strong); }
.alert-success { color: #047857; } .alert-danger { color: #b91c1c; }
.alert-warning { color: #b45309; } .alert-info { color: #1d4ed8; }

.list-group-item { background: transparent; border-color: var(--line); }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.2rem; }
.auth-card {
    background: var(--glass-bg-strong); border: 1px solid var(--glass-border);
    border-radius: 22px; width: 100%; max-width: 420px; padding: 2.3rem;
    box-shadow: 0 24px 60px rgba(15,23,42,.18);
}
.auth-logo {
    display: inline-grid; place-items: center; width: 58px; height: 58px; border-radius: 16px;
    background: linear-gradient(135deg, var(--fx-primary), var(--fx-primary-2));
    color: #fff; font-size: 1.6rem; margin-bottom: 1rem; box-shadow: 0 12px 26px rgba(37,99,235,.4);
}
a { color: var(--fx-primary); }

/* ---------- Helpers ---------- */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; flex-wrap: wrap; }
.empty-state { text-align: center; padding: 3rem 1rem; color: #94a3b8; }
.empty-state i { font-size: 2.4rem; display: block; margin-bottom: .5rem; opacity: .7; }
.min-w-0 { min-width: 0; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(15,23,42,.22); border-radius: 10px; border: 2px solid transparent; background-clip: content-box; }

.offcanvas { background: var(--glass-bg-strong) !important; -webkit-backdrop-filter: blur(20px) saturate(160%); backdrop-filter: blur(20px) saturate(160%); }
.offcanvas-backdrop.show { opacity: .35; }

@media (max-width: 991.98px) {
    .app-content { padding: 1rem; padding-bottom: calc(1rem + env(safe-area-inset-bottom)); }
    .topbar-title { font-size: 1.05rem; }
    .stat-value { font-size: 1.4rem; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
