/**
 * curly.sale — Página /descuentos/ Styles
 *
 * Использует Design System токены (colors_and_type.css).
 * Зависит от: cgm-discounts.css (загружается первым).
 * Реиспользует .fp-container из front-page.css.
 *
 * Upload to: /www/wwwroot/curly.sale/wp-content/themes/generatepress-child/assets/css/page-descuentos.css
 *
 * @version Design Sprint B (May 2026)
 */

/* ============================================================
   DESIGN TOKENS — inline fallback
   ============================================================ */
:root {
    /* Design System palette — sage → cream/coral (имена сохранены) */
    --dsc-sage:       #E8826B;   /* warm coral accent */
    --dsc-sage-hover: #D96A52;
    --dsc-mint:       #FBF8F4;   /* cream canvas */
    --dsc-white:      #FFFFFF;
    --dsc-charcoal:   #2B2622;   /* warm near-black */
    --dsc-slate:      #8A817A;   /* muted */
    --dsc-border:     #EDE6DD;   /* hairline */
    --dsc-amber:      #F59E0B;   /* caution — без изменений */
    --dsc-crimson:    #E8220A;   /* danger — без изменений */
    --dsc-violet:     #7C3AED;   /* без изменений */
    --dsc-max:        1200px;
    --dsc-radius:    16px;       /* cards (было 4px) */
    --dsc-motion:     200ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   SCROLLBAR COMPENSATION
   100vw включает scrollbar (~17px) → без этого .dsc-wrap сдвигается
   влево и обрезает контент. scrollbar-gutter: stable резервирует место.
   ============================================================ */
@supports (scrollbar-gutter: stable) {
    html { scrollbar-gutter: stable; }
}

/* ============================================================
   FP-CONTAINER
   Определено здесь т.к. front-page.css не подгружается на /descuentos/.
   Центрирует и ограничивает ширину контента внутри .dsc-wrap.
   ============================================================ */
.fp-container {
    max-width: var(--dsc-max, 1200px);
    margin-left: auto;
    margin-right: auto;
    padding-left: 16px;
    padding-right: 16px;
    box-sizing: border-box;
    width: 100%;
}

@media (min-width: 768px) {
    .fp-container {
        padding-left: 24px;
        padding-right: 24px;
    }
}

/* ============================================================
   FULL-WIDTH WRAP
   Аналогично .fp-wrap — escaping GeneratePress container
   ============================================================ */
.dsc-wrap {
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    width: 100vw;
    max-width: 100vw;
    overflow-x: hidden;
}

/* ============================================================
   HERO STRIP
   ============================================================ */
.dsc-hero {
    background: var(--bg-page, var(--dsc-mint));
    border-bottom: 1px solid var(--border, var(--dsc-border));
    padding: 32px 0 28px;
}

.dsc-hero__title {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 600;
    line-height: 1.2;
    color: var(--fg-1, var(--dsc-charcoal));
    margin: 0 0 8px;
}

.dsc-hero__meta {
    font-size: 0.9375rem;
    color: var(--fg-2, var(--dsc-slate));
    margin: 0;
    line-height: 1.5;
}

.dsc-hero__meta strong {
    color: var(--fg-1, var(--dsc-charcoal));
    font-weight: 600;
}

/* ============================================================
   TOOLBAR — sticky tabs + filters
   ============================================================ */
.dsc-toolbar {
    background: var(--dsc-white);
    border-bottom: 1px solid var(--border, var(--dsc-border));
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 0 var(--border, var(--dsc-border));
}

.dsc-toolbar__inner {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-top: 10px;
    padding-bottom: 10px;
    flex-wrap: wrap;
}

/* ── Tabs ──────────────────────────────────────────────────── */
.dsc-tabs {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.dsc-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius-md, var(--dsc-radius));
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 500;
    color: var(--fg-2, var(--dsc-slate));
    text-decoration: none;
    white-space: nowrap;
    transition: border-color var(--dsc-motion), background var(--dsc-motion), color var(--dsc-motion);
}

