/* ============================================================
   SEARCH COMPONENT STYLES
   Theme-aware styling for BusOva search
   ============================================================ */

/* ---------------------------------------------------------
   HEADER SEARCH BOX
   --------------------------------------------------------- */
.header-search {
    position: relative;
    width: 100%;
    max-width: 320px;
}

@media (max-width: 991.98px) {
    .header-search {
        max-width: 100%;
        margin: 0.75rem 0;
        order: 10;
    }
}

/* Search Input - Base (works in dark navbar) */
.header-search-input {
    width: 100%;
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.header-search-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.header-search-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

/* Search Icon */
.header-search-icon {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.6);
    pointer-events: none;
    font-size: 0.85rem;
}

/* Clear Button */
.header-search-clear {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    display: none;
}

.header-search-clear:hover {
    color: #fff;
}

/* ---------------------------------------------------------
   SEARCH DROPDOWN - LIGHT THEME
   --------------------------------------------------------- */
.search-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    min-width: 360px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 1050;
    max-height: 70vh;
    overflow-y: auto;
    display: none;
    
    /* Light theme defaults */
    background: #ffffff;
    border: 1px solid var(--border-color, #bcc5cc);
}

[data-bs-theme="light"] .search-dropdown,
.theme-light .search-dropdown {
    background: #ffffff;
    border-color: #e2e5e9;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
}

@media (max-width: 991.98px) {
    .search-dropdown {
        position: fixed;
        top: auto;
        left: 1rem;
        right: 1rem;
        min-width: auto;
        max-height: 60vh;
    }
}

.search-dropdown.show {
    display: block;
    animation: searchDropdownIn 0.2s ease;
}

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

/* Dropdown Header */
.search-dropdown-header {
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e9ecef;
    color: #6c757d;
}

[data-bs-theme="light"] .search-dropdown-header,
.theme-light .search-dropdown-header {
    border-color: #e9ecef;
    color: #6c757d;
}

/* Section Title */
.search-dropdown-section {
    padding: 0.5rem;
}

.search-dropdown-section-title {
    padding: 0.5rem 0.75rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
}

[data-bs-theme="light"] .search-dropdown-section-title,
.theme-light .search-dropdown-section-title {
    color: #6c757d;
}

/* Search Result Item */
.search-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: 10px;
    text-decoration: none;
    transition: background 0.15s ease;
    color: #212529;
}

[data-bs-theme="light"] .search-dropdown-item,
.theme-light .search-dropdown-item {
    color: #212529;
}

.search-dropdown-item:hover,
.search-dropdown-item.active {
    background: #f1f3f5;
    color: #212529;
    text-decoration: none;
}

[data-bs-theme="light"] .search-dropdown-item:hover,
[data-bs-theme="light"] .search-dropdown-item.active,
.theme-light .search-dropdown-item:hover,
.theme-light .search-dropdown-item.active {
    background: #f1f3f5;
    color: #212529;
}

/* Item Icon */
.search-dropdown-item-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(13, 110, 253, 0.1);
    color: #0d6efd;
    flex-shrink: 0;
    font-size: 0.9rem;
}

/* Item Thumbnail */
.search-dropdown-item-thumb {
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: 8px;
    background: #f1f3f5;
    flex-shrink: 0;
}

/* Item Content */
.search-dropdown-item-content {
    flex-grow: 1;
    min-width: 0;
}

.search-dropdown-item-title {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-dropdown-item-meta {
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #6c757d;
}

[data-bs-theme="light"] .search-dropdown-item-meta,
.theme-light .search-dropdown-item-meta {
    color: #6c757d;
}

/* Footer */
.search-dropdown-footer {
    padding: 0.75rem 1rem;
    text-align: center;
    border-top: 1px solid #e9ecef;
}

[data-bs-theme="light"] .search-dropdown-footer,
.theme-light .search-dropdown-footer {
    border-color: #e9ecef;
}

.search-dropdown-footer a {
    font-size: 0.85rem;
    color: #0d6efd;
    text-decoration: none;
    font-weight: 500;
}

.search-dropdown-footer a:hover {
    text-decoration: underline;
}

/* Empty & Loading States */
.search-dropdown-empty,
.search-dropdown-loading {
    padding: 2rem 1rem;
    text-align: center;
    color: #6c757d;
}

.search-dropdown-empty i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
    display: block;
}

