/* ==========================================================
   WooCommerce Catalog Variations — Frontend Styles
   ========================================================== */

/* ----------------------------------------------------------
   Swatch container
   ---------------------------------------------------------- */
.wcv-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
    margin: 8px 0 4px;
    padding: 0;
    list-style: none;
}

/* ----------------------------------------------------------
   Individual swatch circle
   ---------------------------------------------------------- */
.wcv-swatch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid transparent;
    box-sizing: border-box;
    cursor: pointer;
    text-decoration: none;
    position: relative;
    transition: border-color 0.15s ease, transform 0.15s ease, opacity 0.15s ease;
    overflow: hidden;
    flex-shrink: 0;
}

.wcv-swatch:hover {
    border-color: #333;
    transform: scale(1.12);
    z-index: 1;
}

.wcv-swatch--active {
    border-color: #333 !important;
    box-shadow: 0 0 0 1px #fff inset;
}

/* Swatch image (for image-type attributes) */
.wcv-swatch img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 50%;
}

/* Label/radio type — show initials */
.wcv-swatch:not([style*="background-color"]):not(:has(img))::after {
    content: attr(data-attr-value);
    font-size: 8px;
    font-weight: 600;
    text-transform: uppercase;
    color: #333;
    line-height: 1;
    letter-spacing: -.3px;
    max-width: 90%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ----------------------------------------------------------
   Out of stock swatch
   ---------------------------------------------------------- */
.wcv-swatch--outofstock {
    opacity: 0.4;
    cursor: default;
}

.wcv-swatch--outofstock::before {
    content: '';
    position: absolute;
    width: 120%;
    height: 1.5px;
    background: rgba(0, 0, 0, 0.55);
    transform: rotate(-45deg);
    top: 50%;
    left: -10%;
    pointer-events: none;
}

.wcv-swatch--outofstock:hover {
    border-color: #aaa;
    transform: none;
}

/* ----------------------------------------------------------
   Hidden swatches (overflow)
   ---------------------------------------------------------- */
.wcv-swatch--hidden {
    display: none;
}

.wcv-swatch-overflow {
    font-size: 11px;
    color: #777;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
    user-select: none;
}

.wcv-swatch-overflow:hover {
    color: #333;
    text-decoration: underline;
}

/* ----------------------------------------------------------
   Variation label text
   ---------------------------------------------------------- */
.wcv-variation-label {
    font-size: 11px;
    color: #666;
    margin-bottom: 4px;
    min-height: 16px;
    transition: opacity 0.1s ease;
}

.wcv-variation-label span {
    font-weight: 500;
}

/* ----------------------------------------------------------
   Image swap loading state — applies to whatever <img> the
   theme uses as the main product image.
   ---------------------------------------------------------- */
.wcv-loading {
    opacity: 0.55;
    transition: opacity 0.2s ease;
}

/* ----------------------------------------------------------
   Variación agotada — imagen del card con menos opacidad
   ---------------------------------------------------------- */
.wcv-card-outofstock img {
    opacity: 0.45;
    transition: opacity 0.2s ease;
}

.wcv-card-outofstock:hover img {
    opacity: 0.6;
}

/* No bajar la opacidad de los swatches dentro de un card agotado:
   los swatches ya tienen su propia indicación (la rayita). */
.wcv-card-outofstock .wcv-swatch img {
    opacity: 1;
}

/* ----------------------------------------------------------
   Variable card marker (optional override styles per theme)
   ---------------------------------------------------------- */
.wcv-variable-card .wcv-swatches {
    /* inherits above */
}
