/**
 * Haru Variations Pro - Styles
 *
 * Modern, beautiful variation selector design with smooth animations.
 * Combines progressive UI aesthetics with high performance.
 *
 * @package HaruVariationsPro
 * @version 1.0.0
 */

/* ==========================================================================
   CSS Variables - Easy theming
   ========================================================================== */

:root {
    /* Primary colors */
    --hvp-primary: #6366f1;
    --hvp-primary-light: #818cf8;
    --hvp-primary-dark: #4f46e5;

    /* Status colors */
    --hvp-success: #22c55e;
    --hvp-warning: #f59e0b;
    --hvp-error: #ef4444;
    --hvp-info: #3b82f6;

    /* Neutral colors */
    --hvp-gray-50: #f9fafb;
    --hvp-gray-100: #f3f4f6;
    --hvp-gray-200: #e5e7eb;
    --hvp-gray-300: #d1d5db;
    --hvp-gray-400: #9ca3af;
    --hvp-gray-500: #6b7280;
    --hvp-gray-600: #4b5563;
    --hvp-gray-700: #374151;
    --hvp-gray-800: #1f2937;
    --hvp-gray-900: #111827;

    /* Shadows */
    --hvp-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --hvp-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --hvp-shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --hvp-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    /* Focus ring */
    --hvp-focus-ring: 0 0 0 3px rgba(99, 102, 241, 0.3);

    /* Transitions */
    --hvp-transition-fast: 150ms ease;
    --hvp-transition: 200ms ease;
    --hvp-transition-slow: 300ms ease;

    /* Border radius */
    --hvp-radius-sm: 4px;
    --hvp-radius: 6px;
    --hvp-radius-lg: 8px;
    --hvp-radius-xl: 12px;
}

/* ==========================================================================
   Form Container
   ========================================================================== */

.variations_form.hvp-enabled {
    position: relative;
}

.variations_form.hvp-enabled .variations {
    margin-bottom: 1.5rem;
}

/* ==========================================================================
   Variation Rows
   ========================================================================== */

.variations_form.hvp-enabled .variations tr {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--hvp-gray-100);
}

.variations_form.hvp-enabled .variations tr:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.variations_form.hvp-enabled .variations .label {
    display: block;
    width: 100%;
}

.variations_form.hvp-enabled .variations .label label {
    display: block;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--hvp-gray-700);
    margin-bottom: 0.375rem;
    text-transform: capitalize;
}

.variations_form.hvp-enabled .variations .value {
    display: block;
    width: 100%;
    position: relative;
}

/* ==========================================================================
   Select Dropdowns - Main Styling
   ========================================================================== */

.variations_form.hvp-enabled select {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--hvp-gray-800);
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1.25rem 1.25rem;
    border: 2px solid var(--hvp-gray-200);
    border-radius: var(--hvp-radius-lg);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition:
        border-color var(--hvp-transition),
        box-shadow var(--hvp-transition),
        background-color var(--hvp-transition);
}

.variations_form.hvp-enabled select:hover:not(:disabled) {
    border-color: var(--hvp-gray-300);
}

.variations_form.hvp-enabled select:focus {
    outline: none;
    border-color: var(--hvp-primary);
    box-shadow: var(--hvp-focus-ring);
}

/* ==========================================================================
   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;
}

/* ==========================================================================
   Add to Cart Button States
   ========================================================================== */

.variations_form.hvp-enabled .single_add_to_cart_button {
    transition:
        background-color var(--hvp-transition),
        border-color var(--hvp-transition),
        opacity var(--hvp-transition),
        transform var(--hvp-transition);
}

.variations_form.hvp-enabled .single_add_to_cart_button.disabled,
.variations_form.hvp-enabled .single_add_to_cart_button.wc-variation-selection-needed {
    opacity: 0.5;
    cursor: not-allowed;
}

.variations_form.hvp-enabled .single_add_to_cart_button.hvp-ready {
    opacity: 1;
    background-color: var(--hvp-success);
    border-color: var(--hvp-success);
}

.variations_form.hvp-enabled .single_add_to_cart_button.hvp-ready:hover {
    background-color: #16a34a;
    transform: translateY(-1px);
}

/* ==========================================================================
   Variation Display
   ========================================================================== */

.variations_form.hvp-enabled .woocommerce-variation {
    padding: 1rem;
    margin-top: 1rem;
    background: var(--hvp-gray-50);
    border-radius: var(--hvp-radius-lg);
    border: 1px solid var(--hvp-gray-100);
}

.variations_form.hvp-enabled .woocommerce-variation-price {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--hvp-gray-900);
    margin-bottom: 0.5rem;
}

.variations_form.hvp-enabled .woocommerce-variation-availability {
    font-size: 0.875rem;
}

