/* ==========================================================================
   assets/theme.css — Мавзӯи ранг: «Система» / «Равшан» / «Торик».
   Атрибути <html data-theme="light|dark"> аз скрипти inc/layout_top.php
   гузошта мешавад (пеш аз намоиши саҳифа — бе «дурахш»).
   Мавзӯи равшан — рангҳои аслӣ; ин файл танҳо мавзӯи торикро муайян мекунад.
   ========================================================================== */

/* ---------- Интихобгари ранг (дар меню ва панели боло) ---------- */
.fz-theme-switch {
    display: flex; gap: 4px; margin: 4px 18px 8px; padding: 4px; border-radius: 12px;
    background: var(--highlight); border: 1px solid var(--border);
}
.fz-theme-switch button {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 7px 4px; border: none; border-radius: 9px; background: transparent; cursor: pointer;
    color: var(--text-light); font: inherit; font-size: .7rem; font-weight: 600; transition: background .18s, color .18s, box-shadow .18s;
}
.fz-theme-switch button i { font-size: .9rem; }
.fz-theme-switch button:hover { color: var(--text); }
.fz-theme-switch button[aria-pressed="true"] {
    background: var(--card-bg); color: var(--primary); box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
}

.fz-theme-menu { position: relative; }
.fz-theme-pop {
    position: absolute; right: 0; top: calc(100% + 10px); z-index: 900; min-width: 210px; padding: 6px;
    background: var(--card-bg); border: 1px solid var(--border); border-radius: 14px;
    box-shadow: 0 18px 44px -12px rgba(0, 0, 0, .35); display: none;
}
.fz-theme-menu.open .fz-theme-pop { display: block; animation: fzPop .16s ease-out; }
@keyframes fzPop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.fz-theme-pop button {
    width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: none; border-radius: 10px;
    background: transparent; color: var(--text); font: inherit; font-size: .88rem; font-weight: 550; cursor: pointer; text-align: left;
}
.fz-theme-pop button i:first-child { width: 18px; text-align: center; color: var(--text-light); }
.fz-theme-pop button .chk { margin-left: auto; color: var(--primary); visibility: hidden; }
.fz-theme-pop button:hover { background: var(--highlight); }
.fz-theme-pop button[aria-pressed="true"] { color: var(--primary); font-weight: 700; }
.fz-theme-pop button[aria-pressed="true"] i:first-child, .fz-theme-pop button[aria-pressed="true"] .chk { color: var(--primary); visibility: visible; }

/* ======================================================================
   МАВЗӮИ ТОРИК
   ====================================================================== */
