/* Choices.js Custom Styles - Matching input-wrapper Design */

/* Main Container */
.input-wrapper--with-icon .choices {
    margin-bottom: 0;
    width: 100%;
    position: relative;
}

/* Remove default Choices.js margin */
.choices {
    margin-bottom: 0 !important;
}

/* Main Input Field - Matching input-wrapper style exactly */
.input-wrapper--with-icon .choices__inner {
    min-height: 56px !important;
    padding: 0 60px 0 16px !important; /* Increased right padding from 56px to 60px */
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    border-radius: 12px !important;
    background-color: #fff !important;
    font-size: 16px !important;
    font-family: 'Quicksand', sans-serif !important;
    font-weight: 500 !important;
    transition: all 0.3s ease !important;
    display: flex !important;
    align-items: center !important;
    margin-bottom: 0 !important;
    box-shadow: none !important;
    cursor: pointer !important;
}

/* Single select value container */
.input-wrapper--with-icon .choices[data-type*="select-one"] .choices__inner {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

.input-wrapper--with-icon .choices__list--single {
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    height: 100% !important;
    width: calc(100% - 10px) !important; /* Prevent text from going under icon */
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

/* Placeholder text - matching input style */
.input-wrapper--with-icon .choices__placeholder {
    opacity: 1 !important;
    color: #999 !important;
    font-weight: 400 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

/* Selected item */
.input-wrapper--with-icon .choices__list--single .choices__item {
    color: #333 !important;
    font-size: 16px !important;
    font-weight: 500 !important;
    padding: 0 !important;
    margin: 0 !important;
    margin-left: 23px !important; /* Prevent text from going under icon */
    display: block !important;
    background: transparent !important;
    border: none !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    max-width: calc(100% - 23px) !important; /* Adjust for margin */
}

/* Focus state - matching input-wrapper */
.input-wrapper--with-icon .choices.is-focused .choices__inner,
.input-wrapper--with-icon .choices.is-open .choices__inner {
    border-color: #feb816 !important;
    box-shadow: 0 0 0 3px rgba(254, 184, 22, 0.1) !important;
}

/* Hide the default dropdown arrow */
.input-wrapper--with-icon .choices__inner::after {
    display: none !important;
}

/* Remove any button styling from Choices */
.input-wrapper--with-icon .choices__button {
    display: none !important;
}

/* Keep the icon visible and properly positioned */
.input-wrapper--with-icon .input-icon {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 10;
    width: 24px;
    height: 24px;
    opacity: 0.6;
    transition: all 0.3s ease;
}

.input-wrapper--with-icon .choices.is-open + .input-icon {
    opacity: 1;
    transform: translateY(-50%) rotate(180deg);
}

/* Ensure dropdown is clickable */
.input-wrapper--with-icon .choices[data-type*="select-one"] {
    cursor: pointer !important;
}

.input-wrapper--with-icon .choices[data-type*="select-one"] .choices__inner {
    cursor: pointer !important;
}

/* Make sure disabled state doesn't interfere */
.input-wrapper--with-icon .choices:not(.is-disabled) .choices__inner {
    cursor: pointer !important;
}

/* Dropdown Menu */
.choices__list--dropdown,
.choices__list[aria-expanded] {
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    margin-top: 8px;
    overflow: hidden;
    z-index: 9999;
    animation: slideDown 0.2s ease-out;
}

.choices__list--dropdown .choices__list,
.choices__list[aria-expanded] .choices__list {
    max-height: 300px;
    overflow-y: auto;
}

/* Search Input in Dropdown */
.choices__input {
    padding: 12px 16px !important;
    font-size: 16px !important;
    font-family: 'Quicksand', sans-serif !important;
    background-color: #f9f9f9 !important;
    border: none !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
    margin-bottom: 0 !important;
}

.choices__input:focus {
    outline: none !important;
    background-color: #fff !important;
}

/* Dropdown Items */
.choices__list--dropdown .choices__item,
.choices__list[aria-expanded] .choices__item {
    padding: 14px 16px !important;
    font-size: 15px !important;
    font-family: 'Quicksand', sans-serif !important;
    color: #333 !important;
    transition: background-color 0.2s ease !important;
}

.choices__list--dropdown .choices__item--selectable.is-highlighted,
.choices__list[aria-expanded] .choices__item--selectable.is-highlighted {
    background-color: #feb816 !important;
    color: white !important;
}

.choices__list--dropdown .choices__item--selectable:hover,
.choices__list[aria-expanded] .choices__item--selectable:hover {
    background-color: #feb816 !important;
    color: white !important;
}

/* Selected item in dropdown (when opened) */
.choices__item--selectable.is-selected {
    background-color: #fff3d9 !important;
    color: #333 !important;
}

/* No results message */
.choices__item--selectable.is-disabled {
    padding: 20px !important;
    text-align: center !important;
    color: #999 !important;
    font-style: italic !important;
}

/* Loading state */
.choices.is-loading::after {
    border-color: #feb816 transparent transparent transparent !important;
}

/* Disabled state */
.input-wrapper--with-icon .choices.is-disabled .choices__inner {
    background-color: #f5f5f5;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Animation */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .input-wrapper--with-icon .choices__inner {
        min-height: 52px;
        padding: 14px 52px 14px 16px !important;
        font-size: 16px !important; /* Prevents zoom on iOS */
    }
    
    .choices__list--dropdown,
    .choices__list[aria-expanded] {
        max-height: 70vh !important;
    }
    
    .choices__list--dropdown .choices__list,
    .choices__list[aria-expanded] .choices__list {
        max-height: calc(70vh - 80px) !important;
    }
    
    .choices__list--dropdown .choices__item,
    .choices__list[aria-expanded] .choices__item {
        padding: 16px !important;
        font-size: 16px !important; /* Prevents zoom on iOS */
        min-height: 48px;
    }
    
    .choices__input {
        font-size: 16px !important; /* Prevents zoom on iOS */
    }
}

/* Touch-Friendly Tap Targets */
@media (hover: none) and (pointer: coarse) {
    .choices__list--dropdown .choices__item,
    .choices__list[aria-expanded] .choices__item {
        padding: 18px 16px !important;
        min-height: 52px !important;
    }
}

/* Remove default Choices.js button styling */
.choices__button {
    background-image: none;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.choices__button:hover {
    opacity: 1;
}

/* Scrollbar styling for dropdown */
.choices__list--dropdown::-webkit-scrollbar,
.choices__list[aria-expanded]::-webkit-scrollbar {
    width: 8px;
}

.choices__list--dropdown::-webkit-scrollbar-track,
.choices__list[aria-expanded]::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.choices__list--dropdown::-webkit-scrollbar-thumb,
.choices__list[aria-expanded]::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.choices__list--dropdown::-webkit-scrollbar-thumb:hover,
.choices__list[aria-expanded]::-webkit-scrollbar-thumb:hover {
    background: #feb816;
}

/* Ensure proper positioning */
.input-wrapper--with-icon {
    position: relative;
}

.input-wrapper--with-icon .choices {
    position: relative;
}

/* Fix for multiple selects (if needed later) */
.choices[data-type*="select-multiple"] .choices__inner,
.choices[data-type*="text"] .choices__inner {
    cursor: text;
    padding: 8px 56px 8px 16px !important;
}

/* Accessibility improvements */
.choices__list--dropdown .choices__item--selectable:focus,
.choices__list[aria-expanded] .choices__item--selectable:focus {
    outline: 2px solid #feb816;
    outline-offset: -2px;
}

