/**
 * WooCommerce Lightweight Swatches CSS
 * Plugin: Seletor de Variações
 * Autor: Raul Tribuzi
 * Layout: Cantos Retos (Hard Edges / Square)
 * Otimizações: Hardware Acceleration (GPU), Zero Reflows & High Performance Rendering
 */

/* Oculta o botão nativo de limpar seleções (.reset_variations / "Limpar") */
.reset_variations,
a.reset_variations {
    display: none !important;
}

/* Oculta os rótulos/títulos nativos de variações (ex: Sleeve) */
.variations .label,
.variations td.label,
.variations label {
    display: none !important;
}

/* Esconde os elementos <select> nativos e wrappers de terceiros (NiceSelect, Select2) */
.variations select,
.variations .nice-select,
.variations .select2-container {
    display: none !important;
}

/* Transforma a tabela nativa .variations em um container bloco simples (sem fundo, sem bordas, sem padding) */
table.variations,
table.variations tbody,
table.variations tr,
table.variations td,
table.variations td.value {
    display: block !important;
    width: 100% !important;
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
}

/* Oculta o preço duplicado no bloco inferior de variações */
.single_variation_wrap .woocommerce-variation-price {
    display: none !important;
}

/* Container Flexbox dos cartões de variação */
.custom-swatches-container {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 10px;
    margin-bottom: 20px;
}

/* Card do Modelo / Swatch Button - DESKTOP */
.custom-swatches-container .swatch-btn {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 130px;
    min-height: 165px;
    padding: 10px 8px 12px 8px;
    background-color: transparent !important;
    background: transparent !important;
    border: 1px solid #ffffff !important;
    border-radius: 0px !important;
    cursor: pointer;
    transition: transform 0.15s ease-out, border-color 0.15s ease-out, box-shadow 0.15s ease-out;
    will-change: transform;
    transform: translateZ(0);
    outline: none;
    user-select: none;
    box-sizing: border-box;
}

.custom-swatches-container .swatch-btn:hover {
    border-color: #ffffff !important;
    transform: translateY(-2px) translateZ(0);
    box-shadow: 0 4px 14px rgba(255, 255, 255, 0.18);
}

/* Badge Quadrado de Seleção no Canto Superior Direito */
.custom-swatches-container .swatch-btn .swatch-check {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 20px;
    height: 20px;
    border-radius: 0px !important;
    border: 1.5px solid rgba(255, 255, 255, 0.5);
    background: rgba(0, 0, 0, 0.6);
    color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease, border-color 0.15s ease;
    z-index: 2;
}

.custom-swatches-container .swatch-btn .swatch-check svg {
    display: block;
    width: 11px;
    height: 11px;
}

/* Estado Ativo: Borda #cc2222 e Badge Vermelho Quadrado */
.custom-swatches-container .swatch-btn.active {
    border: 2px solid #cc2222 !important;
    background-color: transparent !important;
    background: transparent !important;
    box-shadow: 0 0 12px rgba(204, 34, 34, 0.45);
}

.custom-swatches-container .swatch-btn.active .swatch-check {
    background: #cc2222 !important;
    border-color: #cc2222 !important;
    color: #ffffff !important;
}

/* Container da Imagem Thumbnail (woocommerce_thumbnail) - DESKTOP */
.custom-swatches-container .swatch-btn .swatch-img-wrapper {
    width: 100%;
    height: 95px;
    border-radius: 0px !important;
    overflow: hidden;
    background-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.custom-swatches-container .swatch-btn .swatch-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 0px !important;
}

/* Título embaixo, centralizado, branco - DESKTOP */
.custom-swatches-container .swatch-btn .swatch-title {
    font-family: "Barlow", "Overpass Mono", sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #ffffff !important;
    text-align: center;
    line-height: 1.25;
    word-break: break-word;
    width: 100%;
    display: block;
    margin-top: 2px;
}

/* Preço embaixo do título - DESKTOP */
.custom-swatches-container .swatch-btn .swatch-price,
.custom-swatches-container .swatch-btn .swatch-price .amount,
.custom-swatches-container .swatch-btn .swatch-price .amount bdi {
    font-family: "Barlow", "Overpass Mono", sans-serif;
    font-size: 13px !important;
    font-weight: 700 !important;
    color: #cccccc !important;
    text-align: center;
    line-height: 1.25 !important;
    width: 100%;
    display: block;
    margin-top: 3px;
}

.custom-swatches-container .swatch-btn.active .swatch-price,
.custom-swatches-container .swatch-btn.active .swatch-price .amount,
.custom-swatches-container .swatch-btn.active .swatch-price .amount bdi {
    color: #ffffff !important;
}

/* Estado Desabilitado / Indisponível */
.custom-swatches-container .swatch-btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(100%);
    border-color: rgba(255, 255, 255, 0.2) !important;
}

.custom-swatches-container .swatch-btn.disabled .swatch-title,
.custom-swatches-container .swatch-btn.disabled .swatch-price {
    text-decoration: line-through;
    color: #888888 !important;
}

/* RESPONSIVO MOBILE */
@media (max-width: 767px) {
    .custom-swatches-container {
        gap: 10px;
    }

    .custom-swatches-container .swatch-btn {
        width: 100px;
        min-height: 135px;
        padding: 6px 4px 8px 4px;
    }

    .custom-swatches-container .swatch-btn .swatch-img-wrapper {
        height: 70px;
        margin-bottom: 4px;
    }

    .custom-swatches-container .swatch-btn .swatch-check {
        width: 16px;
        height: 16px;
        top: 4px;
        right: 4px;
    }

    .custom-swatches-container .swatch-btn .swatch-check svg {
        width: 9px;
        height: 9px;
    }

    .custom-swatches-container .swatch-btn .swatch-title {
        font-size: 11px;
    }

    .custom-swatches-container .swatch-btn .swatch-price,
    .custom-swatches-container .swatch-btn .swatch-price .amount,
    .custom-swatches-container .swatch-btn .swatch-price .amount bdi {
        font-size: 11px !important;
    }
}