.dsc-tab:hover {
    border-color: var(--border, var(--dsc-border));
    color: var(--fg-1, var(--dsc-charcoal));
    text-decoration: none;
}

.dsc-tab--active {
    background: var(--brand, var(--dsc-sage));
    color: #fff !important;
    border-color: var(--brand, var(--dsc-sage));
}

.dsc-tab--active:hover {
    background: var(--brand-hover, var(--dsc-sage-hover));
    border-color: var(--brand-hover, var(--dsc-sage-hover));
}

.dsc-tab__badge {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 3px;
    line-height: 1.2;
    letter-spacing: 0.02em;
}

/* Когда таб неактивен — бейдж тоже серый */
.dsc-tab:not(.dsc-tab--active) .dsc-tab__badge {
    background: var(--border, var(--dsc-border));
    color: var(--fg-2, var(--dsc-slate));
}

/* ── Filters form ──────────────────────────────────────────── */
.dsc-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex-wrap: wrap;
}

.dsc-select {
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--border, var(--dsc-border));
    border-radius: var(--radius-md, var(--dsc-radius));
    background: var(--dsc-white);
    font-size: 13px;
    color: var(--fg-1, var(--dsc-charcoal));
    cursor: pointer;
    appearance: auto;
    font-family: inherit;
    transition: border-color var(--dsc-motion);
}

.dsc-select:hover {
    border-color: var(--brand, var(--dsc-sage));
}

.dsc-select:focus {
    outline: none;
    border-color: var(--brand, var(--dsc-sage));
    box-shadow: 0 0 0 2px rgba(232, 130, 107, 0.18);
}

.dsc-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 14px;
    background: var(--brand, var(--dsc-sage));
    color: #fff;
    border: none;
    border-radius: var(--radius-md, var(--dsc-radius));
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: filter var(--dsc-motion);
    font-family: inherit;
}

.dsc-filter-btn:hover {
    filter: brightness(0.92);
}

.dsc-filter-btn:active {
    transform: translateY(1px);
}

.dsc-filter-reset {
    font-size: 12px;
    color: var(--fg-2, var(--dsc-slate));
    text-decoration: none;
    white-space: nowrap;
    padding: 4px 8px;
    border-radius: var(--radius-sm, 2px);
    transition: color var(--dsc-motion), background var(--dsc-motion);
}

.dsc-filter-reset:hover {
    color: var(--fg-1, var(--dsc-charcoal));
    background: var(--border, var(--dsc-border));
    text-decoration: none;
}

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */
.dsc-main {
    padding: 24px 0 48px;
    background: var(--bg-page, var(--dsc-mint));
    min-height: 50vh;
}

/* Results info */
.dsc-results-info {
    font-size: 13px;
    color: var(--fg-2, var(--dsc-slate));
    margin: 0 0 16px;
    line-height: 1.5;
}

.dsc-results-info strong {
    color: var(--fg-1, var(--dsc-charcoal));
}

/* ── Grid — реиспользует .cgm-products-grid из cgm-discounts.css ── */
/* Дополнительный override для /descuentos/ — белый фон под карточками */
.dsc-main .cgm-discount-card {
    background: var(--dsc-white);
}

/* ============================================================
   PAGINATION
   ============================================================ */
.dsc-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 40px;
    padding-top: 8px;
    border-top: 1px solid var(--border, var(--dsc-border));
    flex-wrap: wrap;
}

.dsc-page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    border: 1px solid var(--border, var(--dsc-border));
    border-radius: var(--radius-md, var(--dsc-radius));
    font-size: 14px;
    font-weight: 500;
    color: var(--fg-1, var(--dsc-charcoal));
    text-decoration: none;
    background: var(--dsc-white);
    transition: border-color var(--dsc-motion), background var(--dsc-motion), color var(--dsc-motion);
    white-space: nowrap;
    gap: 4px;
}

