/*
 * POYDEVOR USLUB — barcha temalar uchun.
 *
 * ═══ BU FAYL QANDAY BERILADI ═══
 * `GET /assets/theme.css?v=<hash>` marshruti orqali. Serverda `npm`
 * yo'q, ya'ni Vite bilan build qilish imkonsiz — `ThemeAssets` izohida
 * batafsil.
 *
 * ═══ RANGLAR BU FAYLDA YO'Q ═══
 * `--c-primary` kabi o'zgaruvchilar sahifa `<style>` iga INLINE
 * quyiladi (`PanelTheme::cssVariables()`), chunki ular MIJOZGA XOS va
 * tez o'zgaradi. Bu fayl esa hammaga bir xil va bir yil keshlanadi.
 *
 * Ya'ni bu fayl faqat `var(--c-*)` ga MUROJAAT qiladi, qiymat bermaydi.
 *
 * ═══ TEMA BUNI QANDAY O'ZGARTIRADI ═══
 * `themes/{slug}/theme.css` shu fayldan KEYIN qo'shiladi, ya'ni oddiy
 * CSS ustuvorligi bilan ustiga yozadi. Tema butun faylni ko'chirib
 * olmasligi kerak — faqat farqni yozadi.
 */

/* ── Neytral o'zgaruvchilar ─────────────────────────────────────────
   Bular RANG SLOTLARI emas — ular interfeys karkasi (fon, chegara,
   matn). Tema ularni `theme.css` da bosib o'tishi mumkin.
   ------------------------------------------------------------------- */
:root {
    --bg: #f4f5fa;
    --panel: #ffffff;
    --text: #171a21;
    --muted: #5f6875;
    --border: #dfe3ea;
    --input-bg: #ffffff;
    --shadow: 0 1px 2px rgba(16, 24, 40, .06);
    --radius: 10px;
    --side-width: 244px;
    --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}

html[data-mode="dark"] {
    --bg: #0d1017;
    --panel: #151922;
    --text: #e9ebf1;
    --muted: #98a1b0;
    --border: #262c38;
    --input-bg: #0f131b;
    --shadow: none;
}

/*
 * `system` rejimi brauzer sozlamasiga ergashadi.
 *
 * NIMA UCHUN ALOHIDA BLOK: `data-mode="dark"` ni MAJBURAN tanlagan
 * mijoz brauzeri yorug' rejimda bo'lsa ham to'q ko'rishi kerak.
 * Faqat media so'rovi bo'lsa, uning tanlovi e'tiborsiz qolardi.
 */
