/* ===========================
   CUSTOM PRODUCT VARIATIONS V3
   Design Mantido + Cor do Texto de Economia Preta
   =========================== */

/* V3: Reset e base dos swatches - APENAS para elementos customizados */
.wd-swatches-product {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    width: 100% !important;
}

.wd-swatches-product .wd-swatch {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100% !important;
    height: auto !important;
    min-height: 80px !important;
    border-radius: 8px 5px 8px 8px !important;
    border: 2px solid #E0E0E0 !important;
    background: #F5F5F5 !important;
    margin-top: 38px !important;
    overflow: visible !important;
    position: relative !important;
    padding: 15px 20px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    justify-content: flex-start !important;
    align-items: center !important;
    padding-left: 15px !important;
    box-shadow: none !important;
    filter: none !important;
    background-color: #F5F5F5 !important; 
    outline: none !important;
    transform: translateY(0);
}

/* V3: Estados do swatch principal */
.wd-swatches-product .wd-swatch:hover,
.wd-swatches-product .wd-swatch.hover {
    border-color: #F7AA76 !important;
    background: #FFFFFF !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1), 2px 0 8px rgba(0, 0, 0, 0.05), -2px 0 8px rgba(0, 0, 0, 0.05) !important;
    filter: none !important;
    background-color: #FFFFFF !important;
    transform: translateY(-3px);
}

.wd-swatches-product .wd-swatch.selected,
.wd-swatches-product .wd-swatch.active {
    border-color: #F7AA76 !important;
    background: #F7AA76 !important;
    box-shadow: none !important;
    filter: none !important;
    background-color: #F7AA76 !important;
    transform: translateY(0);
}

/* V3: Remover qualquer pseudo-elemento que possa causar sombra ou overlay */
.wd-swatches-product .wd-swatch::before,
.wd-swatches-product .wd-swatch::after {
    content: none !important;
    display: none !important;
    background: none !important;
    box-shadow: none !important;
    filter: none !important;
    opacity: 0 !important;
}

/* V3: Aba de desconto - Base */
.wd-swatch-discount-tag {
    position: absolute !important;
    top: -28px !important;
    right: 0 !important;
    background-color: #E0E0E0 !important;
    color: #F7AA76 !important;
    padding: 5px 19px 3px 17px !important;
    border-radius: 6px 6px 0 0 !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    white-space: nowrap !important;
    z-index: 999 !important;
    border: none !important;
    border-bottom: none !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    transition: all 0.3s ease !important;
    line-height: 1.2 !important;
    text-align: center !important;
}

/* V3: Estados da aba de desconto - Hover */
.wd-swatches-product .wd-swatch:hover .wd-swatch-discount-tag,
.wd-swatches-product .wd-swatch.hover .wd-swatch-discount-tag {
    background-color: #F7AA76 !important;
    color: #FFFFFF !important;
    border-color: #F7AA76 !important;
}

/* V3: Estados da aba de desconto - Ativo/Selecionado */
.wd-swatches-product .wd-swatch.selected .wd-swatch-discount-tag,
.wd-swatches-product .wd-swatch.active .wd-swatch-discount-tag {
    background-color: #F7AA76 !important;
    color: #FFFFFF !important;
    border-color: #F7AA76 !important;
}

/* V3: Forçar transições com especificidade máxima */
.wd-swatches-product[data-id="pa_quantidade"] .wd-swatch:hover .wd-swatch-discount-tag,
.wd-swatches-product[data-id="pa_quantidade"] .wd-swatch.hover .wd-swatch-discount-tag,
.wd-swatches-product[data-id="pa_quantidade"] .wd-swatch.selected .wd-swatch-discount-tag,
.wd-swatches-product[data-id="pa_quantidade"] .wd-swatch.active .wd-swatch-discount-tag {
    background-color: #F7AA76 !important;
    color: #FFFFFF !important;
    border-color: #F7AA76 !important;
}

/* V3: Conteúdo do swatch */
.wd-swatch-content {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: flex-start !important;
    margin-left: 10px;
    text-align: left !important;
}

