/* =========================================================
   EduPractice — UI (Fluent uslubi) + tungi rejim (dark mode)
   Mavzu o'zgaruvchilar bilan boshqariladi: data-theme="light|dark"
   ========================================================= */
:root,
:root[data-theme="light"] {
    --accent:        #005FB8;
    --accent-hover:  #1A6FC0;
    --accent-press:  #00498F;
    --accent-soft:   #eaf2fb;

    --bg-base:       #f4f6fb;
    --bg-grad-1:     #dde9fb;
    --bg-grad-2:     #ece4fb;
    --surface:       #ffffff;     /* sidebar, kartalar */
    --surface-2:     #fbfbfd;     /* inputlar, table-light */
    --surface-3:     #f0f2f6;     /* ikon chiplar */
    --hover:         #f4f6fa;     /* nav hover */
    --topbar-bg:     rgba(255,255,255,.72);

    --stroke:        rgba(0,0,0,.07);
    --stroke-strong: rgba(0,0,0,.12);

    --text:          #1b1b1f;
    --text-2:        #5c5c66;

    --radius-card:   10px;
    --radius-ctrl:   7px;
    --shadow-card:   0 2px 4px rgba(0,0,0,.04), 0 0 2px rgba(0,0,0,.06);
    --shadow-flyout: 0 8px 24px rgba(0,0,0,.14);

    --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}

/* ---------- Tungi rejim ---------- */
:root[data-theme="dark"] {
    --accent:        #4c9dff;
    --accent-hover:  #62a9ff;
    --accent-press:  #3b8af0;
    --accent-soft:   rgba(76,157,255,.16);

    --bg-base:       #0f1115;
    --bg-grad-1:     #16202e;
    --bg-grad-2:     #1c1830;
    --surface:       #1a1d23;
    --surface-2:     #20242c;
    --surface-3:     #2a2f38;
    --hover:         #23272f;
    --topbar-bg:     rgba(26,29,35,.78);

    --stroke:        rgba(255,255,255,.09);
    --stroke-strong: rgba(255,255,255,.16);

    --text:          #e6e8ec;
    --text-2:        #9aa0aa;

    --shadow-card:   0 2px 4px rgba(0,0,0,.35), 0 0 2px rgba(0,0,0,.5);
    --shadow-flyout: 0 8px 24px rgba(0,0,0,.55);
}

* { font-family: var(--font); }
html { color-scheme: light dark; }

body {
    color: var(--text);
    background: var(--bg-base);
    transition: background-color .2s ease, color .2s ease;
}

/* ---------- Cards ---------- */
.card {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--stroke) !important;
    border-radius: var(--radius-card) !important;
    box-shadow: var(--shadow-card);
}
.card-header, .card-footer { background: var(--surface-2); border-color: var(--stroke) !important; }

/* ---------- Buttons ---------- */
.btn { border-radius: var(--radius-ctrl); font-weight: 500; }
.btn-primary {
    background: var(--accent); border-color: var(--accent); color: #fff;
    box-shadow: 0 1px 1px rgba(0,0,0,.1);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color:#fff; }
.btn-primary:active { background: var(--accent-press) !important; border-color: var(--accent-press) !important; }
.btn-outline-primary { color: var(--accent); border-color: var(--stroke-strong); }
.btn-outline-primary:hover { background: var(--accent); border-color: var(--accent); color:#fff; }
.btn-sm { border-radius: 6px; }
/* Dark rejimda "light" tugmalar surface'ga moslashadi */
[data-theme="dark"] .btn-light {
    background: var(--surface-2); border-color: var(--stroke-strong); color: var(--text);
}
[data-theme="dark"] .btn-light:hover { background: var(--surface-3); color: var(--text); }

/* ---------- Form controls ---------- */
.form-control, .form-select {
    border-radius: var(--radius-ctrl);
    border: 1px solid var(--stroke-strong);
    background: var(--surface-2);
    color: var(--text);
    box-shadow: inset 0 -1px 0 rgba(0,0,0,.1);
    transition: border-color .12s, box-shadow .12s;
}
.form-control::placeholder { color: var(--text-2); }
.form-control:focus, .form-select:focus {
    border-color: var(--stroke-strong);
    background: var(--surface);
    color: var(--text);
    box-shadow: inset 0 -2px 0 var(--accent);
}
.input-group-text {
    background: var(--surface-2);
    border: 1px solid var(--stroke-strong);
    border-radius: var(--radius-ctrl);
    color: var(--text-2);
}

/* ---------- Tables ---------- */
.table { --bs-table-bg: transparent; color: var(--text); }
.table > :not(caption) > * > * { border-color: var(--stroke); color: var(--text); }
.table-light th, .table-light td { background: var(--surface-2); color: var(--text-2); font-weight: 600; }
.table-hover > tbody > tr:hover > * { background: var(--hover); }

/* ---------- Badges / dropdown / alerts ---------- */
.badge { font-weight: 600; border-radius: 6px; }
.dropdown-menu {
    background: var(--surface);
    border: 1px solid var(--stroke);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-flyout);
    padding: .35rem;
}
.dropdown-item { border-radius: 6px; color: var(--text); }
.dropdown-item:hover { background: var(--hover); color: var(--text); }
.dropdown-divider { border-color: var(--stroke); }
.alert { border-radius: var(--radius-card); border: 1px solid var(--stroke); }
.modal-content { background: var(--surface); color: var(--text); border: 1px solid var(--stroke); }
.text-muted, .text-secondary { color: var(--text-2) !important; }

/* ---------- Ochiq sahifalar navbar'i (resources, vacancies) ---------- */
.app-navbar {
    background: var(--topbar-bg);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--stroke);
    min-height: 56px;
}
.app-navbar .brand {
    font-weight: 800; letter-spacing: -.2px; color: var(--text);
    text-decoration: none; display: flex; align-items: center; gap: .5rem;
}
.app-navbar .brand i { color: var(--accent); }

