/**
 * Combobox Component Styles
 * Accessible dropdown with text input support
 */

/* Wrapper */
.combobox-wrapper {
    position: relative;
    width: 100%;
}

.combobox-wrapper.open .coffee-input {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom-color: transparent;
}

/* Listbox dropdown */
.combobox-listbox {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    max-height: 240px;
    overflow-y: auto;
    margin: 0;
    padding: 0;
    list-style: none;
    background: white;
    border: 1px solid rgb(111 78 55 / 20%);
    border-top: none;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 4px 12px rgb(0 0 0 / 10%);

    /* Smooth scroll on mobile */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* Option item */
.combobox-option {
    padding: 12px 16px;
    font-size: 15px;
    color: var(--coffee-text, #57534E);
    cursor: pointer;
    transition: background-color 0.15s ease;

    /* Touch-friendly target size */
    min-height: 44px;
    display: flex;
    align-items: center;
}

.combobox-option:hover,
.combobox-option.highlighted {
    background: rgb(111 78 55 / 8%);
}

.combobox-option:active {
    background: rgb(111 78 55 / 15%);
}

/* Selected state visual */
.combobox-option[aria-selected="true"] {
    background: rgb(111 78 55 / 12%);
    font-weight: 500;
}

/* Empty state message */
.combobox-empty {
    padding: 16px;
    font-size: 14px;
    color: #9CA3AF;
    text-align: center;
    font-style: italic;
}

/* Scrollbar styling */
.combobox-listbox::-webkit-scrollbar {
    width: 6px;
}

.combobox-listbox::-webkit-scrollbar-track {
    background: transparent;
}

.combobox-listbox::-webkit-scrollbar-thumb {
    background: rgb(111 78 55 / 20%);
    border-radius: 3px;
}

.combobox-listbox::-webkit-scrollbar-thumb:hover {
    background: rgb(111 78 55 / 35%);
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .combobox-option {
        padding: 14px 16px;
        font-size: 16px; /* Prevent iOS zoom */
    }

    .combobox-listbox {
        max-height: 200px;
    }
}

/* Keyboard focus indicator */
.combobox-option:focus-visible {
    outline: 2px solid var(--coffee-accent, #6F4E37);
    outline-offset: -2px;
}

/* Animation for dropdown */
.combobox-wrapper.open .combobox-listbox {
    animation: combobox-slide-down 0.15s ease-out;
}

@keyframes combobox-slide-down {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .combobox-wrapper.open .combobox-listbox {
        animation: none;
    }
}
