/* ==========================================================
   DV1 MERCH — 01 CORE
   Carregamento: SEMPRE
   ----------------------------------------------------------
   01. Tokens padrão (:root)
   02. Header sticky + admin-bar
   03. Shell dinâmico (header/footer por parceiro)
   04. Âncoras
   05. Botões globais (glow / whatsapp)
   06. Fundo contextual das áreas internas
   07. Logo dinâmico do parceiro
   08. Página 404
   ========================================================== */


/* ==========================================================
   01. TOKENS PADRÃO
   Os valores por parceiro vêm do PHP (<style id="dv1-merch-dynamic-identity">).
   ========================================================== */

:root {

    /* Identidade padrão DV1 Merch */
    --dv1-accent: #C76929;
    --dv1-accent-hover: #AF4621;

    /* Interface universal */
    --dv1-surface: #FCFCFC;
    --dv1-surface-soft: #F5F5F5;

    --dv1-text: #111111;
    --dv1-text-soft: #666666;
    --dv1-muted: #999999;

    --dv1-border: #DEDEDE;
    --dv1-border-soft: #E7E7E7;
}


/* ==========================================================
   02. HEADER STICKY + ADMIN-BAR
   Funciona nos headers do HFE e nos injetados pelo PHP.
   ========================================================== */

.dv1-header {
    position: relative;
    width: 100%;
    z-index: 2;
}

header:has(.dv1-header),
#masthead:has(.dv1-header),
.hfe-site-header:has(.dv1-header),
.elementor-location-header:has(.dv1-header) {
    position: sticky !important;
    top: 0 !important;
    width: 100%;
    z-index: 99999 !important;
}

body.admin-bar header:has(.dv1-header),
body.admin-bar #masthead:has(.dv1-header),
body.admin-bar .hfe-site-header:has(.dv1-header),
body.admin-bar .elementor-location-header:has(.dv1-header) {
    top: 32px !important;
}

@media (max-width: 782px) {

    body.admin-bar header:has(.dv1-header),
    body.admin-bar #masthead:has(.dv1-header),
    body.admin-bar .hfe-site-header:has(.dv1-header),
    body.admin-bar .elementor-location-header:has(.dv1-header) {
        top: 46px !important;
    }
}


/* ==========================================================
   03. SHELL DINÂMICO
   O PHP adiciona body.dv1-shell-dynamic em produto, carrinho,
   checkout, pedido, conta e 404.
   ========================================================== */

/* Wrapper do header criado pelo PHP */
.dv1-dynamic-header-shell {
    position: relative;
    width: 100%;
    z-index: 99999;
}

/* Esconde header e footer originais do tema */
body.dv1-shell-dynamic #site-header.site-header {
    display: none !important;
}

body.dv1-shell-dynamic #colophon,
body.dv1-shell-dynamic footer#site-footer {
    display: none !important;
}

/* Wrapper do footer criado pelo PHP */
.dv1-dynamic-footer-shell {
    display: block !important;
    position: relative;
    width: 100%;
    z-index: 1;
}


/* ==========================================================
   04. ÂNCORAS / NAVEGAÇÃO SUAVE
   ========================================================== */

html {
    scroll-behavior: smooth;
}

[id] {
    scroll-margin-top: 90px;
}


/* ==========================================================
   05. BOTÕES GLOBAIS
   Usados no Elementor (hero, CTA, header/footer).
   ========================================================== */

/* ----- Principal / glow ----- */

.dv1-btn-glow .elementor-button {
    background: linear-gradient(
        180deg,
        #DB8A30 0%,
        #C76929 48%,
        #AF4621 100%
    ) !important;
    color: #F5F5F5 !important;
    border: 1px solid rgba(219,138,48,.55);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.16),
        0 0 7px rgba(199,105,41,.32),
        0 0 16px rgba(199,105,41,.20),
        0 0 30px rgba(175,70,33,.11),
        0 8px 24px rgba(65,33,12,.22);
    transition:
        background .3s ease,
        border-color .3s ease,
        box-shadow .3s ease,
        transform .3s ease;
}

.dv1-btn-glow .elementor-button:hover {
    background: linear-gradient(
        180deg,
        #E2973B 0%,
        #D2742D 48%,
        #B94B21 100%
    ) !important;
    border-color: rgba(219,138,48,.90);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.22),
        0 0 10px rgba(219,138,48,.48),
        0 0 22px rgba(199,105,41,.28),
        0 0 40px rgba(175,70,33,.15),
        0 10px 28px rgba(65,33,12,.28);
    transform: translateY(-1px);
}

.dv1-btn-glow .elementor-button-text,
.dv1-btn-glow .elementor-button-icon {
    color: inherit !important;
}

/* ----- WhatsApp / secundário ----- */

