/**
 * Stiluri pentru Color Swatches
 * Afișează variațiile de culoare ca cercuri colorate
 */

/* Container pentru swatches */
.color-swatches-container {
    margin: 10px 0 0 0;
    overflow: visible;
}

/* Select ascuns pentru funcționalitatea WooCommerce */
.color-swatch-select {
    display: none !important;
}

/* Container pentru cercurile de culoare */
.color-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    overflow: visible;
}

/* Cercul de culoare individual */
.color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #e0e0e0;
    transition: all 0.2s ease;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    /* Background color setat din style attribute via CSS variable */
    background-color: var(--swatch-color, #cccccc);
}

/* Hover pe swatch */
.color-swatch:hover {
    transform: scale(1.1);
    border-color: #590202;
    z-index: 2;
}

/* Swatch selectat */
.color-swatch.selected {
    border-color: #ffffff;
    border-width: 2px;
    box-shadow: 0 0 0 1px #4a0101;
}

/* Indicator de check pentru swatch selectat */
.color-swatch.selected::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Pentru culori deschise, folosim text negru */
.color-swatch.light-color.selected::after {
    color: #333;
    text-shadow: none;
}

/* Swatch dezactivat (nu este disponibil) */
.color-swatch.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    position: relative;
}

.color-swatch.disabled::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background-color: #999;
    transform: rotate(-45deg);
}

/* Tooltip pentru numele culorii - dezactivat pe swatches principale */
.color-swatch::before {
    display: none;
}

/* Triunghi pentru tooltip - dezactivat */
.color-swatch:not(.selected)::after {
    display: none;
}

/* Pentru swatch selectat, păstrăm checkmark-ul */
.color-swatch.selected::after {
    content: '✓';
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    bottom: auto;
    transform: translate(-50%, -50%);
    border: none;
    opacity: 1;
    visibility: visible;
}

/* Label pentru atribut */
.color-swatches-label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    font-size: var(--font-size-base, 14px);
}

/* ============================================
   Cercuri de culoare în dropdown options
   ============================================ */
.variation-dropdown-option .option-color-circle,
.variation-selector-button .selected-color-circle {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
    /* Background color setat din style attribute via CSS variable */
    background-color: var(--circle-color, #cccccc);
}

/* Cercuri în dropdown options */
.variation-dropdown-option {
    display: flex;
    align-items: center;
}

.variation-dropdown-option .option-color-circle {
    margin: 0 10px;
}

.variation-dropdown-option .option-name {
    flex: 0 0 auto;
}

.variation-dropdown-option .option-price {
    margin-left: auto;
}

/* Responsive */
@media (max-width: 768px) {
    .color-swatch {
        width: 35px;
        height: 35px;
    }

    .color-swatches {
        gap: 8px;
        overflow: visible;
    }
    
    .variation-dropdown-option .option-color-circle,
    .variation-selector-button .selected-color-circle {
        width: 18px;
        height: 18px;
    }
}

/* Integrare cu sistemul de variații existent */
.variations .color-swatches-container {
    margin: 0;
}

.variations tr td.value .color-swatches-container {
    padding: 5px 0;
}

/* Permite swatches-urilor să iasă în afara celulelor de tabel */
.variations td.value {
    overflow: visible;
}

/* Stiluri pentru când e în modal/popup */
.variation-mobile-modal .color-swatches {
    overflow: visible;
}

.variation-mobile-modal .color-swatch {
    width: 36px;
    height: 36px;
}

/* Poziționare sub variation-selector-button */
.variation-selector-wrapper .color-swatches-container {
    order: 2;
    margin-top: 10px;
    overflow: visible;
}

/* Wrapper trebuie să permită overflow pentru swatches scalate */
.variation-selector-wrapper {
    overflow: visible;
}
