/* WCAG 2.1 AA Compliant Styling */
.wcag-searchable-combobox {
    position: relative;
    margin-bottom: 1rem;
}

.wcag-combobox-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: #000000; /* High contrast */
}

.wcag-combobox-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.wcag-combobox-input {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 0.75rem;
    border: 2px solid #666666;
    border-radius: 4px;
    font-size: 16px; /* Prevents zoom on iOS */
    background-color: #ffffff;
    color: #000000;
    line-height: 1.5;
}

.wcag-combobox-input:focus {
    outline: 3px solid #005fcc; /* 4.5:1 contrast ratio */
    outline-offset: 2px;
    border-color: #005fcc;
}

.wcag-combobox-button {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: #000000;
}

.wcag-combobox-button:focus {
    outline: 3px solid #005fcc;
    outline-offset: 2px;
    border-radius: 2px;
}

.wcag-combobox-arrow {
    transition: transform 0.2s ease;
    display: inline-block;
}

.wcag-combobox-button[aria-expanded="true"] .wcag-combobox-arrow {
    transform: rotate(180deg);
}

.wcag-combobox-listbox {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 300px;
    overflow-y: auto;
    background-color: #ffffff;
    border: 2px solid #666666;
    border-top: none;
    border-radius: 0 0 4px 4px;
    list-style: none;
    margin: 0;
    padding: 0;
    z-index: 1000;
}

.wcag-combobox-option {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid #e0e0e0;
    color: #000000;
    line-height: 1.5;
}

.wcag-combobox-option:last-child {
    border-bottom: none;
}

.wcag-combobox-option:hover,
.wcag-combobox-option:focus {
    background-color: #f0f8ff; /* High contrast with text */
    color: #000000;
}

.wcag-combobox-option[aria-selected="true"] {
    background-color: #005fcc;
    color: #ffffff;
}

.wcag-combobox-option[aria-selected="true"]:focus {
    background-color: #004499;
}

.wcag-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;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .wcag-combobox-input,
    .wcag-combobox-listbox {
        border-color: #000000;
        border-width: 3px;
    }
    
    .wcag-combobox-input:focus {
        background-color: #ffff00;
        color: #000000;
    }
}

/* Large text support */
@media (prefers-reduced-motion: no-preference) {
    .wcag-combobox-listbox {
        scrollbar-width: thin;
        scrollbar-color: #666666 #f0f0f0;
    }
}

/* Mobile responsive */
@media (max-width: 768px) {
    .wcag-combobox-listbox {
        max-height: 200px;
    }

    .wcag-combobox-option {
        padding: 1rem;
        font-size: 16px; /* Minimum touch target size */
    }
}

/* Disabled state styling */
.wcag-combobox-input:disabled,
.wcag-combobox-input.wcag-combobox-disabled {
    background-color: #f5f5f5;
    color: #757575;
    cursor: not-allowed;
    border-color: #cccccc;
}

.wcag-combobox-button:disabled,
.wcag-combobox-button[aria-disabled="true"] {
    cursor: not-allowed;
    color: #757575;
    opacity: 0.6;
}

.wcag-combobox-container-disabled {
    opacity: 0.7;
}

.wcag-combobox-label-disabled {
    color: #757575;
}

.wcag-combobox-header-disabled {
    color: #757575;
}

/* High contrast mode support for disabled state */
@media (prefers-contrast: high) {
    .wcag-combobox-input:disabled,
    .wcag-combobox-input.wcag-combobox-disabled {
        background-color: #e0e0e0;
        color: #505050;
        border-color: #808080;
    }
}