.dv1-btn-whatsapp .elementor-button {
    background: rgba(17,17,17,.60) !important;
    color: #F5F5F5 !important;
    border: 1px solid rgba(118,119,119,.75) !important;
    box-shadow:
        inset 0 0 10px rgba(255,255,255,.015),
        0 0 8px rgba(0,0,0,.18);
    transition:
        background .3s ease,
        color .3s ease,
        border-color .3s ease,
        box-shadow .3s ease,
        transform .3s ease;
}

.dv1-btn-whatsapp .elementor-button-text,
.dv1-btn-whatsapp .elementor-button-icon {
    color: inherit !important;
}

.dv1-btn-whatsapp .elementor-button:hover {
    background: rgba(199,105,41,.075) !important;
    color: #F5F5F5 !important;
    border-color: #C76929 !important;
    box-shadow:
        inset 0 0 12px rgba(199,105,41,.035),
        0 0 7px rgba(199,105,41,.13),
        0 0 16px rgba(175,70,33,.06);
    transform: translateY(-1px);
}


/* ==========================================================
   06. FUNDO CONTEXTUAL DAS ÁREAS INTERNAS
   Carrinho, checkout, pedido recebido, pagar pedido,
   Minha Conta e 404. As variáveis vêm do cadastro do parceiro.
   ========================================================== */

body.dv1-shell-dynamic:not(.single-product) {
    background-color: var(--dv1-context-bg-color, #1B1B1B) !important;
    background-image: var(--dv1-context-bg-desk, none) !important;
    background-repeat: no-repeat !important;
    background-position: center top !important;
    background-size: cover !important;
    background-attachment: fixed !important;
}

/* Deixa o fundo do BODY aparecer */
body.dv1-shell-dynamic:not(.single-product) #page,
body.dv1-shell-dynamic:not(.single-product) #content,
body.dv1-shell-dynamic:not(.single-product) main,
body.dv1-shell-dynamic:not(.single-product) .site-main {
    background: transparent !important;
}

/* Títulos externos das páginas */
body.dv1-shell-dynamic:not(.single-product) .page-header .entry-title {
    color: var(--dv1-context-title, #FFFFFF) !important;
}

@media (max-width: 767px) {

    body.dv1-shell-dynamic:not(.single-product) {
        background-image: var(
            --dv1-context-bg-mobi,
            var(--dv1-context-bg-desk, none)
        ) !important;
        background-attachment: scroll !important;
    }
}


/* ==========================================================
   07. LOGO DINÂMICO DO PARCEIRO
   ========================================================== */

.dv1-partner-logo {
    display: inline-block;
    max-width: 100%;
    line-height: 0;
}

.dv1-partner-logo-image {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    object-fit: contain;
}


/* ==========================================================
   08. PÁGINA 404
   O fundo vem do bloco "fundo contextual" (seção 06).
   ========================================================== */

.dv1-404 {
    display: flex;
    align-items: center;
    justify-content: center;
    width: min(1200px, calc(100% - 48px));
    min-height: 560px;
    margin: 0 auto;
    padding: 70px 0;
}

.dv1-404-card {
    width: 100%;
    max-width: 760px;
    padding: 64px 48px;
    background: #FFFFFF;
    border-radius: 16px;
    box-shadow: 0 18px 55px rgba(0,0,0,.28);
    text-align: center;
}

.dv1-404-code {
    margin-bottom: 10px;
    color: var(--dv1-accent, #C76929);
    font-size: 86px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -4px;
}

.dv1-404 h1 {
    margin: 0 0 14px;
    color: #111111;
    font-size: 32px;
    font-weight: 700;
}

.dv1-404 p {
    max-width: 560px;
    margin: 0 auto 32px;
    color: #666666;
    font-size: 16px;
    line-height: 1.6;
}

.dv1-404-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
}

.dv1-404-primary,
.dv1-404-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    padding: 0 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none !important;
    cursor: pointer;
}

.dv1-404-primary {
    background: var(--dv1-accent, #C76929);
    border: 1px solid var(--dv1-accent, #C76929);
    color: #FFFFFF !important;
}

.dv1-404-primary:hover {
    background: var(--dv1-accent-hover, #AF4621);
    border-color: var(--dv1-accent-hover, #AF4621);
    color: #FFFFFF !important;
}

.dv1-404-back {
    background: transparent;
    border: 1px solid #CCCCCC;
    color: #555555;
}

.dv1-404-back:hover {
    border-color: #888888;
    color: #111111;
}

@media (max-width: 767px) {

    .dv1-404 {
        width: calc(100% - 28px);
        min-height: 420px;
        padding: 40px 0;
    }

    .dv1-404-card {
        padding: 44px 22px;
        border-radius: 12px;
    }

    .dv1-404-code {
        font-size: 64px;
    }

    .dv1-404 h1 {
        font-size: 26px;
    }

    .dv1-404-actions {
        flex-direction: column;
    }

    .dv1-404-primary,
    .dv1-404-back {
        width: 100%;
    }
}