@media (prefers-color-scheme: dark) {
    html[data-mode="system"] {
        --bg: #0d1017;
        --panel: #151922;
        --text: #e9ebf1;
        --muted: #98a1b0;
        --border: #262c38;
        --input-bg: #0f131b;
        --shadow: none;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.55 var(--font-body);
}

a { color: var(--c-primary); }

/* Fokus KO'RINADI — `outline: none` ataylab yozilmagan: klaviatura
   bilan ishlaydigan foydalanuvchi qayerda turganini bilishi kerak. */
:focus-visible { outline: 3px solid var(--c-primary); outline-offset: 2px; }

/* ── Karkas ─────────────────────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }

.side {
    width: var(--side-width);
    flex: 0 0 var(--side-width);
    background: var(--panel);
    border-inline-end: 1px solid var(--border);
    padding: 18px 12px 90px;
    position: sticky;
    top: 0;
    align-self: flex-start;
    max-height: 100vh;
    overflow-y: auto;
}

.main { flex: 1; min-width: 0; padding: 18px; }

@media (max-width: 900px) {
    .side { display: none; }
    .main { padding: 12px 12px 84px; }
}

.brand {
    display: flex; align-items: center; gap: 8px;
    font-size: 17px; font-weight: 700; margin: 0 8px 16px;
    color: var(--text); text-decoration: none;
}

.brand-dot {
    width: 22px; height: 22px; border-radius: 7px;
    background: linear-gradient(135deg, var(--c-primary), var(--c-secondary));
}

.brand-logo { height: 26px; width: auto; border-radius: 6px; }

.nav-group { margin-bottom: 14px; }

.nav-title {
    font-size: 11px; font-weight: 700; letter-spacing: .06em;
    text-transform: uppercase; color: var(--muted);
    margin: 0 10px 6px;
}

.nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: 8px;
    color: var(--text); text-decoration: none; font-size: 14px;
}

.nav-link:hover { background: color-mix(in srgb, var(--c-primary) 8%, transparent); }

.nav-link[aria-current="page"] {
    background: color-mix(in srgb, var(--c-primary) 14%, transparent);
    color: var(--c-primary); font-weight: 600;
}

.nav-link svg { flex: 0 0 18px; }

/* ── Yuqori qator ───────────────────────────────────────────────── */
.topbar {
    display: flex; align-items: center; gap: 10px;
    flex-wrap: wrap; margin-bottom: 16px;
}

.topbar h1 { font-size: 20px; margin: 0; flex: 1; min-width: 160px; }

.balance {
    display: inline-flex; align-items: baseline; gap: 6px;
    background: var(--panel); border: 1px solid var(--border);
    border-radius: 999px; padding: 6px 14px; box-shadow: var(--shadow);
    font-weight: 700;
}

.balance small { font-weight: 500; color: var(--muted); }

/* ── Kartalar ───────────────────────────────────────────────────── */
.card {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px;
    box-shadow: var(--shadow); margin-bottom: 16px;
}

.card h2 { font-size: 15px; margin: 0 0 12px; }
.card h3 { font-size: 14px; margin: 16px 0 8px; }
.card h3:first-of-type { margin-top: 0; }

.grid { display: grid; gap: 12px; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

.stat {
    padding: 14px; border-radius: var(--radius); background: var(--panel);
    border: 1px solid var(--border); box-shadow: var(--shadow);
}

.stat-label { font-size: 12px; color: var(--muted); margin: 0 0 4px; }
.stat-value { font-size: 22px; font-weight: 700; margin: 0; }

/* ── Formalar ───────────────────────────────────────────────────── */
.field { margin-bottom: 14px; }

label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }

input, select, textarea {
    width: 100%; padding: 9px 11px; font-size: 14px; font-family: inherit;
    color: var(--text); background: var(--input-bg);
    border: 1px solid var(--border); border-radius: 8px;
}

textarea { min-height: 110px; resize: vertical; }

.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.err { font-size: 12px; color: var(--c-danger); margin-top: 4px; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 9px 16px; font-size: 14px; font-weight: 600; font-family: inherit;
    color: #fff; background: var(--c-primary);
    border: 0; border-radius: 8px; cursor: pointer; text-decoration: none;
}

.btn:hover { filter: brightness(.92); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: var(--c-danger); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; }

/* ── Xabarlar ───────────────────────────────────────────────────── */
.alert { padding: 10px 12px; border-radius: 8px; font-size: 14px; margin-bottom: 14px; }
.alert-ok { background: color-mix(in srgb, var(--c-success) 14%, transparent); color: var(--c-success); }
.alert-err { background: color-mix(in srgb, var(--c-danger) 14%, transparent); color: var(--c-danger); }
.alert-info { background: color-mix(in srgb, var(--c-secondary) 14%, transparent); color: var(--c-secondary); }

/* ── Jadval ─────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }

th, td { padding: 9px 10px; text-align: start; border-bottom: 1px solid var(--border); }

th {
    font-size: 12px; color: var(--muted); font-weight: 700;
    text-transform: uppercase; letter-spacing: .04em;
}

tbody tr:last-child td { border-bottom: 0; }

.badge {
    display: inline-block; padding: 2px 9px; border-radius: 999px;
    font-size: 12px; font-weight: 600;
}

.badge-gray { background: color-mix(in srgb, var(--muted) 16%, transparent); color: var(--muted); }
.badge-info { background: color-mix(in srgb, var(--c-secondary) 16%, transparent); color: var(--c-secondary); }
.badge-success { background: color-mix(in srgb, var(--c-success) 16%, transparent); color: var(--c-success); }
.badge-warning { background: color-mix(in srgb, var(--c-warning) 18%, transparent); color: var(--c-warning); }
.badge-danger { background: color-mix(in srgb, var(--c-danger) 16%, transparent); color: var(--c-danger); }

.progress { height: 5px; border-radius: 999px; background: var(--border); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--c-primary); }

/* ── Mobil menyu ────────────────────────────────────────────────── */
.tabbar {
    display: none; position: fixed; inset-inline: 0; bottom: 0; z-index: 20;
    background: var(--panel); border-top: 1px solid var(--border);
    padding: 6px 4px; justify-content: space-around;
}

@media (max-width: 900px) { .tabbar { display: flex; } }

.tabbar a {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    font-size: 10px; color: var(--muted); text-decoration: none; padding: 4px 6px;
}

.tabbar a[aria-current="page"] { color: var(--c-primary); }

/* ── Yordamchilar ───────────────────────────────────────────────── */
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.inline-form { display: inline; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.mono { font-family: var(--font-mono); font-size: 13px; }

/* ── Kod (API hujjati) ──────────────────────────────────────────────
   `overflow-x: auto` va satr SINDIRILMAYDI: sindirilsa nusxa olingan
   namuna BUZILADI — masalan `'https://t.me/kanalim'` ikki qatorga
   bo'linib, reseller uni qo'lda to'g'rilashga majbur bo'lardi.
   ------------------------------------------------------------------- */
pre.code {
    margin: 0 0 14px;
    padding: 12px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 12.5px;
    line-height: 1.55;
    tab-size: 4;
}

pre.code code { background: none; padding: 0; font-size: inherit; }

code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    padding: 1px 5px;
    border-radius: 4px;
    background: color-mix(in srgb, var(--c-primary) 10%, transparent);
}

/* Ekran o'quvchilar uchun — ko'rinmaydi, lekin O'QILADI. */
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ── OMMAVIY SAYT (Faza 11) ─────────────────────────────────────────
   ═══ NIMA UCHUN AYNI FAYLDA, ALOHIDA MARSHRUT EMAS ═══
   Ikkinchi uslub marshruti (`/assets/site.css`) qo'shilsa:
     - yana bitta versiyalash, ETag va kesh boshqaruvi kerak bo'lardi
     - tema ustiga yozishi ikki faylga bo'linardi va admin qaysi
       biriga yozishini bilmasdi
     - panel va sayt BIR XIL o'zgaruvchilarni ishlatadi, ya'ni
       ajratish sun'iy bo'lardi

   Narxi: panel ham bu ~3 KB ni yuklaydi. Lekin fayl bir yil
   keshlanadi (`?v=<hash>`), ya'ni bu AMALDA bir marta sodir bo'ladi.

   Sinf nomlari `site-` prefiksi bilan: panel sinflari bilan
   to'qnashmasligi uchun.
   ------------------------------------------------------------------- */

body.site {
    display: block;
    background: var(--bg);
}

.site-wrap {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding-inline: 20px;
}

/* ── Sarlavha qatori ────────────────────────────────────────────── */
.site-head {
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 30;
}

.site-head-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 62px;
    flex-wrap: wrap;
}