.wd-swatch-title {
    font-size: 17px !important;
    font-weight: 600 !important;
    color: #F7AA76 !important;
    margin-bottom: 4px !important;
    line-height: 1.3 !important;
    text-align: left !important;
}

.wd-swatch.selected .wd-swatch-title,
.wd-swatch.active .wd-swatch-title {
    color: #FFFFFF !important;
}

/* V3: Economia - Cor preta para o texto */
.wd-swatch-economy {
    font-size: 13px !important;
    font-weight: 300 !important;
    color: #000000 !important; /* Cor preta para o texto de economia */
    margin-top: 4px !important;
    display: block !important;
    visibility: visible !important;
    opacity: 0.9 !important;
    line-height: 1.2 !important;
    text-align: left !important;
}

.wd-swatch.selected .wd-swatch-economy,
.wd-swatch.active .wd-swatch-economy {
    color: #FFFFFF !important;
}

/* V3: Preços */
.wd-swatch-prices {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-end !important;
    text-align: right !important;
    margin-left: auto;
}

.wd-swatch-original-price {
    font-size: 13px !important;
    color: #999999 !important;
    text-decoration: line-through !important;
    margin-bottom: 2px !important;
}

.wd-swatch.selected .wd-swatch-original-price,
.wd-swatch.active .wd-swatch-original-price {
    color: #FFFFFF !important;
}

.wd-swatch-current-price {
    font-size: 18px !important;
    font-weight: 700 !important;
    color: #333333 !important;
    line-height: 1.2 !important;
}

.wd-swatch.selected .wd-swatch-current-price,
.wd-swatch.active .wd-swatch-current-price {
    color: #FFFFFF !important;
}

.wd-swatch-unit {
    font-size: 13px !important;
    font-weight: 400 !important;
    color: #666666 !important;
}

.wd-swatch.selected .wd-swatch-unit,
.wd-swatch.active .wd-swatch-unit {
    color: #FFFFFF !important;
}

/* V3: Ocultar elementos nativos do WooCommerce APENAS nos swatches customizados */
.wd-swatches-product .wd-swatch .wd-swatch-bg img,
.wd-swatches-product .wd-swatch .wd-swatch-bg {
    display: none !important;
}

.wd-swatches-product .wd-swatch .wd-tooltip {
    display: none !important;
}

/* V3: Estilo para o radio button */
.wd-swatch-radio-button {
    width: 20px;
    height: 20px;
    border: 2px solid #E0E0E0;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    margin-right: 10px;
    transition: all 0.3s ease;
}

/* V3: Rádio button selecionado/ativo */
.wd-swatch.selected .wd-swatch-radio-button,
.wd-swatch.active .wd-swatch-radio-button {
    border-color: #FFFFFF !important;
}

.wd-swatch-radio-button::after {
    content: "";
    width: 10px;
    height: 10px;
    background-color: #F7AA76;
    border-radius: 50%;
    display: none;
}

/* V3: Círculo interno branco quando selecionado/ativo */
.wd-swatch.selected .wd-swatch-radio-button::after,
.wd-swatch.active .wd-swatch-radio-button::after {
    display: block !important;
    background-color: #FFFFFF !important;
}

/* V3: Rádio button no hover (não selecionado) */
.wd-swatch:hover:not(.selected):not(.active) .wd-swatch-radio-button {
    border-color: #F7AA76;
}

.wd-swatch:hover:not(.selected):not(.active) .wd-swatch-radio-button::after {
    background-color: #F7AA76;
    display: none;
}

/* V3: Forçar o background-color para evitar overlays */
.wd-swatches-product .wd-swatch.selected,
.wd-swatches-product .wd-swatch.active {
    background-color: #F7AA76 !important;
}

.wd-swatches-product .wd-swatch:not(.selected):not(.active) {
    background-color: #F5F5F5 !important;
}

.wd-swatches-product .wd-swatch:hover:not(.selected):not(.active) {
    background-color: #FFFFFF !important;
}

/* V3: Remover qualquer background ou sombra de elementos filhos */
.wd-swatches-product .wd-swatch > * {
    background: none !important;
    box-shadow: none !important;
    filter: none !important;
    opacity: 1 !important;
}

