/* ============================================================================
 * WOLFEN MARKETPLACE — DESIGN SYSTEM MOBILE-FIRST PREMIUM
 * Tokens globais, ergonomia de toque, safe-areas, zero overflow horizontal
 * e refinamento visual responsivo (320px -> 1440px+).
 * ============================================================================ */

:root {
    /* Paleta Oficial Wolfen Premium */
    --wf-obsidian: #111215;
    --wf-graphite: #191B20;
    --wf-champagne: #C9A96E;
    --wf-champagne-dark: #A68446;
    --wf-surface: #FFFFFF;
    --wf-bg-soft: #F5F6F8;
    --wf-border: rgba(15, 23, 42, 0.08);
    --wf-border-strong: rgba(15, 23, 42, 0.16);
    --wf-text: #111215;
    --wf-text-muted: #64748B;

    /* Raios refinados */
    --wf-radius-xs: 4px;
    --wf-radius-sm: 8px;
    --wf-radius-md: 12px;
    --wf-radius-lg: 16px;

    /* Sombras discretas */
    --wf-shadow-sm: 0 1px 3px rgba(17, 18, 21, 0.05);
    --wf-shadow-md: 0 10px 30px rgba(17, 18, 21, 0.08);
    --wf-shadow-lg: 0 24px 60px rgba(17, 18, 21, 0.18);

    /* Safe areas (iOS / Android gesture bar) */
    --wf-safe-bottom: env(safe-area-inset-bottom, 0px);
    --wf-bottom-nav-h: 64px;
}

/* Proteção global contra overflow horizontal sem quebrar position:sticky */
html {
    background-color: var(--wf-obsidian);
}
html, body {
    max-width: 100%;
    overflow-x: clip;
    -webkit-tap-highlight-color: transparent;
}

body.wf-scroll-locked {
    overflow: hidden !important;
    touch-action: none;
}

/* Espaço inferior no mobile para não cobrir conteúdo com a barra fixa */
@media (max-width: 767.98px) {
    body.wf-has-bottom-nav {
        padding-bottom: calc(var(--wf-bottom-nav-h) + var(--wf-safe-bottom) + 8px);
    }
    body.wf-has-product-bar {
        padding-bottom: calc(82px + var(--wf-safe-bottom));
    }
}

/* Foco acessível visível para teclado */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--wf-champagne);
    outline-offset: 2px;
}

/* ── CABEÇALHO MOBILE COMPACTO E INTELIGENTE ─────────────────────────────── */
.wf-mobile-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 56px;
}

@media (max-width: 767.98px) {
    .wf-header-search-wrap {
        max-height: 58px;
        opacity: 1;
        transition: max-height 0.22s ease, opacity 0.18s ease, margin 0.22s ease;
    }
    #wf_main_header.wf-search-collapsed .wf-header-inner {
        padding-top: 6px !important;
        padding-bottom: 6px !important;
    }
    #wf_main_header.wf-search-collapsed .wf-header-row {
        row-gap: 0 !important;
    }
    #wf_main_header.wf-search-collapsed .wf-header-search-wrap {
        max-height: 0 !important;
        opacity: 0 !important;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        overflow: hidden !important;
        pointer-events: none;
    }
}

.wf-icon-btn {
    min-width: 40px;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--wf-radius-sm);
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}
.wf-icon-btn:active {
    transform: scale(0.94);
}

/* ── MENU LATERAL MOBILE PREMIUM (HIERÁRQUICO) ───────────────────────────── */
.wf-drawer-backdrop {
    background: rgba(11, 12, 14, 0.65);
    backdrop-filter: blur(4px);
    transition: opacity 0.25s ease;
}

.wf-drawer-panel {
    width: 86vw;
    max-width: 360px;
    height: 100dvh;
    background: #FFFFFF;
    box-shadow: 16px 0 50px rgba(0, 0, 0, 0.28);
    display: flex;
    flex-direction: column;
    padding-bottom: var(--wf-safe-bottom);
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.wf-cat-accordion-btn {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--wf-radius-sm);
    font-size: 13px;
    font-weight: 600;
    color: var(--wf-text);
    transition: background-color 0.18s ease, color 0.18s ease;
}
.wf-cat-accordion-btn:hover {
    background-color: #F5F6F8;
}
.wf-cat-chevron {
    transition: transform 0.22s ease;
}
.wf-cat-accordion-btn[aria-expanded="true"] .wf-cat-chevron {
    transform: rotate(180deg);
    color: var(--wf-champagne-dark);
}
.wf-cat-sublist {
    overflow: hidden;
    transition: max-height 0.26s ease;
}

/* ── BARRA DE NAVEGAÇÃO INFERIOR MOBILE ──────────────────────────────────── */
.wf-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 150;
    background: rgba(17, 18, 21, 0.97);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: var(--wf-safe-bottom);
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.22);
}

.wf-bottom-nav-inner {
    height: var(--wf-bottom-nav-h);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: center;
}

.wf-bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 100%;
    color: rgba(255, 255, 255, 0.55);
    text-decoration: none;
    position: relative;
    transition: color 0.18s ease, transform 0.15s ease;
}
.wf-bottom-nav-item:active {
    transform: scale(0.92);
}
.wf-bottom-nav-item.is-active {
    color: var(--wf-champagne);
}
.wf-bottom-nav-item.is-active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 25%;
    right: 25%;
    height: 2px;
    background: var(--wf-champagne);
}
.wf-bottom-nav-item span {
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

/* ── BARRA FIXA DE COMPRA NA PÁGINA DO PRODUTO (MOBILE) ──────────────────── */
.wf-product-sticky-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 160;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(14px);
    border-top: 1px solid rgba(15, 23, 42, 0.1);
    padding: 10px 14px calc(10px + var(--wf-safe-bottom));
    box-shadow: 0 -10px 30px rgba(17, 18, 21, 0.12);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

/* ── BOTTOM SHEET DE FILTROS MOBILE ──────────────────────────────────────── */
@media (max-width: 1023.98px) {
    .wf-filter-drawer {
        position: fixed;
        inset: 0;
        z-index: 260;
        display: none;
    }
    .wf-filter-drawer.is-open {
        display: flex;
        align-items: flex-end;
    }
    .wf-filter-sheet {
        position: relative;
        z-index: 10;
        width: 100%;
        max-height: 86dvh;
        background: #FFFFFF;
        border-top-left-radius: 16px;
        border-top-right-radius: 16px;
        display: flex;
        flex-direction: column;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 18px 16px calc(18px + var(--wf-safe-bottom));
        box-shadow: 0 -16px 50px rgba(0, 0, 0, 0.25);
    }
}

/* ── REFINAMENTOS RESPONSIVOS GERAIS (320px – 767px) ─────────────────────── */
@media (max-width: 767.98px) {
    .container {
        padding-left: 14px !important;
        padding-right: 14px !important;
    }
    .section-custom {
        padding-top: 24px !important;
        padding-bottom: 24px !important;
    }
    .banner-custom {
        height: auto !important;
        min-height: 190px;
        max-height: 300px;
    }
    .banner-small-custom {
        height: 140px !important;
    }
    /* Evita cartões desproporcionais e textos cortados */
    .card-custom {
        transform: none !important;
    }
    /* Evita que telas de 320px quebrem formulários/botões */
    .wf-touch-target {
        min-height: 44px;
    }
}

/* Telas muito pequenas (320px - 359px): ajustes cirúrgicos sem quebrar flex/ícones */
@media (max-width: 359.98px) {
    .wf-mobile-header-bar {
        gap: 4px;
    }
    .wf-bottom-nav-item span {
        font-size: 8.5px;
    }
}
