/**
 * White Mark Portal - Autocomplete & Searchable Dropdowns Styling (Tom Select + Bootstrap 5)
 */

/* Control Wrapper */
.ts-wrapper {
    width: 100%;
}

.ts-wrapper.single .ts-control {
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 0.45rem 2.25rem 0.45rem 0.75rem;
    font-size: 0.95rem;
    min-height: 38px;
    line-height: 1.5;
    color: #1e293b;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

/* Small Variant */
.ts-wrapper.form-select-sm .ts-control,
.form-select-sm + .ts-wrapper .ts-control,
.input-group-sm > .ts-wrapper .ts-control {
    min-height: 31px;
    padding: 0.25rem 2rem 0.25rem 0.5rem;
    font-size: 0.85rem;
    border-radius: 6px;
}

/* Focus State */
.ts-wrapper.focus .ts-control {
    border-color: #2563eb !important;
    box-shadow: 0 0 0 0.25rem rgba(37, 99, 235, 0.15) !important;
    outline: 0;
}

/* Invalid State */
.ts-wrapper.is-invalid .ts-control,
.is-invalid + .ts-wrapper .ts-control {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.15) !important;
}

/* Disabled State */
.ts-wrapper.disabled .ts-control {
    background-color: #f1f5f9 !important;
    color: #94a3b8 !important;
    cursor: not-allowed;
    border-color: #e2e8f0;
}

/* Dropdown Menu Container */
.ts-dropdown {
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
    font-size: 0.95rem;
    padding: 4px 0;
    z-index: 1070 !important;
    max-height: 280px;
}

/* Search input inside dropdown */
.ts-dropdown .dropdown-input-wrap {
    padding: 6px;
    position: sticky;
    top: 0;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    z-index: 2;
}

.ts-dropdown .dropdown-input {
    width: 100%;
    padding: 0.35rem 0.65rem 0.35rem 2rem;
    font-size: 0.875rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background-color: #ffffff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 8px center;
    color: #1e293b;
    outline: none;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.ts-dropdown .dropdown-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

/* Options List */
.ts-dropdown .ts-dropdown-content {
    max-height: 220px;
    overflow-y: auto;
    padding: 2px 0;
}

.ts-dropdown .option {
    padding: 0.45rem 0.85rem;
    color: #334155;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background-color 0.12s ease;
}

.ts-dropdown .option:hover,
.ts-dropdown .option.active {
    background-color: rgba(37, 99, 235, 0.08);
    color: #1e3a8a;
    font-weight: 500;
}

.ts-dropdown .option.selected {
    background-color: #2563eb;
    color: #ffffff;
    font-weight: 600;
}

.ts-dropdown .optgroup-header {
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    background: #f1f5f9;
}

/* Clear Button */
.ts-wrapper .clear-button {
    font-size: 1.15rem;
    color: #94a3b8;
    right: 1.85rem;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.15s ease;
}

.ts-wrapper .clear-button:hover {
    opacity: 1;
    color: #ef4444;
}

/* Items inside Multi-select */
.ts-wrapper.multi .ts-control > div {
    background: #e0e7ff;
    color: #1e3a8a;
    border: 1px solid #c7d2fe;
    border-radius: 6px;
    padding: 2px 8px;
    margin: 2px;
    font-size: 0.85rem;
    font-weight: 500;
}

.ts-wrapper.multi .ts-control > div .remove {
    border-left: 1px solid #c7d2fe;
    margin-left: 6px;
    padding-left: 4px;
    color: #4338ca;
}

.ts-wrapper.multi .ts-control > div .remove:hover {
    color: #dc2626;
}

/* No results message */
.ts-dropdown .no-results {
    padding: 0.75rem 1rem;
    color: #64748b;
    font-size: 0.875rem;
    text-align: center;
}
