/* ==========================================================
   STNexus Exams - Visual System
   Conservative UI layer: no database or exam logic changes.
   ========================================================== */
:root {
    --stn-font: 'IBM Plex Sans Arabic', 'Cairo', 'Almarai', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --stn-bg: #f5f7fb;
    --stn-bg-soft: #eef4ff;
    --stn-surface: #ffffff;
    --stn-surface-2: #f8fafc;
    --stn-border: #e3e9f5;
    --stn-text: #102033;
    --stn-muted: #66758a;
    --stn-primary: #155eef;
    --stn-primary-2: #0f766e;
    --stn-primary-soft: rgba(21, 94, 239, .10);
    --stn-info: #0284c7;
    --stn-success: #059669;
    --stn-warning: #d97706;
    --stn-danger: #dc2626;
    --stn-dark: #0f172a;
    --stn-radius-sm: 12px;
    --stn-radius: 18px;
    --stn-radius-lg: 28px;
    --stn-shadow: 0 20px 60px rgba(15, 23, 42, .08);
    --stn-shadow-sm: 0 10px 28px rgba(15, 23, 42, .06);
    --stn-gradient: linear-gradient(135deg, #155eef 0%, #06b6d4 55%, #10b981 100%);
    --stn-hero: radial-gradient(circle at 10% 0%, rgba(56, 189, 248, .42), transparent 34%), radial-gradient(circle at 90% 10%, rgba(16, 185, 129, .22), transparent 28%), linear-gradient(135deg, #0f172a 0%, #123264 55%, #0f766e 100%);
}

html { font-size: 15px; }
html, body { min-height: 100%; }
body {
    direction: rtl;
    font-family: var(--stn-font) !important;
    color: var(--stn-text);
    background:
        radial-gradient(circle at 8% 2%, rgba(21,94,239,.09), transparent 34%),
        radial-gradient(circle at 95% 8%, rgba(20,184,166,.08), transparent 30%),
        linear-gradient(180deg, #f8fbff 0%, var(--stn-bg) 44%, #f3f6fb 100%) !important;
    overflow-x: hidden;
}
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image: linear-gradient(rgba(15,23,42,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(15,23,42,.035) 1px, transparent 1px);
    background-size: 46px 46px;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,.4), transparent 75%);
    z-index: -1;
}

a { color: var(--stn-primary); text-decoration: none; }
a:hover { color: #0b4bc5; }

/* App shell */
.stn-app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 292px minmax(0, 1fr);
}
.stn-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 18px 16px;
    background: rgba(255, 255, 255, .82);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    border-left: 1px solid rgba(226, 232, 240, .9);
    box-shadow: -15px 0 55px rgba(15, 23, 42, .05);
    display: flex;
    flex-direction: column;
    gap: 16px;
    z-index: 1020;
}
.stn-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 22px;
    color: var(--stn-text);
    background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(248,250,252,.95));
    border: 1px solid rgba(226, 232, 240, .9);
}
.stn-brand:hover { color: var(--stn-text); }
.stn-brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 17px;
    display: grid;
    place-items: center;
    color: white;
    font-size: 1.35rem;
    background: var(--stn-gradient);
    box-shadow: 0 14px 32px rgba(21, 94, 239, .28);
}
.stn-brand-title { font-weight: 900; letter-spacing: -.3px; line-height: 1.15; }
.stn-brand-subtitle { font-size: .78rem; color: var(--stn-muted); font-weight: 700; margin-top: 3px; }
.stn-menu-label {
    color: #94a3b8;
    font-size: .73rem;
    font-weight: 900;
    letter-spacing: .4px;
    margin: 6px 12px 2px;
    text-transform: uppercase;
}
.stn-menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.stn-menu-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 13px;
    border-radius: 16px;
    color: #475569;
    font-weight: 800;
    transition: .18s ease;
}
.stn-menu-link i {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    background: rgba(15, 23, 42, .045);
    color: #64748b;
    transition: .18s ease;
}
.stn-menu-link:hover {
    color: var(--stn-primary);
    background: rgba(21, 94, 239, .08);
    transform: translateX(-2px);
}
.stn-menu-link:hover i, .stn-menu-link.active i {
    background: white;
    color: var(--stn-primary);
    box-shadow: 0 8px 18px rgba(21, 94, 239, .15);
}
.stn-menu-link.active {
    color: var(--stn-primary);
    background: linear-gradient(135deg, rgba(21,94,239,.13), rgba(6,182,212,.08));
    box-shadow: inset 0 0 0 1px rgba(21,94,239,.08);
}
.stn-sidebar-footer {
    margin-top: auto;
    padding: 12px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(15, 23, 42, .96), rgba(17, 62, 101, .96));
    color: white;
    overflow: hidden;
    position: relative;
}
.stn-sidebar-footer::after {
    content: '';
    position: absolute;
    width: 160px;
    height: 160px;
    border-radius: 999px;
    left: -70px;
    top: -80px;
    background: rgba(56, 189, 248, .24);
}
.stn-sidebar-footer small, .stn-sidebar-footer a, .stn-sidebar-footer button { position: relative; z-index: 1; }
.stn-main { min-width: 0; display: flex; flex-direction: column; }
.stn-topbar {
    position: sticky;
    top: 0;
    z-index: 1015;
    min-height: 74px;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 28px;
    background: rgba(248, 250, 252, .74);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(226, 232, 240, .82);
}
.stn-mobile-brand { display: none; }
.stn-page-title { font-size: 1.18rem; font-weight: 900; color: var(--stn-text); margin: 0; }
.stn-page-subtitle { font-size: .82rem; color: var(--stn-muted); margin-top: 2px; }
.stn-content { padding: 26px 28px 44px; flex: 1; }
.stn-footer {
    color: var(--stn-muted);
    padding: 0 28px 24px;
    font-size: .84rem;
}
.stn-user-chip {
    border: 1px solid var(--stn-border);
    background: rgba(255,255,255,.92);
    border-radius: 999px;
    padding: 7px 11px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--stn-shadow-sm);
}
.stn-user-avatar {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    color: white;
    background: var(--stn-gradient);
}