.variations_form.hvp-enabled .woocommerce-variation-availability .stock {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    border-radius: var(--hvp-radius);
    font-weight: 500;
}

.variations_form.hvp-enabled .woocommerce-variation-availability .in-stock {
    background-color: rgba(34, 197, 94, 0.1);
    color: #15803d;
}

.variations_form.hvp-enabled .woocommerce-variation-availability .in-stock::before {
    content: '';
    width: 8px;
    height: 8px;
    background-color: var(--hvp-success);
    border-radius: 50%;
}

.variations_form.hvp-enabled .woocommerce-variation-availability .out-of-stock {
    background-color: rgba(239, 68, 68, 0.1);
    color: #b91c1c;
}

.variations_form.hvp-enabled .woocommerce-variation-availability .out-of-stock::before {
    content: '';
    width: 8px;
    height: 8px;
    background-color: var(--hvp-error);
    border-radius: 50%;
}

/* ==========================================================================
   Reset Link
   ========================================================================== */

.variations_form.hvp-enabled .reset_variations {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--hvp-gray-500);
    background: var(--hvp-gray-100);
    border-radius: var(--hvp-radius);
    text-decoration: none;
    transition:
        background-color var(--hvp-transition),
        color var(--hvp-transition);
    margin-top: 0.75rem;
}

.variations_form.hvp-enabled .reset_variations:hover {
    background: var(--hvp-gray-200);
    color: var(--hvp-gray-700);
}

.variations_form.hvp-enabled .reset_variations::before {
    content: '↺';
    font-size: 1rem;
}

/* ==========================================================================
   Error Message
   ========================================================================== */

.variations_form.hvp-enabled .hvp-error {
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--hvp-radius);
    color: var(--hvp-error);
    font-size: 0.875rem;
    font-weight: 500;
}

/* ==========================================================================
   Reduced Motion - Accessibility (respects user motion preferences)
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .variations_form.hvp-enabled select,
    .variations_form.hvp-enabled .single_add_to_cart_button {
        transition: none;
    }

    /* Replace pulsing animations with static visual indicators */
    .variations_form.hvp-enabled select.hvp-highlight-needed,
    .variations_form select[name^="attribute_"].haru-highlight-needed {
        animation: none !important;
        box-shadow: 0 0 0 2px #3b82f6 !important;
        border-color: #3b82f6 !important;
    }

    .variations_form.hvp-enabled select.hvp-updated {
        animation: none;
    }

    /* Lock animation - static instead of animated */
    .variations_form.hvp-enabled select.hvp-single-option.just-locked,
    .variations_form select[name^="attribute_"].haru-single-option.just-locked {
        animation: none !important;
    }

    .variations_form.hvp-enabled.hvp-loading::before {
        animation: none;
        border-color: var(--hvp-primary);
    }
}

/* ==========================================================================
   Dark Mode Support (if theme supports)
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .dark .variations_form.hvp-enabled select,
    [data-theme="dark"] .variations_form.hvp-enabled select {
        background-color: var(--hvp-gray-800);
        border-color: var(--hvp-gray-600);
        color: var(--hvp-gray-100);
    }

    .dark .variations_form.hvp-enabled .variations .label label,
    [data-theme="dark"] .variations_form.hvp-enabled .variations .label label {
        color: var(--hvp-gray-200);
    }

    .dark .variations_form.hvp-enabled .woocommerce-variation,
    [data-theme="dark"] .variations_form.hvp-enabled .woocommerce-variation {
        background-color: var(--hvp-gray-800);
        border-color: var(--hvp-gray-700);
    }
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media (max-width: 768px) {
    .variations_form.hvp-enabled select {
        padding: 0.875rem 2.5rem 0.875rem 1rem;
        font-size: 1rem;
    }

    .variations_form.hvp-enabled .variations tr {
        margin-bottom: 1.25rem;
        padding-bottom: 1.25rem;
    }
}

@media (min-width: 768px) {
    .variations_form.hvp-enabled .variations tr {
        flex-direction: row;
        align-items: center;
        gap: 1rem;
    }

    .variations_form.hvp-enabled .variations .label {
        width: auto;
        min-width: 120px;
        flex-shrink: 0;
    }

    .variations_form.hvp-enabled .variations .label label {
        margin-bottom: 0;
    }

    .variations_form.hvp-enabled .variations .value {
        flex: 1;
    }
}

/* ==========================================================================
   Legacy Plugin Compatibility & Theme Override Protection
   ========================================================================== */

