/* Custom Select Component CSS */
/* Use with Tailwind CSS and "tw-" prefix */

/* Dropdown animation states */
.dropdown {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: all;
}

/* Chevron rotation animation */
.chevron {
    transition: transform 0.2s ease;
}

.chevron.rotated {
    transform: rotate(180deg);
}

/* Check icon animation */
.check-icon {
    opacity: 0;
    transition: opacity 0.15s ease;
}

.dropdown-option.selected .check-icon {
    opacity: 1;
}

/* Focus states for better accessibility */
.select-button:focus {
    outline: none;
}

.dropdown-option:focus {
    outline: none;
}

/* Smooth transitions for interactive states */
.select-button {
    transition: all 0.2s ease;
}

.dropdown-option {
    transition: background-color 0.15s ease, color 0.15s ease;
}

/* Selected option styling */
.dropdown-option.selected {
    background-color: rgba(243, 244, 246, 1); /* tw-bg-gray-100 equivalent */
    font-weight: 500;
}

/* Hover and focus states */
.select-button:hover {
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.select-button:focus,
.select-button.active {
    box-shadow: 0 0 0 3px rgba(156, 163, 175, 0.1);
}

/* Dropdown positioning and z-index */
.custom-select {
    position: relative;
}

.dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    margin-top: 0;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .select-button {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
    
    .dropdown-option {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
}

/* Animation for smooth opening/closing */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Alternative animation classes if you prefer keyframes */
.dropdown.animate-in {
    animation: fadeInDown 0.2s ease forwards;
}

.dropdown.animate-out {
    animation: fadeOutUp 0.2s ease forwards;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .select-button {
        border-width: 2px;
        border-color: #374151;
    }
    
    .dropdown {
        border-width: 2px;
        border-color: #374151;
    }
    
    .dropdown-option:hover,
    .dropdown-option:focus {
        background-color: #374151;
        color: white;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .dropdown,
    .chevron,
    .check-icon,
    .select-button,
    .dropdown-option {
        transition: none;
    }
    
    .dropdown.animate-in,
    .dropdown.animate-out {
        animation: none;
    }
}

/* Dark mode support (if using with WordPress dark mode) */
@media (prefers-color-scheme: dark) {
    .custom-select-dark .select-button {
        background-color: #374151;
        border-color: #4B5563;
        color: #F9FAFB;
    }
    
    .custom-select-dark .dropdown {
        background-color: #374151;
        border-color: #4B5563;
    }
    
    .custom-select-dark .dropdown-option {
        color: #F9FAFB;
    }
    
    .custom-select-dark .dropdown-option:hover,
    .custom-select-dark .dropdown-option:focus {
        background-color: #4B5563;
    }
    
    .custom-select-dark .placeholder {
        color: #9CA3AF;
    }
}