.site-brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
}

.site-logo { height: 28px; width: auto; }

.site-nav {
    display: flex;
    align-items: center;
    gap: 18px;
    flex: 1;
    flex-wrap: wrap;
}

.site-nav a {
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
}

.site-nav a:hover { color: var(--c-primary); }

.site-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.site-langs { display: flex; gap: 8px; }

.site-langs a {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
    text-transform: uppercase;
}

/* Joriy til AJRALIB turishi kerak: mijoz qaysi tilda ekanini
   bilmasa til tugmalarini tasodifiy bosadi. */
.site-langs a[aria-current="true"] { color: var(--c-primary); }

/* ── Asosiy qism ────────────────────────────────────────────────── */
.site-main { padding-block: 32px 56px; }

/* ── Qahramon bo'lak (landing) ──────────────────────────────────── */
.site-hero { padding-block: 48px 32px; text-align: center; }

.site-hero h1 {
    font-size: clamp(26px, 5vw, 42px);
    line-height: 1.2;
    margin: 0 0 14px;
}

.site-hero p {
    font-size: clamp(15px, 2.4vw, 18px);
    color: var(--muted);
    max-width: 620px;
    margin: 0 auto 22px;
}

.site-hero-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ── Kartalar to'ri ─────────────────────────────────────────────── */
.site-cards {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.site-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
}

.site-card h3 { margin: 0 0 6px; font-size: 15px; }
.site-card p { margin: 0; font-size: 14px; color: var(--muted); }

.site-card-link { text-decoration: none; color: inherit; display: block; }
.site-card-link:hover { border-color: var(--c-primary); }

/* ── Bo'lim sarlavhasi ──────────────────────────────────────────── */
.site-section { margin-top: 44px; }
.site-section > h2 { font-size: 20px; margin: 0 0 6px; }
.site-section > .site-section-lead { color: var(--muted); margin: 0 0 18px; font-size: 14px; }

/* ── Maqola matni ───────────────────────────────────────────────── */
.prose { max-width: 720px; font-size: 16px; line-height: 1.7; }
.prose h2 { font-size: 21px; margin: 32px 0 10px; }
.prose h3 { font-size: 17px; margin: 24px 0 8px; }
.prose p { margin: 0 0 14px; }
.prose ul, .prose ol { margin: 0 0 14px; padding-inline-start: 22px; }
.prose li { margin-bottom: 6px; }
.prose a { color: var(--c-primary); }
.prose img { max-width: 100%; height: auto; border-radius: var(--radius); }

.prose blockquote {
    margin: 0 0 14px;
    padding-inline-start: 14px;
    border-inline-start: 3px solid var(--border);
    color: var(--muted);
}

/* `pre` da satr SINDIRILMAYDI: nusxa olingan kod namunasi buziladi
   (`base.css` dagi API hujjati bo'limi bilan bir xil sabab). */
