/* ===== Choices.js Tailwind-friendly full styling ===== */

.choices {
    position: relative;
    width: 100%;
    margin-bottom: 0;
    font-size: 0.875rem;
}

    .choices:focus {
        outline: none;
    }

.choices__inner {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
    width: 100%;
    min-height: 42px;
    padding: 0.375rem 0.75rem;
    border: 1px solid rgb(203 213 225); /* slate-300 */
    border-radius: 0.375rem; /* rounded-md */
    background-color: #fff;
    color: rgb(15 23 42); /* slate-900 */
    font-size: 0.875rem;
    line-height: 1.25rem;
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

    .choices.is-focused .choices__inner,
    .choices__inner:focus-within {
        border-color: rgb(59 130 246); /* blue-500 */
        box-shadow: 0 0 0 3px rgb(191 219 254); /* blue-200 */
    }

.choices.is-disabled .choices__inner {
    background-color: rgb(248 250 252); /* slate-50 */
    color: rgb(148 163 184); /* slate-400 */
    cursor: not-allowed;
}

.choices[data-type*="select-one"] .choices__inner {
    padding-bottom: 0.375rem;
}

.choices[data-type*="select-multiple"] .choices__inner {
    padding-bottom: 0.375rem;
}

.choices__list {
    box-sizing: border-box;
}

.choices__list--single {
    display: inline-block;
    width: 100%;
    padding: 0;
}

    .choices__list--single .choices__item {
        width: 100%;
    }

.choices__list--multiple {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

    .choices__list--multiple .choices__item {
        display: inline-flex;
        align-items: center;
        gap: 0.375rem;
        margin: 0;
        padding: 0.25rem 0.5rem;
        border: 1px solid rgb(191 219 254); /* blue-200 */
        border-radius: 0.375rem;
        background-color: rgb(239 246 255); /* blue-50 */
        color: rgb(30 64 175); /* blue-800 */
        font-size: 0.75rem;
        line-height: 1rem;
    }

        .choices__list--multiple .choices__item.is-highlighted {
            border-color: rgb(147 197 253); /* blue-300 */
            background-color: rgb(219 234 254); /* blue-100 */
        }

.choices__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 0.875rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.7;
}

    .choices__button:hover {
        opacity: 1;
    }

.choices__input {
    display: inline-block;
    width: auto !important;
    min-width: 120px;
    margin: 0;
    padding: 0;
    border: 0 !important;
    outline: none !important;
    background: transparent !important;
    box-shadow: none !important;
    color: rgb(15 23 42); /* slate-900 */
    font-size: 0.875rem;
    line-height: 1.25rem;
}

    .choices__input::placeholder {
        color: rgb(148 163 184); /* slate-400 */
    }

.choices__input--cloned {
    width: 100% !important;
    min-width: 0;
    padding: 0.375rem 0.75rem;
    border: 0;
    background: transparent;
    font-size: 0.875rem;
    line-height: 1.25rem;
}

.choices__placeholder {
    color: rgb(148 163 184); /* slate-400 */
    opacity: 1;
}

.choices__list--dropdown,
.choices__list[aria-expanded] {
    position: absolute;
    top: 100%;
    z-index: 60;
    display: none;
    overflow: hidden;
    width: 100%;
    margin-top: 0.25rem;
    border: 1px solid rgb(203 213 225); /* slate-300 */
    border-radius: 0.375rem;
    background-color: #fff;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    box-sizing: border-box;
}

.choices.is-open .choices__list--dropdown,
.choices.is-open .choices__list[aria-expanded] {
    display: block;
}

.choices__list--dropdown .choices__list,
.choices__list[aria-expanded] .choices__list {
    max-height: 220px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.choices__list--dropdown .choices__item,
.choices__list[aria-expanded] .choices__item {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    cursor: pointer;
}

.choices__list--dropdown .choices__item--selectable,
.choices__list[aria-expanded] .choices__item--selectable {
    color: rgb(15 23 42); /* slate-900 */
}

    .choices__list--dropdown .choices__item--selectable.is-highlighted,
    .choices__list[aria-expanded] .choices__item--selectable.is-highlighted {
        background-color: rgb(241 245 249); /* slate-100 */
        color: rgb(15 23 42);
    }

.choices__item--disabled {
    color: rgb(148 163 184); /* slate-400 */
    cursor: not-allowed;
}

.choices[data-type*="select-one"]::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 0.75rem;
    width: 0.5rem;
    height: 0.5rem;
    margin-top: -0.25rem;
    border-right: 2px solid rgb(100 116 139); /* slate-500 */
    border-bottom: 2px solid rgb(100 116 139);
    transform: rotate(45deg);
    pointer-events: none;
}

.choices.is-open[data-type*="select-one"]::after {
    transform: rotate(-135deg);
    margin-top: -0.05rem;
}

.choices.error .choices__inner {
    border-color: rgb(239 68 68); /* red-500 */
    box-shadow: 0 0 0 3px rgb(254 202 202); /* red-200 */
}

.choices.success .choices__inner {
    border-color: rgb(34 197 94); /* green-500 */
    box-shadow: 0 0 0 3px rgb(187 247 208); /* green-200 */
}

/* Better spacing if used inside modal forms */
.choices + .field-validation-error,
.choices + .error,
.choices + .text-red-500 {
    display: block;
    margin-top: 0.25rem;
}

/* Optional: make dropdown look good in dark overlays/modals */
.modal .choices__list--dropdown,
.modal .choices__list[aria-expanded] {
    z-index: 80;
}

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

.choices__list--dropdown .choices__list::-webkit-scrollbar-thumb,
.choices__list[aria-expanded] .choices__list::-webkit-scrollbar-thumb {
    background: rgb(203 213 225); /* slate-300 */
    border-radius: 9999px;
}

.choices__list--dropdown .choices__list::-webkit-scrollbar-track,
.choices__list[aria-expanded] .choices__list::-webkit-scrollbar-track {
    background: transparent;
}

.choices__button {
    font-size: 16px;
    font-weight: bold;
    color: rgb(100 116 139); /* slate-500 */
    margin-left: 6px;
    line-height: 1;
}

    .choices__button:hover {
        color: rgb(239 68 68); /* red-500 */
    }

/* Theme support */
:root {
    color-scheme: light;
    --app-bg: #ffffff;
    --app-surface: #ffffff;
    --app-surface-2: #f8fafc;
    --app-text: #0f172a;
    --app-muted: #64748b;
    --app-border: #cbd5e1;
    --app-header-bg: #0f172a;
    --app-footer-bg: #0f172a;
}

html[data-theme='dark'] {
    color-scheme: dark;
    --app-bg: #020617;
    --app-surface: #0f172a;
    --app-surface-2: #111827;
    --app-text: #e2e8f0;
    --app-muted: #94a3b8;
    --app-border: #334155;
    --app-header-bg: #111827;
    --app-footer-bg: #111827;
}

.bg-theme-base { background-color: var(--app-bg) !important; }
.bg-theme-surface { background-color: var(--app-surface) !important; }
.bg-theme-surface-2 { background-color: var(--app-surface-2) !important; }
.text-theme-primary { color: var(--app-text) !important; }
.text-theme-muted { color: var(--app-muted) !important; }
.border-theme { border-color: var(--app-border) !important; }
.bg-theme-header { background-color: var(--app-header-bg) !important; }
.bg-theme-footer { background-color: var(--app-footer-bg) !important; }

html[data-theme='dark'] .bg-white { background-color: #0f172a !important; }
html[data-theme='dark'] .bg-slate-50 { background-color: #111827 !important; }
html[data-theme='dark'] .bg-slate-100 { background-color: #111827 !important; }
html[data-theme='dark'] .bg-slate-200 { background-color: #1e293b !important; }
html[data-theme='dark'] .bg-slate-300 { background-color: #334155 !important; }
html[data-theme='dark'] .bg-slate-900 { background-color: #020617 !important; }
html[data-theme='dark'] .text-slate-900,
html[data-theme='dark'] .text-slate-800,
html[data-theme='dark'] .text-slate-700 { color: #e2e8f0 !important; }
html[data-theme='dark'] .text-slate-600,
html[data-theme='dark'] .text-slate-500,
html[data-theme='dark'] .text-slate-400,
html[data-theme='dark'] .text-slate-300 { color: #94a3b8 !important; }
html[data-theme='dark'] .border-slate-200 { border-color: #334155 !important; }
html[data-theme='dark'] .border-slate-300 { border-color: #475569 !important; }
html[data-theme='dark'] .border-slate-800 { border-color: #1e293b !important; }
html[data-theme='dark'] .shadow-blue-200 { box-shadow: 0 20px 45px -20px rgba(59, 130, 246, 0.25) !important; }
html[data-theme='dark'] .shadow-xl { box-shadow: 0 20px 25px -5px rgba(15, 23, 42, 0.7), 0 8px 10px -6px rgba(15, 23, 42, 0.4) !important; }
html[data-theme='dark'] .shadow-lg { box-shadow: 0 10px 15px -3px rgba(15, 23, 42, 0.65), 0 4px 6px -4px rgba(15, 23, 42, 0.5) !important; }