html[data-theme="dark"] {
    color-scheme: dark;
    /* Тағйирёбандаҳои умумии сайт */
    --primary: #2f9e53; --secondary: #237a3f; --primary-light: #4ade80;
    --text: #e6ede8; --text-light: #9aaaa1; --border: #25342b; --bg: #0a110d; --card-bg: #121b16;
    --highlight: #17281d; --danger: #f05252;
    --shadow: 0 2px 10px rgba(0, 0, 0, .35); --shadow-lg: 0 10px 30px rgba(0, 0, 0, .55);
    /* Тағйирёбандаҳои тарҳи компютер (assets/desktop.css) */
    --d-ink: #e8efea; --d-ink-2: #a6b5ac; --d-ink-3: #74857b;
    --d-line: #1f2d25; --d-line-2: #2e4035; --d-bg: #080e0a; --d-card: #101914;
    --d-soft: #19251e; --d-hover: #142019; --d-input: #0c140f;
    --d-glass: rgba(8, 14, 10, .78); --d-solid: #16a34a; --d-solid-hover: #22c55e; --d-scroll: #2c3d33;
    --d-sh-1: 0 1px 2px rgba(0, 0, 0, .45);
    --d-sh-2: 0 14px 32px -12px rgba(0, 0, 0, .75);
    --d-sh-3: 0 24px 60px -20px rgba(0, 0, 0, .85);
    --sb-bg:
        radial-gradient(420px 260px at -80px -40px, rgba(74, 222, 128, .14), transparent 70%),
        radial-gradient(300px 300px at 120% 105%, rgba(22, 163, 74, .12), transparent 70%),
        linear-gradient(180deg, #0e2116, #07120b);
    --sb-head: rgba(13, 30, 20, .92); --sb-edge: 1px 0 0 rgba(255, 255, 255, .05), 12px 0 40px -20px rgba(0, 0, 0, .6);
    --sb-fg: rgba(255, 255, 255, .74); --sb-fg-strong: #fff; --sb-icon: rgba(255, 255, 255, .5); --sb-label: rgba(255, 255, 255, .34);
    --sb-hover: rgba(255, 255, 255, .06); --sb-card: rgba(255, 255, 255, .05); --sb-card-line: rgba(255, 255, 255, .08); --sb-line: rgba(255, 255, 255, .08);
    --sb-active-bg: linear-gradient(90deg, rgba(74, 222, 128, .18), rgba(74, 222, 128, .04)); --sb-active-fg: #fff; --sb-accent: #4ade80;
    --hero-bg:
        radial-gradient(500px 200px at 85% -30%, rgba(74, 222, 128, .32), transparent 70%),
        radial-gradient(400px 220px at 10% 140%, rgba(22, 163, 74, .32), transparent 70%),
        linear-gradient(120deg, #0e2116, #0f3a20 60%, #14532d);
    --comp-bg: linear-gradient(90deg, #0e2116, #133a22);
    --ft-bg: linear-gradient(180deg, #0c1a12, #060d09); --ft-fg: rgba(255, 255, 255, .62); --ft-strong: #fff; --ft-line: rgba(255, 255, 255, .07);
}
html[data-theme="dark"] body { background-color: var(--bg); color: var(--text); }
html[data-theme="dark"] img { color-scheme: normal; }

/* ---------- Қисмҳои умумии layout (телефон; компютер — assets/desktop.css) ---------- */
@media (max-width: 1023px) {
    html[data-theme="dark"] .app-bar,
    html[data-theme="dark"] .header,
    html[data-theme="dark"] .nav-drawer-header { background: linear-gradient(120deg, #0f2a19, #14401f 75%); }
    html[data-theme="dark"] .nav-drawer { background: #0e1712; box-shadow: 6px 0 30px rgba(0, 0, 0, .6); }
    html[data-theme="dark"] .nav-drawer-item i { color: var(--primary-light); }
    html[data-theme="dark"] .nav-drawer-item.active { color: var(--primary-light); }
    html[data-theme="dark"] .bottom-nav { background: #0e1712; box-shadow: 0 -1px 0 var(--border), 0 -8px 24px rgba(0, 0, 0, .4); }
    html[data-theme="dark"] .nav-item.active { color: var(--primary-light); }
}
html[data-theme="dark"] .btn-outline { background: var(--card-bg); color: var(--text); }
html[data-theme="dark"] .alert-error { background: rgba(240, 82, 82, .14); color: #fca5a5; }
html[data-theme="dark"] .alert-success { background: rgba(74, 222, 128, .12); color: #86efac; border-left-color: #4ade80; }
html[data-theme="dark"] .section-link,
html[data-theme="dark"] a.section-link { color: var(--primary-light); }

/* Майдонҳои ворид (танҳо онҳое, ки заминаи худро надоранд) */
:where(html[data-theme="dark"]) :where(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]), textarea, select) {
    background-color: #0d1611; color: var(--text); border-color: var(--border);
}
html[data-theme="dark"] ::placeholder { color: #6f8077; }

/* ---------- Қисмҳои саҳифаҳо, ки заминаи сафеди сахт доранд ---------- */
html[data-theme="dark"] :is(
    .section, .search-section, .about-section, .comp-matches, .competition-matches, .events-container,
    .match-info-card, .scorers-container, .standings-container, .no-scorers, .no-standings, .legend,
    .st-card, .wc-group, .wc-pos, .video-card, .filter-sheet, .filter-btn, .date-display-wrap,
    .extra-leagues-btn, .tabs, .leagues-search input, .competition-header, .swiper-slide,
    .date-tab, .nav-link-tab, .tab-btn2, .tj-tab-btn, .cat-pill
):not(.active):not(.selected) { background-color: var(--card-bg); }
html[data-theme="dark"] :is(.coach-photo, .event-player-photo, .lineup-photo, .ma-bar, .pitch-photo) { background-color: var(--border); }
html[data-theme="dark"] .competition-header:not([style]) { color: var(--text); }
html[data-theme="dark"] :is(.ma-teams, .ma-xg-row) .h { color: var(--primary-light); }

/* Бозиҳои зинда (matches.php, live.php) */
html[data-theme="dark"] .match-item-live,
html[data-theme="dark"] .match-item.live { background: linear-gradient(135deg, rgba(239, 68, 68, .14), rgba(239, 68, 68, .05)); }

/* Чат */
html[data-theme="dark"] .ch-row.me .ch-bub { background: #1d4a2b; color: #eafbe9; }
html[data-theme="dark"] .ch-rc.mine { background: #1e3a5f; color: #cfe3ff; }

/* Огоҳиҳои ранга (чипҳо) — каме хиратар */
html[data-theme="dark"] :is(.badge-published, .badge-draft, .ad-own, .qa-today, .pe-warn, .da-warn, .pill-force, .pill-opt, .rp-cnt,
    .af-st-done, .af-st-new, .af-st-read, .fb-st-done, .fb-st-new, .fb-st-read) { filter: brightness(.9) saturate(.9); }
html[data-theme="dark"] .qz-opt.ok { background: rgba(74, 222, 128, .16); color: #86efac; }
html[data-theme="dark"] .qz-opt.bad { background: rgba(240, 82, 82, .16); color: #fca5a5; }

/* Унсурҳое, ки сафеди сахтро дар атрибути style доранд */
html[data-theme="dark"] [style*="background:#fff;"], html[data-theme="dark"] [style*="background: #fff;"],
html[data-theme="dark"] [style*="background:white"], html[data-theme="dark"] [style*="background: white"],
html[data-theme="dark"] [style*="background:#ffffff"], html[data-theme="dark"] [style*="background-color:#fff"] {
    background-color: var(--card-bg) !important;
}
html[data-theme="dark"] :is([style*=";color:#1b5e20"], [style^="color:#1b5e20"], [style*=";color:#1B5E20"], [style^="color:#1B5E20"]) { color: var(--primary-light) !important; }

/* Ҷадвалҳо */
html[data-theme="dark"] table { color: var(--text); }
html[data-theme="dark"] :is(th, td) { border-color: var(--border); }

/* Тасвирҳои логотипҳо: заминаи сафеди хурд нигоҳ дошта мешавад, то логоҳои торик намоён бошанд */
html[data-theme="dark"] .league-item img { background: #f1f5f2; }

/* Баннери «Барнома» ва дастури iPhone */
html[data-theme="dark"] #fzIosModal > div { background: var(--card-bg) !important; color: var(--text) !important; }

/* Мундариҷаи хабар/видео (матни аз редактор омада) */
html[data-theme="dark"] :is(.news-body, .article-content, .content-body) [style*="color"] { color: inherit !important; }
html[data-theme="dark"] :is(.news-body, .article-content, .content-body) [style*="background"] { background: transparent !important; }

@media (prefers-reduced-motion: reduce) {
    .fz-theme-menu.open .fz-theme-pop { animation: none; }
}