.prose pre {
    overflow-x: auto;
    padding: 12px;
    border-radius: var(--radius);
    background: var(--bg);
    border: 1px solid var(--border);
    font-size: 13px;
}

/* ── Blog ro'yxati ──────────────────────────────────────────────── */
.site-posts { display: grid; gap: 16px; }

.site-post {
    display: flex;
    gap: 14px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
}

.site-post-cover {
    flex: 0 0 140px;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    border-radius: var(--radius);
}

.site-post h2 { font-size: 17px; margin: 0 0 6px; }
.site-post h2 a { color: var(--text); text-decoration: none; }
.site-post h2 a:hover { color: var(--c-primary); }
.site-post-meta { font-size: 12px; color: var(--muted); margin: 0 0 6px; }
.site-post p { margin: 0; font-size: 14px; color: var(--muted); }

/* ── FAQ (akkordeon) ────────────────────────────────────────────── */
.site-faq { display: grid; gap: 10px; }

/* `<details>` ATAYLAB: JavaScript kerak emas, klaviatura bilan
   ishlaydi va ekran o'quvchi holatni o'zi aytadi. */
.site-faq details {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
}

.site-faq summary {
    font-weight: 600;
    cursor: pointer;
    font-size: 15px;
}

.site-faq details[open] summary { color: var(--c-primary); margin-bottom: 8px; }
.site-faq p { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.65; }

/* ── Nishonlar ro'yxati ─────────────────────────────────────────── */
.site-chips { display: flex; flex-wrap: wrap; gap: 8px; }

.site-chip {
    display: inline-block;
    padding: 5px 11px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--panel);
    font-size: 13px;
    color: var(--text);
    text-decoration: none;
}

.site-chip:hover { border-color: var(--c-primary); color: var(--c-primary); }

/* ── Futer ──────────────────────────────────────────────────────── */
.site-foot {
    background: var(--panel);
    border-top: 1px solid var(--border);
    padding-block: 32px 20px;
    margin-top: 40px;
}

.site-foot-cols {
    display: grid;
    gap: 24px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.site-foot-brand { font-weight: 700; margin: 0 0 6px; }
.site-foot-title { font-weight: 600; font-size: 13px; margin: 0 0 8px; }

.site-foot-cols a {
    display: block;
    font-size: 14px;
    color: var(--muted);
    text-decoration: none;
    margin-bottom: 6px;
}

.site-foot-cols a:hover { color: var(--c-primary); }

.site-copy {
    margin: 26px 0 0;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    font-size: 13px;
}

/* ── Sahifalash ────────────────────────────────────────────────── */
.site-pager { margin-top: 26px; }

/* ── Mobil ──────────────────────────────────────────────────────── */
@media (max-width: 720px) {
    .site-head-inner { min-height: 56px; padding-block: 10px; }
    .site-nav { order: 3; width: 100%; gap: 14px; }
    .site-post { flex-direction: column; }
    .site-post-cover { flex: none; width: 100%; }
}


/* ── tema: aurora ── */
/*
 * AURORA — standart tema.
 *
 * ═══ NIMA UCHUN BU FAYL QISQA ═══
 * Aurora poydevor uslubning O'ZI: `resources/theme/base.css` aynan shu
 * temaga qarab yozilgan. Shuning uchun bu yerda faqat temaga XOS
 * qo'shimchalar bor.
 *
 * Butun poydevorni bu yerga KO'CHIRISH mumkin edi, lekin aynan shu
 * `docs/05-tema-tizimi.md` boshida ogohlantirilgan xato: eski skriptda
 * 30+ tema bor edi va har biri mustaqil ko'chirma edi — bitta xatoni
 * tuzatish uchun 30 joyni tahrirlash kerak bo'lardi.
 */

/* Brend belgisidagi gradient — Aurora ning imzosi. */
.brand-dot {
    background: linear-gradient(135deg, var(--c-primary), var(--c-secondary));
    box-shadow: 0 2px 8px color-mix(in srgb, var(--c-primary) 35%, transparent);
}

/* Asosiy tugmada yengil gradient: yorqin temada tekis rang "yassi"
   ko'rinadi. */
.btn:not(.btn-ghost):not(.btn-danger) {
    background: linear-gradient(135deg, var(--c-primary), color-mix(in srgb, var(--c-primary) 70%, var(--c-secondary)));
}

/* Statistika kartalari yuqori chetida rangli chiziq. */
.stat {
    position: relative;
    overflow: hidden;
}

.stat::before {
    content: '';
    position: absolute;
    inset-block-start: 0;
    inset-inline: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--c-primary), var(--c-secondary), var(--c-accent));
}
