/**
 * Heedo Vase Configurator v2 – Dropdown con immagini
 */

/* ─── Container ─── */
.hvc-configurator {
    margin: 0 0 24px 0;
    font-family: inherit;
}

.hvc-attribute-group {
    margin-bottom: 18px;
}

.hvc-attribute-group:last-child {
    margin-bottom: 0;
}

/* ─── Label ─── */
.hvc-attribute-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #333;
    margin-bottom: 6px;
}

/* ─── Dropdown wrapper ─── */
.hvc-dropdown {
    position: relative;
    width: 100%;
    max-width: 380px;
    user-select: none;
    z-index: 10;
}

/* Stacking: quando un dropdown è aperto, sta sopra agli altri */
.hvc-attribute-group:nth-child(1) .hvc-dropdown { z-index: 30; }
.hvc-attribute-group:nth-child(2) .hvc-dropdown { z-index: 20; }
.hvc-attribute-group:nth-child(3) .hvc-dropdown { z-index: 10; }

/* ─── Trigger ─── */
.hvc-dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 48px;
    padding: 8px 14px;
    background: #fff;
    border: 1.5px solid #d0d0d0;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.hvc-dropdown-trigger:hover {
    border-color: #999;
}

.hvc-dropdown-trigger:focus {
    outline: none;
    border-color: #555;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.06);
}

.hvc-dropdown.hvc-open .hvc-dropdown-trigger {
    border-color: #333;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.08);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

/* Placeholder */
.hvc-dropdown-placeholder {
    flex: 1;
    color: #999;
    font-size: 14px;
}

/* Valore selezionato nel trigger */
.hvc-dropdown-selected {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 32px;
}

.hvc-dropdown-selected .hvc-option-img {
    width: 32px;
    height: 32px;
    border-radius: 5px;
    object-fit: cover;
    flex-shrink: 0;
}

.hvc-dropdown-selected .hvc-option-label {
    font-size: 14px;
    color: #222;
    font-weight: 500;
}

/* Freccia */
.hvc-dropdown-arrow {
    flex-shrink: 0;
    color: #888;
    transition: transform 0.25s ease;
}

.hvc-dropdown.hvc-open .hvc-dropdown-arrow {
    transform: rotate(180deg);
}

/* ─── Lista opzioni ─── */
.hvc-dropdown-list {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    background: #fff;
    border: 1.5px solid #333;
    border-top: none;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    max-height: 280px;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.hvc-dropdown.hvc-open .hvc-dropdown-list {
    display: block;
    animation: hvcSlideDown 0.2s ease;
}

@keyframes hvcSlideDown {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Scrollbar */
.hvc-dropdown-list::-webkit-scrollbar { width: 6px; }
.hvc-dropdown-list::-webkit-scrollbar-track { background: transparent; }
.hvc-dropdown-list::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

/* ─── Singola opzione ─── */
.hvc-dropdown-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background-color 0.15s;
}

.hvc-dropdown-option:hover {
    background: #f5f5f5;
}

.hvc-dropdown-option.hvc-option-active {
    background: #f0f0f0;
}

.hvc-dropdown-option.hvc-option-active .hvc-option-label {
    font-weight: 600;
}

/* Opzione non disponibile: nascosta */
.hvc-dropdown-option.hvc-option-disabled {
    display: none !important;
}

/* Separatore */
.hvc-dropdown-option + .hvc-dropdown-option:not(.hvc-option-disabled) {
    border-top: 1px solid #f0f0f0;
}

/* Immagine nell'opzione */
.hvc-option-img {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid #e8e8e8;
}

/* Label dell'opzione */
.hvc-option-label {
    font-size: 14px;
    color: #333;
    line-height: 1.3;
}

/* ─── Messaggio non disponibile ─── */
.hvc-unavailable-msg {
    display: none;
    padding: 10px 14px;
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
    border-radius: 6px;
    font-size: 13px;
    margin-top: 12px;
}

.hvc-unavailable-msg.hvc-visible {
    display: block;
}

/* ─── Reset ─── */
.hvc-reset-link {
    display: inline-block;
    margin-top: 10px;
    font-size: 12px;
    color: #888;
    text-decoration: underline;
    cursor: pointer;
    transition: color 0.2s;
}

.hvc-reset-link:hover {
    color: #333;
}

/* ─── Transizione immagine prodotto ─── */
.woocommerce-product-gallery__image img,
.woocommerce-product-gallery .wp-post-image {
    transition: opacity 0.3s ease;
}

.hvc-image-loading .woocommerce-product-gallery__image img,
.hvc-image-loading .woocommerce-product-gallery .wp-post-image {
    opacity: 0.4;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .hvc-dropdown {
        max-width: 100%;
    }

    .hvc-dropdown-trigger {
        min-height: 44px;
        padding: 6px 12px;
    }

    .hvc-dropdown-list {
        max-height: 220px;
    }

    .hvc-option-img {
        width: 30px;
        height: 30px;
    }

    .hvc-dropdown-selected .hvc-option-img {
        width: 28px;
        height: 28px;
    }
}