/* MAXIMUM CSS SPECIFICITY - Override theme styles for normal (non-single-option) dropdowns */
html body.woocommerce div.product form.variations_form table.variations tbody tr td.value select[name^="attribute_"]:not(.hvp-single-option):not(.haru-single-option) {
    opacity: 1 !important;
    background-color: #ffffff !important;
    border: 2px solid var(--hvp-gray-200) !important;
    color: var(--hvp-gray-800) !important;
    cursor: pointer !important;
    pointer-events: auto !important;
    filter: none !important;
    font-style: normal !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.75rem center !important;
    background-size: 1.25rem 1.25rem !important;
    padding-right: 2.5rem !important;
}

/* Ensure disabled attribute on normal dropdowns doesn't break interactivity */
html body.woocommerce div.product form.variations_form table.variations tbody tr td.value select[name^="attribute_"][disabled]:not(.hvp-single-option):not(.haru-single-option) {
    opacity: 1 !important;
    background-color: #ffffff !important;
    border: 2px solid var(--hvp-gray-200) !important;
    color: var(--hvp-gray-800) !important;
    cursor: pointer !important;
    pointer-events: auto !important;
    filter: none !important;
}

/* Theme-specific overrides for PrintSpace and similar themes */
.haru-woo-product-variations select[name^="attribute_"]:not(.hvp-single-option):not(.haru-single-option),
.printspace select[name^="attribute_"]:not(.hvp-single-option):not(.haru-single-option) {
    opacity: 1 !important;
    background-color: #ffffff !important;
    border: 2px solid var(--hvp-gray-200) !important;
    color: var(--hvp-gray-800) !important;
    cursor: pointer !important;
    pointer-events: auto !important;
}

/* Override any green styling from other plugins/themes */
.variations_form select[name^="attribute_"]:not(.hvp-single-option):not(.haru-single-option):not(.hvp-highlight-needed):not(.haru-highlight-needed) {
    background-color: #ffffff !important;
    border-color: var(--hvp-gray-200) !important;
    color: var(--hvp-gray-800) !important;
    box-shadow: none !important;
}

/* Focus state override for normal dropdowns */
.variations_form select[name^="attribute_"]:focus:not(.hvp-single-option):not(.haru-single-option):not(.hvp-highlight-needed):not(.haru-highlight-needed) {
    border-color: var(--hvp-primary) !important;
    box-shadow: var(--hvp-focus-ring) !important;
    outline: none !important;
}

/* Note: Responsive lock icon adjustments are handled via wrapper elements
   in hvp-readonly.css because <select> elements cannot have ::after
   pseudo-elements. */

/* ==========================================================================
   Error Container and Messages (v3.0)
   ========================================================================== */

.hvp-error-container {
    margin-bottom: 1rem;
}

.hvp-error-container .hvp-error {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: var(--hvp-radius-lg);
    font-size: 0.875rem;
    font-weight: 500;
}

/* Error types */
.hvp-error.hvp-error-network,
.hvp-error.hvp-error-server_error,
.hvp-error.hvp-error-timeout {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #b91c1c;
}

.hvp-error.hvp-error-rate_limited {
    background-color: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
    color: #b45309;
}

.hvp-error.hvp-error-cache_miss {
    background-color: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: #1d4ed8;
}

.hvp-error.hvp-error-invalid_product {
    background-color: rgba(107, 114, 128, 0.1);
    border: 1px solid rgba(107, 114, 128, 0.2);
    color: #374151;
}

/* Error message */
.hvp-error-message {
    flex: 1;
}

/* Error spinner (for cache building) */
.hvp-error-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: hvp-spin 0.8s linear infinite;
    flex-shrink: 0;
}

/* Retry button */
.hvp-retry-btn {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #fff;
    background-color: var(--hvp-primary);
    border: none;
    border-radius: var(--hvp-radius);
    cursor: pointer;
    transition: background-color var(--hvp-transition);
    flex-shrink: 0;
}

.hvp-retry-btn:hover {
    background-color: var(--hvp-primary-dark);
}

.hvp-retry-btn:focus {
    outline: none;
    box-shadow: var(--hvp-focus-ring);
}

/* ==========================================================================
   Enhanced Loading States (v3.0)
   ========================================================================== */

/* Individual dropdown loading */
.variations_form.hvp-enabled select.hvp-loading {
    background-image:
        url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24'%3e%3ccircle cx='12' cy='12' r='10' stroke='%23e5e7eb' stroke-width='3'/%3e%3cpath fill='%236366f1' d='M12 2a10 10 0 0 1 10 10h-3a7 7 0 0 0-7-7V2z'/%3e%3c/svg%3e"),
        linear-gradient(to right, var(--hvp-gray-50), var(--hvp-gray-100));
    background-position: right 0.75rem center, center;
    background-repeat: no-repeat, no-repeat;
    background-size: 1.25rem 1.25rem, 100% 100%;
    animation: hvp-loading-pulse 1.5s ease-in-out infinite;
    pointer-events: none;
}