/* Bootstrap harmony */
.container, .container-fluid { max-width: 1380px; }
.card, .soft-card, .main-card, .settings-card, .q-counter-box, .login-card, .otp-card {
    border: 1px solid rgba(226, 232, 240, .88) !important;
    border-radius: var(--stn-radius-lg) !important;
    box-shadow: var(--stn-shadow-sm) !important;
    background: rgba(255, 255, 255, .95) !important;
}
.card:hover, .soft-card:hover, .settings-card:hover, .q-counter-box:hover {
    box-shadow: var(--stn-shadow) !important;
}
.card-header {
    border-bottom: 1px solid var(--stn-border) !important;
    background: linear-gradient(180deg, rgba(248,250,252,.96), rgba(255,255,255,.96)) !important;
}
.page-hero, .dashboard-hero, .hero-header {
    background: var(--stn-hero) !important;
    border-radius: 30px !important;
    box-shadow: 0 28px 70px rgba(15, 23, 42, .18) !important;
    border: 1px solid rgba(255,255,255,.16) !important;
    position: relative;
    overflow: hidden;
}
.page-hero::before, .dashboard-hero::before, .hero-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle at 28% 28%, rgba(255,255,255,.16), transparent 14%), linear-gradient(135deg, rgba(255,255,255,.08), transparent 42%);
    pointer-events: none;
}
.page-hero > *, .dashboard-hero > *, .hero-header > * { position: relative; z-index: 1; }
.form-section-title {
    color: var(--stn-text) !important;
    border-bottom: 1px solid var(--stn-border) !important;
    padding-bottom: .85rem !important;
    margin-bottom: 1.25rem !important;
}
.form-section-title i {
    color: var(--stn-primary);
}
.form-control, .form-select, .input-group-text {
    min-height: 44px;
    border-radius: 14px !important;
    border-color: #dbe4f0 !important;
    background-color: rgba(255,255,255,.96) !important;
    color: var(--stn-text) !important;
    font-weight: 650;
}
.form-control:focus, .form-select:focus {
    border-color: var(--stn-primary) !important;
    box-shadow: 0 0 0 4px rgba(21, 94, 239, .13) !important;
}
.form-label {
    color: #405066 !important;
    font-size: .86rem;
    font-weight: 900 !important;
    margin-bottom: .45rem;
}
.form-text { color: var(--stn-muted) !important; }
.form-check-input {
    width: 2.55em;
    height: 1.35em;
    cursor: pointer;
}
.form-check-input:checked {
    background-color: var(--stn-primary);
    border-color: var(--stn-primary);
}
.btn {
    border-radius: 14px !important;
    font-weight: 850 !important;
    letter-spacing: -.1px;
}
.btn-primary, .btn-gradient {
    background: var(--stn-gradient) !important;
    border: 0 !important;
    color: #fff !important;
    box-shadow: 0 14px 30px rgba(21, 94, 239, .20) !important;
}
.btn-primary:hover, .btn-gradient:hover { transform: translateY(-1px); box-shadow: 0 18px 36px rgba(21, 94, 239, .27) !important; }
.btn-outline-primary { border-color: rgba(21,94,239,.35) !important; color: var(--stn-primary) !important; }
.btn-outline-primary:hover { background: var(--stn-primary) !important; color: #fff !important; }
.btn-light { background: rgba(255,255,255,.92) !important; border-color: rgba(226,232,240,.86) !important; }
.badge, .pill { border-radius: 999px !important; font-weight: 900 !important; letter-spacing: -.1px; }
.alert { border-radius: 20px !important; border: 0 !important; box-shadow: var(--stn-shadow-sm); }
.table {
    border-collapse: separate !important;
    border-spacing: 0;
    overflow: hidden;
    border-radius: 22px !important;
    background: white !important;
    box-shadow: var(--stn-shadow-sm) !important;
}
.table thead th {
    background: #eef5ff !important;
    color: #24405f !important;
    border: 0 !important;
    font-weight: 900;
    font-size: .86rem;
    padding: 14px 16px !important;
}
.table tbody td {
    border-color: #edf2f7 !important;
    padding: 14px 16px !important;
    color: #26364a;
}
.table tbody tr:hover td { background: #f8fbff !important; }
.dropdown-menu {
    border: 1px solid var(--stn-border) !important;
    border-radius: 20px !important;
    box-shadow: 0 24px 60px rgba(15,23,42,.14) !important;
}
.dropdown-item { border-radius: 13px !important; font-weight: 800; }
.progress { background: #e7edf6; }
.progress-bar { background: var(--stn-gradient); }

/* Pages with old inline classes */
.stat-card { border-radius: 24px !important; }
.mini-muted { color: var(--stn-muted) !important; font-size: .78rem !important; }
.check-tile {
    border-radius: 18px !important;
    border: 1px solid var(--stn-border) !important;
    background: white !important;
}
.check-tile:hover {
    border-color: rgba(21,94,239,.38) !important;
    background: #f8fbff !important;
}
.q-counter-box {
    background: linear-gradient(180deg, #ffffff, #f8fbff) !important;
    border-style: solid !important;
}
.settings-card { background: linear-gradient(180deg, #ffffff, #fbfdff) !important; }
.x-small { font-size: .74rem; }
.fade-in, .fade-in-up { animation: stnFadeIn .35s ease both; }
@keyframes stnFadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Login standalone pages */
.stn-auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px;
    background: var(--stn-hero) !important;
    position: relative;
    overflow: hidden;
}
.stn-auth-body::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 15% 16%, rgba(255,255,255,.22), transparent 26%), radial-gradient(circle at 85% 80%, rgba(16,185,129,.24), transparent 28%);
}
.stn-auth-card {
    width: min(100%, 500px);
    border-radius: 32px;
    padding: 34px;
    background: rgba(255,255,255,.95);
    box-shadow: 0 34px 90px rgba(15,23,42,.28);
    border: 1px solid rgba(255,255,255,.38);
    position: relative;
    z-index: 1;
}
.stn-auth-mark {
    width: 76px;
    height: 76px;
    border-radius: 26px;
    display: grid;
    place-items: center;
    margin: 0 auto 16px;
    color: #fff;
    font-size: 2rem;
    background: var(--stn-gradient);
    box-shadow: 0 20px 42px rgba(21,94,239,.28);
}
.stn-auth-title { font-weight: 950; color: var(--stn-text); margin-bottom: 4px; }
.stn-auth-subtitle { color: var(--stn-muted); font-weight: 700; }
.stn-auth-note {
    background: #f3f8ff;
    color: #36506d;
    border: 1px solid #dbeafe;
    border-radius: 18px;
    padding: 12px 14px;
    font-size: .86rem;
    font-weight: 750;
}
.otp-input { letter-spacing: .35rem !important; text-align: center !important; font-size: 1.55rem !important; font-weight: 950 !important; }

/* Responsive */
@media (max-width: 1199.98px) {
    .stn-app-shell { grid-template-columns: 1fr; }
    .stn-sidebar {
        position: fixed;
        right: 0;
        top: 0;
        transform: translateX(105%);
        width: 300px;
        transition: transform .22s ease;
    }
    body.stn-sidebar-open .stn-sidebar { transform: translateX(0); }
    body.stn-sidebar-open::after {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(15,23,42,.38);
        z-index: 1010;
    }
    .stn-mobile-brand { display: flex; align-items: center; gap: 10px; }
    .stn-topbar { padding: 12px 16px; }
    .stn-content { padding: 18px 14px 34px; }
}
@media (max-width: 767.98px) {
    html { font-size: 14px; }
    .stn-topbar { min-height: 66px; }
    .stn-page-subtitle { display: none; }
    .page-hero, .dashboard-hero, .hero-header { border-radius: 24px !important; padding: 1.4rem !important; }
    .stn-auth-card { padding: 24px; border-radius: 26px; }
    .table { font-size: .88rem; }
    .btn { white-space: normal; }
}
@media print {
    .stn-sidebar, .stn-topbar, .stn-footer, .btn, .dropdown { display: none !important; }
    .stn-app-shell { display: block; }
    .stn-content { padding: 0 !important; }
    body { background: #fff !important; }
    .card, .table, .main-card { box-shadow: none !important; }
}

/* Public/root layout */
.stn-public-layout { display: flex; min-height: 100vh; flex-direction: column; }
.stn-public-nav {
    position: sticky !important;
    top: 0;
    z-index: 1020;
    background: rgba(255,255,255,.82) !important;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(226,232,240,.88) !important;
    box-shadow: 0 14px 34px rgba(15,23,42,.05) !important;
    padding: .85rem 0 !important;
}
.stn-public-nav .nav-link {
    color: #475569 !important;
    border-radius: 14px !important;
    font-weight: 850 !important;
    padding: .65rem .9rem !important;
}
.stn-public-nav .nav-link:hover {
    color: var(--stn-primary) !important;
    background: rgba(21,94,239,.08) !important;
}
.stn-public-content { flex: 1; padding: 18px 0 36px; }
.stn-public-footer { padding: 24px 0; color: var(--stn-muted); border-top: 1px solid rgba(226,232,240,.8); background: rgba(255,255,255,.68); }

/* ==========================================================
   STNexus Exams - Interface Polish
   ========================================================== */
.fw-black { font-weight: 900 !important; }
.stn-pro-hero {
    background: radial-gradient(800px circle at 0% 0%, rgba(56,189,248,.45), transparent 34%), radial-gradient(700px circle at 100% 20%, rgba(16,185,129,.28), transparent 28%), linear-gradient(135deg, #0f172a 0%, #1e3a8a 55%, #0f766e 100%);
    color: #fff;
    border-radius: 28px;
    padding: 28px;
    box-shadow: 0 24px 70px rgba(15,23,42,.18);
    display: flex;
    justify-content: space-between;
    gap: 22px;
    align-items: center;
    overflow: hidden;
    position: relative;
}
.stn-pro-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255,255,255,.18) 1px, transparent 1px);
    background-size: 24px 24px;
    opacity: .22;
    pointer-events: none;
}
.stn-pro-hero > * { position: relative; z-index: 1; }
.stn-pro-hero h1 { font-weight: 900; margin: 0 0 8px; letter-spacing: -.8px; }
.stn-pro-hero p { margin: 0; opacity: .82; max-width: 780px; line-height: 1.8; }
.stn-eyebrow { font-size: .78rem; font-weight: 900; color: #bae6fd; margin-bottom: 6px; letter-spacing: .5px; }
.stn-kpi {
    background: rgba(255,255,255,.94);
    border: 1px solid rgba(226,232,240,.9);
    border-radius: 24px;
    padding: 18px 20px;
    min-height: 116px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-shadow: 0 14px 38px rgba(15,23,42,.07);
}
.stn-kpi span { color: #64748b; font-size: .86rem; font-weight: 800; }
.stn-kpi strong { color: #0f172a; font-size: 2rem; line-height: 1.2; font-weight: 900; margin-top: 5px; }
.stn-kpi.success strong { color: #059669; }
.stn-kpi.warning strong { color: #d97706; }
.stn-kpi.danger strong { color: #dc2626; }
.stn-avatar-sm {
    width: 40px; height: 40px; border-radius: 14px;
    background: linear-gradient(135deg, rgba(21,94,239,.14), rgba(6,182,212,.12));
    color: #155eef; display: grid; place-items: center; font-weight: 900;
}
.table-hover tbody tr { transition: .16s ease; }
.table-hover tbody tr:hover { transform: translateY(-1px); box-shadow: 0 12px 24px rgba(15,23,42,.05); }
.form-control, .form-select { border-color: #dbe5f3; }
.form-control:focus, .form-select:focus { border-color: #93c5fd; box-shadow: 0 0 0 .25rem rgba(21,94,239,.12); }
@media (max-width: 900px) {
    .stn-pro-hero { flex-direction: column; align-items: stretch; }
    .stn-pro-hero .btn { width: 100%; }
}
