/* ============================================================
   Sahifalar: katalog, mahsulot, matnli sahifalar
   ============================================================ */

.sec-alt {
    background: var(--bg-alt);
}

/* Katalog va mahsulot sahifalarida tepadagi bo'shliq kichikroq —
   bosh sahifadagi keng nafas bu yerda ortiqcha. */
.section.page-top {
    padding-top: clamp(20px, 2.4vw, 32px);
}

/* --- Nonushta izlari --- */

.crumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 18px;
    font-size: 13.5px;
    color: var(--text-dim);
}

.crumbs a:hover {
    color: var(--red);
}

.crumbs span {
    color: var(--text-faint);
}

/* --- Katalog --- */

.catalog-head {
    margin-bottom: 24px;
}

.catalog-head p {
    margin: 8px 0 0;
}

.catalog-layout {
    display: grid;
    grid-template-columns: 264px 1fr;
    gap: 32px;
    align-items: start;
}

.filters {
    position: sticky;
    top: calc(var(--header-h) + 16px);
    display: grid;
    gap: 4px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    max-height: calc(100vh - var(--header-h) - 40px);
    overflow-y: auto;
    overflow-x: hidden;
}

.filters-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.filter-close {
    display: none;
}

.filter-group {
    padding: 16px 0;
    border-top: 1px solid var(--line);
}

.filter-group:first-of-type {
    border-top: 0;
    padding-top: 4px;
}

.filter-group h4 {
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-faint);
}

.filter-list {
    display: grid;
    gap: 2px;
    max-height: 262px;
    overflow-y: auto;
    /* Uzun nomlar ro'yxatni gorizontal skrollga majburlamasin —
       ular "..." bilan qisqaradi (`.check span` da) */
    overflow-x: hidden;
    /* Skroll chizig'i o'ng chetdagi sonni to'sib qo'ymasin */
    padding-right: 6px;
}

/* Ingichka, ko'zga urilmaydigan skroll chizig'i.
   Standart chiziq qorong'u mavzuda oq bo'lib ajralib turardi. */
.filters,
.filter-list {
    scrollbar-width: thin;
    scrollbar-color: var(--line-strong) transparent;
}

.filters::-webkit-scrollbar,
.filter-list::-webkit-scrollbar {
    width: 8px;
}

.filters::-webkit-scrollbar-track,
.filter-list::-webkit-scrollbar-track {
    background: transparent;
}

.filters::-webkit-scrollbar-thumb,
.filter-list::-webkit-scrollbar-thumb {
    border-radius: var(--r-pill);
    background: var(--line-strong);
}

.filters::-webkit-scrollbar-thumb:hover,
.filter-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-faint);
}

.check {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 8px;
    margin: 0 -8px;
    border-radius: var(--r-xs);
    font-size: 14px;
    cursor: pointer;
    transition: background-color var(--fast) var(--ease);
}

.check:hover {
    background: var(--surface-2);
}

.check input {
    width: 17px;
    height: 17px;
    flex: none;
    accent-color: var(--red);
    cursor: pointer;
}