@keyframes hvp-loading-pulse {
    0%, 100% {
        opacity: 0.8;
    }
    50% {
        opacity: 1;
    }
}

/* Form loading state - disable all interactions */
.variations_form.hvp-enabled select.hvp-form-loading {
    pointer-events: none;
    opacity: 0.7;
}

/* Loading wrapper with spinner */
.variations_form.hvp-enabled .value.hvp-loading-wrapper {
    position: relative;
}

.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;
    z-index: 5;
}

/* ==========================================================================
   Debounce Visual Feedback (v3.0)
   ========================================================================== */

/* Visual indicator that change is being processed */
.variations_form.hvp-enabled select.hvp-processing {
    border-color: var(--hvp-primary-light);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

/* ==========================================================================
   Cache Building State (v3.0)
   ========================================================================== */

.variations_form.hvp-enabled.hvp-cache-building .variations {
    opacity: 0.6;
    pointer-events: none;
}

.variations_form.hvp-enabled.hvp-cache-building::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.5);
    z-index: 10;
}

/* ==========================================================================
   Variation Container Visibility (v3.0)
   ========================================================================== */

.variations_form.hvp-enabled .woocommerce-variation.hvp-visible,
.variations_form.hvp-enabled .single_variation.hvp-visible {
    animation: hvp-fade-in 0.3s ease-out;
}

@keyframes hvp-fade-in {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   Accessibility Improvements (v3.0)
   ========================================================================== */

/* Focus visible for keyboard navigation */
.variations_form.hvp-enabled select:focus-visible {
    outline: 2px solid var(--hvp-primary);
    outline-offset: 2px;
    box-shadow: none;
}

/* Screen reader only text */
.hvp-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Ensure error messages are announced to screen readers */
.hvp-error-container[role="alert"] {
    /* Force screen reader announcement */
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .variations_form.hvp-enabled.hvp-loading::after,
    .variations_form.hvp-enabled.hvp-loading::before,
    .hvp-error-container,
    .hvp-retry-btn {
        display: none !important;
    }
}

/* ==========================================================================
   High Contrast Mode Support
   ========================================================================== */

@media (prefers-contrast: high) {
    .variations_form.hvp-enabled select {
        border-width: 3px;
    }

    .variations_form.hvp-enabled select:focus {
        outline: 3px solid currentColor;
        outline-offset: 2px;
    }

    .hvp-error {
        border-width: 2px;
    }

    .hvp-retry-btn {
        border: 2px solid currentColor;
    }
}

/* ==========================================================================
   UI Highlighting States (Feature 6)
   Visual feedback for dropdown selection status
   ========================================================================== */

/* Needs Selection - Attention-grabbing pulse animation */
.variations_form.hvp-enabled select.hvp-needs-selection {
    border-color: var(--hvp-info);
    animation: hvpNeedsSelection 2s ease-in-out infinite;
}

@keyframes hvpNeedsSelection {
    0%, 100% {
        border-color: var(--hvp-info);
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.3);
    }
    50% {
        border-color: #60a5fa;
        box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
    }
}

/* Completed - Subtle success indication */
.variations_form.hvp-enabled select.hvp-completed {
    border-color: var(--hvp-success);
    background-color: rgba(34, 197, 94, 0.03);
}

.variations_form.hvp-enabled select.hvp-completed:focus {
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

/* Normal - Default state (no special styling) */
.variations_form.hvp-enabled select.hvp-normal {
    border-color: var(--hvp-gray-300);
    background-color: #fff;
}

/* Accessibility: Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .variations_form.hvp-enabled select.hvp-needs-selection {
        animation: none;
        border-color: var(--hvp-info);
        border-width: 2px;
    }
}

/* ==========================================================================
   Hide "Choose an option" Placeholder
   ========================================================================== */

/**
 * Hide the "Choose an option" placeholder from all variation dropdowns.
 * This creates a cleaner UX where users see actual options immediately.
 *
 * The placeholder is identified by its empty value attribute (value="").
 * This is the standard WooCommerce way of creating placeholder options.
 *
 * Note: The placeholder will reappear when the form is reset via the
 * "Clear" link, as WooCommerce re-adds it during reset.
 */
.variations_form.hvp-enabled select[name^="attribute_"] option[value=""] {
    display: none !important;
}

/**
 * Exception: Show placeholder when dropdown has no value selected
 * This ensures users can still see "Choose an option" on initial load
 * or after clearing, but only for dropdowns without a selection.
 *
 * Note: CSS cannot detect :empty on <select> elements, so this is handled
 * via JavaScript by adding/removing a class when selections change.
 */
.variations_form.hvp-enabled select.hvp-show-placeholder option[value=""] {
    display: block !important;
}