.search-dropdown-loading i {
    font-size: 1.5rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Keyboard Focus */
.search-dropdown-item.keyboard-focus {
    background: #e9ecef;
    outline: 2px solid #0d6efd;
    outline-offset: -2px;
}

/* ---------------------------------------------------------
   SEARCH DROPDOWN - DARK THEME
   --------------------------------------------------------- */
[data-bs-theme="dark"] .search-dropdown,
.theme-dark .search-dropdown {
    background: var(--bg-card, #141c2f);
    border-color: var(--border-subtle, #273155);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

[data-bs-theme="dark"] .search-dropdown-header,
.theme-dark .search-dropdown-header {
    border-color: var(--border-subtle, #273155);
    color: var(--text-muted, #aab1c7);
}

[data-bs-theme="dark"] .search-dropdown-section-title,
.theme-dark .search-dropdown-section-title {
    color: var(--text-muted, #aab1c7);
}

[data-bs-theme="dark"] .search-dropdown-item,
.theme-dark .search-dropdown-item {
    color: var(--text-main, #e5e9f5);
}

[data-bs-theme="dark"] .search-dropdown-item:hover,
[data-bs-theme="dark"] .search-dropdown-item.active,
.theme-dark .search-dropdown-item:hover,
.theme-dark .search-dropdown-item.active {
    background: rgba(14, 155, 255, 0.15);
    color: #ffffff;
}

[data-bs-theme="dark"] .search-dropdown-item-icon,
.theme-dark .search-dropdown-item-icon {
    background: var(--accent-soft, rgba(14, 155, 255, 0.25));
    color: var(--accent, #0E9BFF);
}

[data-bs-theme="dark"] .search-dropdown-item-thumb,
.theme-dark .search-dropdown-item-thumb {
    background: var(--bg-card-soft, #1a2340);
}

[data-bs-theme="dark"] .search-dropdown-item-meta,
.theme-dark .search-dropdown-item-meta {
    color: var(--text-muted, #aab1c7);
}

[data-bs-theme="dark"] .search-dropdown-footer,
.theme-dark .search-dropdown-footer {
    border-color: var(--border-subtle, #273155);
}

[data-bs-theme="dark"] .search-dropdown-footer a,
.theme-dark .search-dropdown-footer a {
    color: var(--accent, #0E9BFF);
}

[data-bs-theme="dark"] .search-dropdown-footer a:hover,
.theme-dark .search-dropdown-footer a:hover {
    color: var(--accent-hover, #3bb2ff);
}

[data-bs-theme="dark"] .search-dropdown-empty,
[data-bs-theme="dark"] .search-dropdown-loading,
.theme-dark .search-dropdown-empty,
.theme-dark .search-dropdown-loading {
    color: var(--text-muted, #aab1c7);
}

[data-bs-theme="dark"] .search-dropdown-item.keyboard-focus,
.theme-dark .search-dropdown-item.keyboard-focus {
    background: rgba(14, 155, 255, 0.2);
    outline-color: var(--accent, #0E9BFF);
}

/* ---------------------------------------------------------
   SEARCH RESULTS PAGE - LIGHT THEME
   --------------------------------------------------------- */
.search-hero {
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, rgba(13, 110, 253, 0.08) 0%, rgba(13, 110, 253, 0) 100%);
    border: 1px solid var(--border-color, #bcc5cc);
}

[data-bs-theme="light"] .search-hero,
.theme-light .search-hero {
    background: linear-gradient(135deg, rgba(13, 110, 253, 0.08) 0%, transparent 100%);
    border-color: #e2e5e9;
}

.search-input-large {
    font-size: 1.25rem;
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
}

/* Category Tabs */
.search-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.search-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    background: #ffffff;
    border: 1px solid #e2e5e9;
    color: #212529;
}

[data-bs-theme="light"] .search-tab,
.theme-light .search-tab {
    background: #ffffff;
    border-color: #e2e5e9;
    color: #212529;
}

.search-tab:hover {
    border-color: #0d6efd;
    color: #0d6efd;
    text-decoration: none;
}

.search-tab.active {
    background: #0d6efd;
    border-color: #0d6efd;
    color: #ffffff;
}

.search-tab .count {
    background: rgba(0, 0, 0, 0.1);
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
}

.search-tab.active .count {
    background: rgba(255, 255, 255, 0.25);
}

/* Result Cards */
.result-section {
    margin-bottom: 2rem;
}

.result-section h2 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.result-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 0.75rem;
    text-decoration: none;
    transition: all 0.2s ease;
    background: #ffffff;
    border: 1px solid #e2e5e9;
    color: #212529;
}

[data-bs-theme="light"] .result-card,
.theme-light .result-card {
    background: #ffffff;
    border-color: #e2e5e9;
    color: #212529;
}

.result-card:hover {
    border-color: #0d6efd;
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    color: #212529;
    text-decoration: none;
}

.result-thumb {
    width: 60px;
    height: 45px;
    object-fit: cover;
    border-radius: 8px;
    background: #f1f3f5;
    flex-shrink: 0;
}

.result-icon {
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(13, 110, 253, 0.1);
    color: #0d6efd;
    flex-shrink: 0;
}

.result-content {
    flex-grow: 1;
    min-width: 0;
}

.result-title {
    font-weight: 600;
    margin-bottom: 0.15rem;
}

.result-meta {
    font-size: 0.85rem;
    color: #6c757d;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 3rem;
    color: #6c757d;
}

.no-results i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
    display: block;
}

/* ---------------------------------------------------------
   SEARCH RESULTS PAGE - DARK THEME
   --------------------------------------------------------- */
[data-bs-theme="dark"] .search-hero,
.theme-dark .search-hero {
    background: linear-gradient(135deg, rgba(14, 155, 255, 0.12) 0%, transparent 100%);
    border-color: var(--border-subtle, #273155);
}

[data-bs-theme="dark"] .search-tab,
.theme-dark .search-tab {
    background: var(--bg-card, #141c2f);
    border-color: var(--border-subtle, #273155);
    color: var(--text-main, #e5e9f5);
}

[data-bs-theme="dark"] .search-tab:hover,
.theme-dark .search-tab:hover {
    border-color: var(--accent, #0E9BFF);
    color: var(--accent, #0E9BFF);
}

[data-bs-theme="dark"] .search-tab.active,
.theme-dark .search-tab.active {
    background: var(--accent, #0E9BFF);
    border-color: var(--accent, #0E9BFF);
    color: #ffffff;
}

[data-bs-theme="dark"] .result-card,
.theme-dark .result-card {
    background: var(--bg-card, #141c2f);
    border-color: var(--border-subtle, #273155);
    color: var(--text-main, #e5e9f5);
}

[data-bs-theme="dark"] .result-card:hover,
.theme-dark .result-card:hover {
    border-color: var(--accent, #0E9BFF);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    color: #ffffff;
}

[data-bs-theme="dark"] .result-thumb,
.theme-dark .result-thumb {
    background: var(--bg-card-soft, #1a2340);
}

[data-bs-theme="dark"] .result-icon,
.theme-dark .result-icon {
    background: var(--accent-soft, rgba(14, 155, 255, 0.25));
    color: var(--accent, #0E9BFF);
}

[data-bs-theme="dark"] .result-meta,
.theme-dark .result-meta {
    color: var(--text-muted, #aab1c7);
}

[data-bs-theme="dark"] .no-results,
.theme-dark .no-results {
    color: var(--text-muted, #aab1c7);
}

[data-bs-theme="dark"] .search-input-large,
.theme-dark .search-input-large {
    background: var(--bg-card-soft, #1a2340);
    border-color: var(--border-subtle, #273155);
    color: var(--text-main, #e5e9f5);
}

[data-bs-theme="dark"] .search-input-large:focus,
.theme-dark .search-input-large:focus {
    border-color: var(--accent, #0E9BFF);
    box-shadow: 0 0 0 3px rgba(14, 155, 255, 0.25);
}
