/* ============================================
   RF Variation Swatches — Frontend Styles
   ============================================ */

/* Cacher le select original quand les swatches sont actifs */
.rfsw-has-swatches select {
    display: none !important;
}

/* Container des swatches pour un attribut */
.rfsw-swatches-wrap {
    margin-bottom: 16px;
}

/* Label dynamique : "Couleur : Rouge" */
.rfsw-label-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
    font-size: 14px;
    line-height: 1;
}

.rfsw-label-row .rfsw-label {
    font-weight: 600;
    color: #2d1f24;
}

.rfsw-label-row .rfsw-selected-name {
    font-weight: 400;
    color: #5a4048;
    transition: opacity 0.25s ease;
}

/* Row de swatches */
.rfsw-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

/* =====================
   COLOR SWATCHES
   ===================== */
.rfsw-swatch--color {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    border: 2.5px solid transparent;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
}

.rfsw-swatch--color .rfsw-swatch-inner {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: inset 0 1px 3px rgba(255, 255, 255, 0.15);
}

.rfsw-swatch--color:hover {
    transform: scale(1.12);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.rfsw-swatch--color.rfsw-active {
    border-color: #6b2d3e;
    box-shadow: 0 0 0 2px rgba(199, 125, 138, 0.4);
}

/* Checkmark sur la sélection active */
.rfsw-swatch--color.rfsw-active::after {
    content: '✓';
    position: absolute;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    z-index: 1;
    pointer-events: none;
}

/* Tooltip au survol */
.rfsw-swatch--color .rfsw-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #2d1f24;
    color: #fff;
    font-size: 11px;
    font-weight: 400;
    padding: 4px 10px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    letter-spacing: 0.3px;
    z-index: 10;
}

.rfsw-swatch--color .rfsw-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #2d1f24;
}

.rfsw-swatch--color:hover .rfsw-tooltip {
    opacity: 1;
}

/* =====================
   BUTTON / SIZE SWATCHES
   ===================== */
.rfsw-swatch--button {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 14px;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    background: #fff;
    font-size: 13px;
    font-weight: 500;
    color: #2d1f24;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.rfsw-swatch--button:hover {
    border-color: #c77d8a;
    background: #fdf6f7;
}

.rfsw-swatch--button.rfsw-active {
    border-color: #6b2d3e;
    background: #6b2d3e;
    color: #fff;
    box-shadow: 0 2px 8px rgba(107, 45, 62, 0.2);
}

/* =====================
   OUT OF STOCK
   ===================== */
.rfsw-swatch--color.rfsw-oos,
.rfsw-swatch--button.rfsw-oos {
    opacity: 0.35;
    cursor: not-allowed;
    position: relative;
}

.rfsw-swatch--button.rfsw-oos {
    text-decoration: line-through;
}

.rfsw-swatch--color.rfsw-oos::before {
    content: '';
    position: absolute;
    width: 80%;
    height: 2px;
    background: rgba(255, 255, 255, 0.9);
    transform: rotate(-45deg);
    z-index: 2;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* =====================
   ASTRA COMPATIBILITY
   ===================== */

/* Masquer les boutons inline générés par Astra Pro / Starter Templates */
/* Spécificité élevée pour écraser les !important d'Astra */
table.variations .rfsw-has-swatches .ast-variation-button-group,
td.value.rfsw-has-swatches .ast-variation-button-group,
.rfsw-has-swatches .ast-variation-button-group,
.variations .ast-variation-button-group,
.rfsw-has-swatches .cfvsw-swatches-container,
.rfsw-has-swatches .button-variable-items-wrapper,
.rfsw-has-swatches .button-variable-items,
.rfsw-has-swatches ul.variable-items-wrapper {
    display: none !important;
}

/* S'assurer que le lien "Effacer" natif WooCommerce reste visible */
.rfsw-has-swatches .reset_variations {
    display: inline-block !important;
    font-size: 12px;
    color: #8a7078;
    margin-top: 4px;
}

/* =====================
   RESPONSIVE
   ===================== */
@media (max-width: 768px) {
    .rfsw-swatch--color {
        width: 34px;
        height: 34px;
    }

    .rfsw-swatch--color .rfsw-swatch-inner {
        width: 26px;
        height: 26px;
    }

    .rfsw-swatch--button {
        min-width: 38px;
        height: 38px;
        padding: 0 10px;
        font-size: 12px;
    }

    .rfsw-swatches {
        gap: 8px;
    }
}