/* ---------- Helpers ---------- */
.acrylic-card {
    background: var(--surface);
    border: 1px solid var(--stroke);
    border-radius: 14px;
    box-shadow: var(--shadow-flyout);
}
.fluent-tile { border-radius: var(--radius-card); transition: transform .12s ease, box-shadow .12s ease; }
.fluent-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-flyout); }

/* =========================================================
   Dashboard shell
   ========================================================= */
.app-shell-bg {
    background:
        radial-gradient(900px 500px at 100% -10%, var(--bg-grad-1) 0%, transparent 55%),
        radial-gradient(800px 450px at -10% 110%, var(--bg-grad-2) 0%, transparent 55%),
        var(--bg-base);
    background-attachment: fixed;
}
.app-sidebar {
    position: fixed; top: 0; left: 0; width: 256px; height: 100vh;
    background: var(--surface); border-right: 1px solid var(--stroke);
    display: flex; flex-direction: column; padding: 1rem .75rem;
    z-index: 1040; transition: transform .25s ease, background-color .2s ease;
}
.app-sidebar .s-brand {
    display: flex; align-items: center; gap: .6rem;
    font-weight: 800; font-size: 1.15rem; color: var(--text);
    text-decoration: none; padding: .35rem .5rem 1rem;
}
.app-sidebar .s-brand .logo {
    width: 38px; height: 38px; border-radius: 11px; flex: none;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--accent), #6610f2); color: #fff; font-size: 1.1rem;
}
.s-nav { list-style: none; padding: 0; margin: 0; flex: 1; overflow-y: auto; }
.s-nav .s-sec { font-size: .68rem; font-weight: 700; letter-spacing: .08em; color: var(--text-2);
    text-transform: uppercase; padding: .5rem .6rem .25rem; margin-top: .5rem; }
.s-nav .s-sec:first-child { margin-top: 0; }
.s-nav a {
    display: flex; align-items: center; gap: .7rem; padding: .55rem .6rem;
    border-radius: 10px; color: var(--text); text-decoration: none;
    font-weight: 500; font-size: .94rem; margin-bottom: .15rem; transition: background .12s, color .12s;
}
.s-nav a .ic {
    width: 30px; height: 30px; border-radius: 8px; flex: none;
    display: flex; align-items: center; justify-content: center;
    background: var(--surface-3); color: var(--text-2); font-size: 1rem; transition: .12s;
}
.s-nav a:hover { background: var(--hover); }
.s-nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.s-nav a.active .ic { background: var(--accent); color: #fff; }
.s-foot { border-top: 1px solid var(--stroke); padding-top: .7rem; margin-top: .4rem; }

.app-main { margin-left: 256px; min-height: 100vh; }
.app-topbar {
    position: sticky; top: 0; z-index: 1030; height: 62px;
    display: flex; align-items: center; justify-content: space-between; padding: 0 1.4rem;
    background: var(--topbar-bg); backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid var(--stroke);
}
.app-topbar h1 { font-size: 1.15rem; font-weight: 700; margin: 0; color: var(--text); }
.app-content { padding: 1.6rem 1.4rem; }
.avatar {
    width: 36px; height: 36px; border-radius: 50%; flex: none;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--accent), #6610f2); color: #fff; font-weight: 700; font-size: .95rem;
}
.hamb { display: none; }
.s-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 1035; display: none; }

/* Mavzu almashtirish tugmasi */
.theme-toggle {
    width: 38px; height: 38px; border-radius: 50%; flex: none;
    display: flex; align-items: center; justify-content: center;
    background: var(--surface-2); border: 1px solid var(--stroke); color: var(--text-2);
    cursor: pointer; transition: background .15s, color .15s;
}
.theme-toggle:hover { background: var(--surface-3); color: var(--text); }
.theme-toggle .bi-moon-stars-fill { display: none; }
[data-theme="dark"] .theme-toggle .bi-sun-fill { display: none; }
[data-theme="dark"] .theme-toggle .bi-moon-stars-fill { display: inline; }

/* SPA navigatsiya yuklanish chizig'i */
#spaBar {
    position: fixed; top: 0; left: 0; height: 3px; width: 0;
    background: var(--accent); z-index: 2000; opacity: 0;
    transition: width .2s ease, opacity .3s ease;
}
.spa-fade { opacity: .55; transition: opacity .15s ease; }

@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); box-shadow: 0 0 40px rgba(0,0,0,.2); }
    .app-sidebar.show { transform: none; }
    .app-main { margin-left: 0; }
    .hamb { display: inline-flex; }
    .s-backdrop.show { display: block; }
}

/* Stat tile (dashboard) */
.stat-tile { border-radius: 16px; border: 1px solid var(--stroke); background: var(--surface);
             box-shadow: var(--shadow-card); transition: transform .16s, box-shadow .16s; }
.stat-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-flyout); }
.stat-ic { width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center;
           justify-content: center; font-size: 1.5rem; }