.check span {
    flex: 1;
    min-width: 0;
    /* "Pishiriq va bezak to'plamlari" kabi uzun bo'lim nomlari
       panelni kengaytirib yubormasin */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.check em {
    font-style: normal;
    font-size: 12px;
    color: var(--text-faint);
}

.price-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.price-row .input {
    padding: 9px 11px;
    font-size: 14px;
    min-width: 0;
}

/* --- Asboblar qatori --- */

.catalog-main {
    min-width: 0;
}

.chip-line {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.toolbar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.filter-toggle {
    display: none;
}

.sort {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    font-size: 14px;
}

.sort select {
    padding: 9px 14px;
    border-radius: var(--r-pill);
    font-size: 14px;
    cursor: pointer;
}

.more {
    display: grid;
    place-items: center;
    margin-top: 32px;
}

mark {
    background: var(--red-wash);
    color: var(--red);
    font-weight: 650;
    border-radius: 3px;
    padding: 0 2px;
}

/* --- Mahsulot sahifasi --- */

.product-layout {
    display: grid;
    grid-template-columns: minmax(0, 460px) minmax(0, 1fr);
    gap: clamp(24px, 4vw, 56px);
    align-items: start;
    margin-bottom: clamp(40px, 6vw, 72px);
}

.product-media {
    position: relative;
    display: grid;
    place-items: center;
    aspect-ratio: 1;
    border-radius: var(--r-xl);
    background:
        radial-gradient(110% 90% at 50% 0%, var(--red-wash), transparent 70%),
        var(--surface-2);
    color: var(--red);
}

.product-info h1 {
    margin: 8px 0 12px;
}

.product-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 13.5px;
    color: var(--text-dim);
    margin-bottom: 22px;
}

/* Yashil #17a34a oq fonda 3.3:1 — kichik matn uchun yetarli emas.
   Loyihaning geo-status.ok da ishlatilgan #12794a (5.4:1) bilan birxil. */
.product-meta .ok {
    color: #12794a;
    font-weight: 600;
}

.product-meta .no {
    color: var(--red);
    font-weight: 600;
}

/* Qoldig'i ozayib qolgan tovar — yashil ham, qizil ham emas:
   olish mumkin, lekin shoshilish kerak. */
.product-meta .low {
    color: #b45309;
    font-weight: 600;
}

:root[data-theme="dark"] .product-meta .ok {
    color: #34d17d;
}

/* Qorong'i mavzuda #b45309 fon bilan qorishib ketardi (3.9:1) */
:root[data-theme="dark"] .product-meta .low {
    color: #fbbf24;
}

.product-price {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
    padding: 20px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.product-price b {
    font-size: clamp(1.9rem, 3.4vw, 2.6rem);
    font-weight: 800;
    letter-spacing: -.035em;
    line-height: 1;
}

.product-price s {
    font-size: 18px;
    color: var(--text-faint);
}

.product-buy {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin: 24px 0;
}

.product-buy .qty {
    padding: 5px;
}

.product-buy .qty button {
    width: 38px;
    height: 38px;
}

.product-buy .btn.on {
    border-color: var(--red);
    color: var(--red);
}

.product-buy .btn.on svg {
    fill: currentColor;
}

.specs {
    display: grid;
    grid-template-columns: minmax(120px, auto) 1fr;
    gap: 0;
    margin: 0;
    font-size: 14.5px;
}

.specs dt {
    padding: 11px 0;
    border-top: 1px solid var(--line);
    color: var(--text-dim);
}

.specs dd {
    margin: 0;
    padding: 11px 0;
    border-top: 1px solid var(--line);
    font-weight: 550;
}

/* --- Matnli sahifalar --- */

.prose {
    max-width: 76ch;
}

.prose h1 {
    margin: 14px 0 24px;
}

.prose h2 {
    margin: 36px 0 12px;
}

.prose p {
    margin: 0 0 16px;
    color: var(--text-dim);
    line-height: 1.72;
}

/* --- Moslashuvchanlik --- */

@media (max-width: 1080px) {
    .catalog-layout {
        grid-template-columns: 1fr;
    }

    .filter-toggle {
        display: inline-flex;
    }

    .filter-close {
        display: grid;
    }

    .filters {
        position: fixed;
        inset: 0;
        z-index: 80;
        max-height: none;
        border: 0;
        border-radius: 0;
        transform: translateX(-100%);
        /* visibility ham o'tishda qatnashadi: yopiq panel Tab tartibidan
           va ekran o'quvchidan chiqadi. Aks holda klaviatura fokusiy
           ekran tashqarisidagi o'nlab katakchalarga "g'oyib bo'lardi". */
        visibility: hidden;
        transition: transform var(--mid) var(--ease-out),
            visibility 0s var(--mid);
    }

    .filters.open {
        transform: none;
        visibility: visible;
        transition: transform var(--mid) var(--ease-out);
    }

    .product-layout {
        grid-template-columns: 1fr;
    }

    .product-media {
        max-width: 420px;
    }
}

@media (max-width: 620px) {
    .toolbar-row {
        flex-wrap: wrap;
        gap: 10px;
    }

    .sort {
        width: 100%;
        margin-left: 0;
    }

    .sort select {
        flex: 1;
    }

    .specs {
        grid-template-columns: 1fr;
    }

    .specs dt {
        padding-bottom: 0;
        border-top: 1px solid var(--line);
    }

    .specs dd {
        border-top: 0;
        padding-top: 2px;
    }
}

/* Mahsulot sahifasidagi yorliq — katalog kartasidan kattaroq */
.product-label b {
    font-size: clamp(26px, 3.4vw, 40px);
}

.product-label em {
    font-size: 13px;
    padding: 5px 13px;
}

.product-label .muted {
    font-size: 13px;
    letter-spacing: .04em;
}

/* Xato tuzatilgan qidiruv xabari */
.corrected-note {
    margin: 10px 0 0;
    padding: 10px 16px;
    border-radius: var(--r-sm);
    background: var(--red-wash);
    color: var(--text);
    font-size: 14.5px;
    display: inline-block;
}

.corrected-note b {
    color: var(--red);
}

.suggest-corrected {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 10px 14px;
    margin-bottom: 4px;
    border-radius: var(--r-sm);
    background: var(--red-wash);
    color: var(--text);
    font-size: 13px;
}

.suggest-corrected svg {
    color: var(--red);
}

.suggest-corrected b {
    color: var(--red);
}

.catalog-empty-state {
    grid-column: 1 / -1;
}