.wd-swatches-product .wd-swatch .wd-swatch-bg {
    background: none !important;
    box-shadow: none !important;
    filter: none !important;
    opacity: 1 !important;
}

/* V3: Responsivo - Mobile */
@media (max-width: 768px) {
    .wd-swatches-product .wd-swatch {
        min-height: 70px !important;
        padding: 12px 15px !important;
        margin-top: 35px !important;
    }
    
    .wd-swatch-discount-tag {
        font-size: 13px !important;
        padding: 5px 14px 2px 12px !important;
        top: -26px !important;
    }
    
    .wd-swatch-title {
        font-size: 15px !important;
    }
    
    .wd-swatch-economy {
        font-size: 12px !important;
    }
    
    .wd-swatch-current-price {
        font-size: 17px !important;
    }
    
    .wd-swatch-original-price {
        font-size: 12px !important;
    }
}

/* V3: Garantir que não há conflitos com outros estilos */
.wd-swatches-product .wd-swatch * {
    box-sizing: border-box !important;
}

/* V3: Forçar visibilidade de todos os elementos customizados */
.wd-swatch-discount-tag,
.wd-swatch-content,
.wd-swatch-title,
.wd-swatch-economy,
.wd-swatch-prices,
.wd-swatch-original-price,
.wd-swatch-current-price {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* V3: Animações suaves para todas as transições */
.wd-swatch-discount-tag,
.wd-swatches-product .wd-swatch {
    transition: all 0.3s ease !important;
}

/* V3: Debug - bordas vermelhas se WP_DEBUG estiver ativo */
body.cv-debug-mode .wd-swatch-discount-tag {
    border: 2px solid red !important;
}

body.cv-debug-mode .wd-swatch-economy {
    border: 1px solid blue !important;
}

/* V3: Classe especial para indicar que o cálculo foi feito dinamicamente */
.wd-swatch-economy.dynamic-calculation {
    font-weight: 500 !important;
    color: #000000 !important; /* Cor preta para o texto de economia */
}

.wd-swatch.selected .wd-swatch-economy.dynamic-calculation,
.wd-swatch.active .wd-swatch-economy.dynamic-calculation {
    color: #FFFFFF !important;
}

/* V3: Estilo para loading durante cálculo */
.wd-swatch-economy.calculating {
    opacity: 0.6 !important;
    font-style: italic !important;
}

/* V3: Estilo para erro no cálculo */
.wd-swatch-economy.calculation-error {
    color: #D32F2F !important;
    font-size: 11px !important;
}

.wd-swatch.selected .wd-swatch-economy.calculation-error,
.wd-swatch.active .wd-swatch-economy.calculation-error {
    color: #FFCDD2 !important;
}

/* V3: IMPORTANTE - Não interferir com outras áreas do site */
/* Garantir que os estilos se aplicam APENAS aos swatches de variação */

/* V3: Não modificar a área principal de preços do produto */
.single-product-content .price,
.summary .price,
.product-summary .price {
    /* Manter estilos originais - NÃO MODIFICAR */
}

/* V3: Não modificar outros elementos de preço do WooCommerce */
.woocommerce-Price-amount:not(.wd-swatch-original-price):not(.wd-swatch-current-price) {
    /* Manter estilos originais - NÃO MODIFICAR */
}

/* V3: Garantir que apenas elementos dentro de .wd-swatches-product sejam afetados */
.wd-swatch-discount-tag,
.wd-swatch-content,
.wd-swatch-title,
.wd-swatch-economy,
.wd-swatch-prices,
.wd-swatch-original-price,
.wd-swatch-current-price,
.wd-swatch-radio-button {
    /* Estes estilos só se aplicam se o elemento estiver dentro de .wd-swatches-product */
}

/* V3: Especificidade máxima para evitar conflitos */
.wd-swatches-product .wd-swatch[data-custom-processed="v3"] {
    /* Garantir que apenas swatches processados pela versão V3 sejam afetados */
}

/* V3: Isolamento de estilos para evitar vazamento */
.custom-variations-v3 .wd-swatches-product {
    /* Aplicar estilos apenas quando a classe body está presente */
}

