/**
 * Search Component CSS
 * Styling for searchable select components
 */

/* Search Container Styles */
.search-container {
    margin-bottom: 1rem;
}

.search-container label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

/* Search Input Styles */
.search-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    font-size: 0.95rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.search-input:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Search List Container */
.search-list-container {
    position: relative;
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 0.25rem 0.25rem;
    background-color: #fff;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Search List Item */
.search-list-item {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #e9ecef;
    cursor: pointer;
    transition: background-color 0.2s ease;
    user-select: none;
}

.search-list-item:hover {
    background-color: #f8f9fa;
}

.search-list-item:last-child {
    border-bottom: none;
}

.search-list-item.active {
    background-color: #e7f3ff;
    border-left: 3px solid #0056b3;
    padding-left: calc(0.75rem - 3px);
}

/* No Results Message */
.search-no-results {
    padding: 1rem;
    text-align: center;
    color: #6c757d;
    font-size: 0.9rem;
}

/* Loading State */
.search-loading {
    padding: 1rem;
    text-align: center;
}

.search-loading .spinner-border {
    width: 1rem;
    height: 1rem;
    border-width: 0.15em;
}

/* Highlight Match Text */
.search-highlight {
    background-color: #fff3cd;
    font-weight: 500;
    padding: 0 2px;
    border-radius: 2px;
}

/* Selected Item Display */
.search-selected-item {
    background-color: #d1ecf1;
    border: 1px solid #bee5eb;
    border-radius: 0.25rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.search-selected-item .item-name {
    font-weight: 500;
    color: #0c5460;
}

.search-selected-item .clear-btn {
    background: none;
    border: none;
    color: #0c5460;
    cursor: pointer;
    padding: 0;
    font-size: 1rem;
    line-height: 1;
}

.search-selected-item .clear-btn:hover {
    color: #d32f2f;
}

/* Search Form Section */
.search-form-section {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.search-form-section h6 {
    margin-bottom: 1rem;
    color: #333;
    font-size: 0.95rem;
}

/* Responsive */
@media (max-width: 576px) {
    .search-list-container {
        max-height: 250px;
    }

    .search-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Dark Mode Support (optional) */
@media (prefers-color-scheme: dark) {
    .search-input {
        background-color: #2d2d2d;
        border-color: #444;
        color: #fff;
    }

    .search-list-container {
        background-color: #2d2d2d;
        border-color: #444;
        box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
    }

    .search-list-item {
        color: #fff;
        border-bottom-color: #444;
    }

    .search-list-item:hover {
        background-color: #3d3d3d;
    }
}
