/**
 * 🎨 MotorHub - Tom Select Custom Styling
 * 
 * Place at: /home/elraey/public_html/public/assets/css/searchable-selects.css
 * 
 * Makes Tom Select match the Bootstrap 5 RTL theme used by MotorHub
 */

/* Match Bootstrap form-control sizing */
.ts-wrapper {
    width: 100%;
    direction: inherit;
}

.ts-wrapper.single .ts-control {
    background-color: #fff;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    padding: 0.375rem 0.75rem;
    min-height: 38px;
    font-size: 1rem;
    line-height: 1.5;
    color: #212529;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.ts-wrapper.single .ts-control:hover {
    border-color: #b3d7ff;
}

.ts-wrapper.focus .ts-control {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
    outline: 0;
}

.ts-wrapper.disabled .ts-control {
    background-color: #e9ecef;
    opacity: 1;
}

/* Dropdown styling */
.ts-dropdown {
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 0.375rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    margin-top: 4px;
    background: #fff;
    z-index: 1056;
}

.ts-dropdown .option {
    padding: 8px 12px;
    color: #212529;
    cursor: pointer;
    transition: background 0.1s;
}

.ts-dropdown .option.active {
    background-color: #0d6efd;
    color: #fff;
}

.ts-dropdown .option:hover {
    background-color: #e9ecef;
}

.ts-dropdown .option.active:hover {
    background-color: #0b5ed7;
}

/* Highlight matched text */
.ts-dropdown .highlight {
    background-color: #fff3cd;
    color: #000;
    padding: 0 2px;
    border-radius: 2px;
}

.ts-dropdown .option.active .highlight {
    background-color: rgba(255, 255, 255, 0.3);
    color: inherit;
}

.ts-dropdown .ts-dropdown-content {
    padding: 4px 0;
}

.ts-control input {
    color: #212529;
}

.ts-control input::placeholder {
    color: #6c757d;
    opacity: 0.7;
}

/* RTL adjustments */
[dir="rtl"] .ts-wrapper.single .ts-control {
    text-align: right;
}

[dir="rtl"] .ts-wrapper.single .ts-control::after {
    right: auto;
    left: 12px;
}

[dir="rtl"] .ts-dropdown .option {
    text-align: right;
}

/* Selected item styling */
.ts-wrapper.single .ts-control .item {
    color: #212529;
    font-weight: normal;
}

/* Clear button */
.ts-wrapper.has-items .clear-button {
    color: #6c757d;
    opacity: 0.6;
    padding: 0 8px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.ts-wrapper.has-items .clear-button:hover {
    opacity: 1;
    color: #dc3545;
}

/* No results message */
.ts-dropdown .no-results {
    color: #6c757d;
    padding: 12px;
    text-align: center;
    font-size: 0.9rem;
}

/* Sizing variants */
.form-select-sm + .ts-wrapper .ts-control,
.input-sm + .ts-wrapper .ts-control {
    min-height: 31px;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.form-select-lg + .ts-wrapper .ts-control,
.input-lg + .ts-wrapper .ts-control {
    min-height: 48px;
    padding: 0.5rem 1rem;
    font-size: 1.25rem;
}

/* Inside table cells */
table .ts-wrapper.single .ts-control {
    min-height: 32px;
    padding: 0.2rem 0.5rem;
    font-size: 0.875rem;
}

/* Inside modals - higher z-index */
.modal .ts-dropdown {
    z-index: 1060;
}

/* Loading state */
.ts-wrapper.loading::after {
    content: '⏳';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    margin: 0 8px;
}

[dir="rtl"] .ts-wrapper.loading::after {
    left: 8px;
    right: auto;
}

[dir="ltr"] .ts-wrapper.loading::after {
    right: 8px;
    left: auto;
}