/* ============================================
   Choices.js Custom Styling
   ============================================ */

/* Choices.js Container */
.choices {
    position: relative;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box;
}

.choices *, .choices *::before, .choices *::after {
    box-sizing: border-box;
}

.choices__inner {
    background-color: #ffffff;
    border: 1px solid #dee2e6 !important;
    border-radius: 8px;
    padding: 0 14px !important;
    min-height: 46px !important;
    height: 46px !important;
    font-size: 0.9375rem;
    line-height: normal;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    display: flex;
    align-items: center;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.choices__inner:hover {
    border-color: #3166ff !important;
    background-color: #fbfcfe;
}

.choices.is-focused .choices__inner,
.choices.is-open .choices__inner {
    border-color: #3166ff !important;
    box-shadow: 0 0 0 3px rgba(49, 102, 255, 0.1), 0 1px 2px rgba(0, 0, 0, 0.05) !important;
    background-color: #ffffff;
}

/* Choices.js Input/Selected Value */
.choices__list--single {
    padding: 0 !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
    height: 100% !important;
}

.choices__list--single .choices__item {
    padding: 0;
    margin: 0;
    color: #495057;
    font-weight: 500;
}

.choices__input {
    background-color: transparent !important;
    margin-bottom: 0 !important;
    padding: 0 !important;
    min-width: 0 !important;
}

.choices__placeholder {
    opacity: 0.6;
    color: #6c757d;
}

/* Choices.js Dropdown Arrow */
.choices[data-type*="select-one"]::after {
    content: "";
    height: 0;
    width: 0;
    border-style: solid;
    border-color: #6c757d transparent transparent transparent;
    border-width: 5px;
    position: absolute;
    right: 14px;
    top: 50%;
    margin-top: -2.5px;
    pointer-events: none;
    transition: all 0.3s ease;
}

.choices[data-type*="select-one"].is-open::after {
    border-color: transparent transparent #6c757d transparent;
    margin-top: -7.5px;
    transform: rotate(180deg); /* Keep this for visual rotation */
}

/* Choices.js Dropdown */
.choices__list--dropdown {
    border-radius: 12px !important;
    border: 1px solid #e9ecef !important;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;
    margin-top: 8px !important;
    background: #ffffff !important;
    overflow: hidden;
    padding: 6px !important;
    z-index: 1000;
}

.choices__list--dropdown.is-active {
    border-color: var(--primary-color, #177dff);
    box-shadow: 0 4px 16px rgba(23, 125, 255, 0.15);
}

/* Choices.js Dropdown Items */
.choices__list--dropdown .choices__item {
    /* Original item styling, kept for non-selectable items if any, but selectable items will override */
    padding: 12px 14px;
    font-size: 0.9375rem;
    color: #495057;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f0f1f3;
}

.choices__list--dropdown .choices__item:last-child {
    border-bottom: none;
}

.choices__list--dropdown .choices__item--selectable {
    padding: 10px 12px !important;
    border-radius: 8px !important;
    transition: all 0.2s ease;
    margin-bottom: 2px;
    font-size: 0.9375rem; /* Ensure font size is consistent */
    color: #495057; /* Ensure default color is consistent */
}

.choices__list--dropdown .choices__item--selectable:last-child {
    margin-bottom: 0;
}

.choices__list--dropdown .choices__item--selectable.is-highlighted {
    background-color: #f0f4ff !important;
    color: #3166ff !important;
}

.choices__list--dropdown .choices__item--selectable:hover {
    color: var(--primary-color, #177dff);
}

/* Choices.js Selected Item */
.choices__list--dropdown .choices__item--selected {
    background-color: rgba(23, 125, 255, 0.15);
    color: var(--primary-color, #177dff);
    font-weight: 600;
}

.choices__list--dropdown .choices__item--selected::after {
    content: "✓";
    position: absolute;
    right: 14px;
    color: var(--primary-color, #177dff);
    font-weight: bold;
}

/* Choices.js in Modal */
/* .modal .choices__inner {
    background-color: #f8f9fa;
} */

.modal .choices.is-focused .choices__inner,
.modal .choices.is-open .choices__inner {
    background-color: #ffffff;
}

/* Choices.js Animation */
.choices__list--dropdown {
    animation: slideDown 0.2s ease;
}

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

/* Choices.js Loading State */
.choices.is-loading .choices__inner {
    position: relative;
}

.choices.is-loading .choices__inner::after {
    content: "";
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid #e9ecef;
    border-top-color: var(--primary-color, #177dff);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: translateY(-50%) rotate(360deg);
    }
}

/* Choices.js Small Variant */
.choices--sm .choices__inner {
    padding: 0 10px !important;
    font-size: 0.8125rem;
    min-height: 33.5px !important;
    height: 33.5px !important;
}

.choices--sm .choices__list--single {
    padding: 0 !important;
    margin: 0 !important;
}

.choices--sm .choices__list--single .choices__item {
    font-size: 0.8125rem;
}

.choices--sm[data-type*="select-one"]::after {
    right: 10px;
}

/* Choices.js Disabled State */
.choices.is-disabled .choices__inner {
    background-color: #e9ecef;
    cursor: not-allowed;
    opacity: 0.6;
}

.choices.is-disabled .choices__list--dropdown {
    display: none;
}

/* Responsive Choices.js */
@media (max-width: 768px) {
    .choices__inner {
        padding: 8px 12px;
        font-size: 0.875rem;
        min-height: 42px;
    }

    .choices__list--dropdown .choices__item {
        padding: 10px 12px;
        font-size: 0.875rem;
    }
}

