/* ============================================================
   TDD Variation Swatches — styles front
   Cible : fiches produits WooCommerce (Blocksy + Stackable)
   ============================================================ */

/* ---------- Conteneur ---------- */
.tdd-swatches-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
    margin-bottom: 4px;
    align-items: center;
}

/* ---------- Base commune à tous les swatches ---------- */
.tdd-swatch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 2px solid transparent;
    outline: none;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    user-select: none;
    position: relative;
}

.tdd-swatch:focus-visible {
    outline: 3px solid #b08040;
    outline-offset: 2px;
}

/* ---------- Rond de couleur ---------- */
.tdd-swatch--color {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.45);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6), 0 1px 4px rgba(0, 0, 0, 0.3);
}

.tdd-swatch--color:hover {
    transform: scale(1.12);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6), 0 2px 8px rgba(0, 0, 0, 0.35);
    border-color: rgba(0, 0, 0, 0.65);
}

.tdd-swatch--color.tdd-selected {
    border: 3px solid #2c2c2c;
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #2c2c2c;
    transform: scale(1.08);
}

/* Tooltip natif via [title] — complément CSS pour affichage propre */
.tdd-swatch--color::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a1a;
    color: #fff;
    font-size: 11px;
    font-family: inherit;
    white-space: nowrap;
    padding: 3px 8px;
    border-radius: 4px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 10;
}

.tdd-swatch--color:hover::after {
    opacity: 1;
}

/* ---------- Case / Bouton ---------- */
.tdd-swatch--button {
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: #2c2c2c;
    background: #f5f0e8;
    border: 2px solid #b0a080;
    min-width: 40px;
    text-align: center;
    line-height: 1.4;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
}

.tdd-swatch--button:hover {
    background: #ede3cf;
    border-color: #b08040;
    color: #1a1a1a;
    box-shadow: 0 2px 6px rgba(176, 128, 64, 0.2);
}

.tdd-swatch--button.tdd-selected {
    background: #2c2c2c;
    border-color: #2c2c2c;
    color: #f5f0e8;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* ---------- État "indisponible" ---------- */
.tdd-swatch.tdd-unavailable {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none; /* retiré pour garder l'hover du tooltip */
}

.tdd-swatch--color.tdd-unavailable::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: repeating-linear-gradient(
        135deg,
        transparent,
        transparent 4px,
        rgba(200, 50, 50, 0.55) 4px,
        rgba(200, 50, 50, 0.55) 5px
    );
}

/* ---------- Label de l'attribut sélectionné ---------- */
.tdd-selected-label {
    font-size: 12px;
    color: #777;
    margin-left: 4px;
    font-style: italic;
}

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
    .tdd-swatch--color {
        width: 30px;
        height: 30px;
    }

    .tdd-swatch--button {
        font-size: 12px;
        padding: 5px 10px;
    }
}