.dsc-page:hover {
    border-color: var(--brand, var(--dsc-sage));
    color: var(--brand, var(--dsc-sage));
    text-decoration: none;
}

.dsc-page--active {
    background: var(--brand, var(--dsc-sage));
    border-color: var(--brand, var(--dsc-sage));
    color: #fff;
    cursor: default;
}

.dsc-page--active:hover {
    color: #fff;
}

.dsc-page--ellipsis {
    border-color: transparent;
    background: transparent;
    cursor: default;
    color: var(--fg-2, var(--dsc-slate));
}

.dsc-page--ellipsis:hover {
    border-color: transparent;
    background: transparent;
    color: var(--fg-2, var(--dsc-slate));
}

.dsc-page--prev,
.dsc-page--next {
    padding: 0 12px;
    font-weight: 500;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.dsc-empty {
    text-align: center;
    padding: 80px 16px 64px;
}

.dsc-empty__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    margin: 0 auto 20px;
    background: var(--dsc-white);
    border: 1px solid var(--border, var(--dsc-border));
    border-radius: 50%;
    color: var(--fg-2, var(--dsc-slate));
}

.dsc-empty__title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--fg-1, var(--dsc-charcoal));
    margin: 0 0 8px;
}

.dsc-empty__text {
    font-size: 0.9375rem;
    color: var(--fg-2, var(--dsc-slate));
    margin: 0 0 24px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

.dsc-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: var(--radius-md, var(--dsc-radius));
    text-decoration: none;
    transition: filter var(--dsc-motion);
    cursor: pointer;
    font-family: inherit;
}

.dsc-btn--outline {
    background: transparent;
    color: var(--brand, var(--dsc-sage));
    border: 1px solid var(--brand, var(--dsc-sage));
}

.dsc-btn--outline:hover {
    background: rgba(232, 130, 107, 0.06);
    text-decoration: none;
    color: var(--brand, var(--dsc-sage));
}

/* ============================================================
   ACCESSIBILITY
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .dsc-tab,
    .dsc-select,
    .dsc-filter-btn,
    .dsc-filter-reset,
    .dsc-page {
        transition: none !important;
        transform: none !important;
    }
}

.dsc-tab:focus-visible,
.dsc-page:focus-visible,
.dsc-filter-btn:focus-visible,
.dsc-select:focus-visible {
    outline: 2px solid var(--brand, var(--dsc-sage));
    outline-offset: 2px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 767px) {
    .dsc-hero {
        padding: 24px 0 20px;
    }

    .dsc-toolbar__inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding-top: 12px;
        padding-bottom: 12px;
    }

    .dsc-tabs {
        overflow-x: auto;
        scrollbar-width: none;
        width: 100%;
        padding-bottom: 2px;
    }

    .dsc-tabs::-webkit-scrollbar { display: none; }

    .dsc-filters {
        margin-left: 0;
        width: 100%;
        flex-wrap: wrap;
        gap: 8px;
    }

    .dsc-select {
        flex: 1;
        min-width: 120px;
    }

    .dsc-filter-btn {
        width: 100%;
        justify-content: center;
    }

    .dsc-filter-reset {
        width: 100%;
        text-align: center;
    }

    .dsc-main {
        padding: 16px 0 32px;
    }

    .dsc-pagination {
        gap: 3px;
    }

    .dsc-page {
        min-width: 32px;
        height: 32px;
        font-size: 13px;
    }
}

@media (max-width: 399px) {
    /* Скрываем промежуточные страницы пагинации на очень малых экранах */
    .dsc-page:not(.dsc-page--active):not(.dsc-page--prev):not(.dsc-page--next):not(.dsc-page--ellipsis) {
        display: none;
    }

    .dsc-page--active {
        display: inline-flex;
    }
}
