/* ==========================================================================
   Select States
   ========================================================================== */

/* Disabled state */
.variations_form.hvp-enabled select:disabled,
.variations_form.hvp-enabled select.hvp-empty {
    background-color: var(--hvp-gray-50);
    border-color: var(--hvp-gray-200);
    border-style: dashed;
    color: var(--hvp-gray-400);
    cursor: not-allowed;
}

/* Single option - auto-selected with lock icon (from legacy plugin) */
.variations_form.hvp-enabled select.hvp-single-option,
.variations_form select[name^="attribute_"].haru-single-option {
    position: relative !important;
    cursor: not-allowed !important;
    background-color: var(--hvp-gray-50) !important;
    border-style: dashed !important;
    border-color: var(--hvp-gray-400) !important;
    border-width: 2px !important;
    color: var(--hvp-gray-600) !important;

    /* Modern visual feedback - grayscale and reduced brightness */
    filter: grayscale(20%) brightness(0.96) !important;
    opacity: 0.85 !important;

    /* Subtle diagonal stripe pattern for visual distinction */
    background-image:
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 3px,
            rgba(0,0,0,0.025) 3px,
            rgba(0,0,0,0.025) 6px
        ),
        linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%) !important;

    /* Modern depth with inset shadow */
    box-shadow:
        inset 0 2px 4px rgba(0,0,0,0.08),
        0 1px 2px rgba(0,0,0,0.05) !important;

    /* Smooth transitions */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;

    /* Typography enhancement */
    font-style: italic !important;
    font-weight: 500 !important;
}

/* Note: Lock icon for single-option dropdowns is handled via wrapper elements
   in hvp-readonly.css (.hvp-lock-indicator class) because <select> elements
   cannot have ::after pseudo-elements (they are replaced elements in HTML). */

/* Hover state for single-option (accessibility) */
.variations_form.hvp-enabled select.hvp-single-option:hover,
.variations_form select[name^="attribute_"].haru-single-option:hover {
    border-color: var(--hvp-gray-500) !important;
    box-shadow:
        inset 0 2px 4px rgba(0,0,0,0.12),
        0 2px 4px rgba(0,0,0,0.08) !important;
}

/* Focus state for single-option (accessibility) */
.variations_form.hvp-enabled select.hvp-single-option:focus,
.variations_form select[name^="attribute_"].haru-single-option:focus {
    outline: 2px solid var(--hvp-info) !important;
    outline-offset: 2px !important;
    border-color: var(--hvp-info) !important;
}

/* Animation when dropdown becomes locked (just-locked class) */
.variations_form.hvp-enabled select.hvp-single-option.just-locked,
.variations_form select[name^="attribute_"].haru-single-option.just-locked {
    animation: hvp-lock-animation 0.5s ease-out;
}

@keyframes hvp-lock-animation {
    0% {
        transform: scale(1);
        filter: grayscale(0%) brightness(1);
    }
    50% {
        transform: scale(1.02);
        filter: grayscale(10%) brightness(0.98);
    }
    100% {
        transform: scale(1);
        filter: grayscale(20%) brightness(0.96);
    }
}

/* Auto-selected state */
.variations_form.hvp-enabled select.hvp-auto-selected {
    background-color: rgba(99, 102, 241, 0.05);
    border-color: var(--hvp-primary-light);
}

/* Has selection */
.variations_form.hvp-enabled select:not(:disabled):not([value=""]) {
    border-color: var(--hvp-success);
    background-color: rgba(34, 197, 94, 0.03);
}

/* Highlight needed - modern blue glow pulse animation (from legacy plugin) */
.variations_form.hvp-enabled select.hvp-highlight-needed,
.variations_form select[name^="attribute_"].haru-highlight-needed {
    animation: hvp-modern-glow-pulse 2s infinite ease-in-out;
    transition: all 0.3s ease;
}

@keyframes hvp-modern-glow-pulse {
    0% {
        box-shadow:
            0 0 0 0 rgba(59, 130, 246, 0.5),
            0 2px 8px rgba(59, 130, 246, 0.1);
        border-color: #3b82f6;
    }
    50% {
        box-shadow:
            0 0 0 8px rgba(59, 130, 246, 0.1),
            0 4px 20px rgba(59, 130, 246, 0.2);
        border-color: #2563eb;
    }
    100% {
        box-shadow:
            0 0 0 0 rgba(59, 130, 246, 0),
            0 2px 8px rgba(59, 130, 246, 0.1);
        border-color: #3b82f6;
    }
}

/* Legacy pulse animation for backwards compatibility */
@keyframes hvp-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(99, 102, 241, 0);
    }
}

/* ==========================================================================
   Update Animations
   ========================================================================== */

/* Updating state - fade out */
.variations_form.hvp-enabled select.hvp-updating {
    opacity: 0.6;
    transform: scale(0.98);
    transition:
        opacity var(--hvp-transition-fast),
        transform var(--hvp-transition-fast);
}

/* Updated state - fade in with subtle pop */
.variations_form.hvp-enabled select.hvp-updated {
    animation: hvp-pop 0.3s ease-out;
}

@keyframes hvp-pop {
    0% {
        opacity: 0.6;
        transform: scale(0.98);
    }
    50% {
        transform: scale(1.01);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ==========================================================================
   Loading State
   ========================================================================== */

.variations_form.hvp-enabled.hvp-loading {
    pointer-events: none;
}

.variations_form.hvp-enabled.hvp-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    z-index: 10;
}

.variations_form.hvp-enabled.hvp-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 32px;
    height: 32px;
    margin: -16px 0 0 -16px;
    border: 3px solid var(--hvp-gray-200);
    border-top-color: var(--hvp-primary);
    border-radius: 50%;
    z-index: 11;
    animation: hvp-spin 0.8s linear infinite;
}

@keyframes hvp-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Individual dropdown loading */
.variations_form.hvp-enabled .value.hvp-loading-wrapper::after {
    content: '';
    position: absolute;
    right: 40px;
    top: 50%;
    width: 16px;
    height: 16px;
    margin-top: -8px;
    border: 2px solid var(--hvp-gray-200);
    border-top-color: var(--hvp-primary);
    border-radius: 50%;
    animation: hvp-spin 0.7s linear infinite;
}

