/**
 * Global Search Styles
 * Premium Black & Gold Theme
 */

/* Search Container in Header */
.global-search-container {
    position: relative;
    flex: 0 0 auto;
    max-width: 400px;
    z-index: 1001;
    /* Ensure dropdown appears above other header elements */
}

/* Ensure header doesn't clip dropdown */
.app-header {
    overflow: visible !important;
}

.global-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.global-search-input {
    width: 280px;
    padding: 0.625rem 1rem 0.625rem 2.5rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    color: var(--text-primary, #e8e8e8);
    font-size: 0.9rem;
    outline: none;
    transition: all 0.3s ease;
}

.global-search-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.global-search-input:focus {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(212, 175, 55, 0.5);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
    width: 320px;
}

.global-search-icon {
    position: absolute;
    left: 1rem;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.9rem;
    pointer-events: none;
    transition: color 0.3s;
}

.global-search-input:focus+.global-search-icon,
.global-search-input:not(:placeholder-shown)+.global-search-icon {
    color: var(--gold, #d4af37);
}

/* Search Dropdown */
.global-search-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    min-width: 380px;
    max-width: 500px;
    max-height: 70vh;
    overflow-y: auto;
    background: rgba(20, 20, 25, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

/* Search Groups */
.search-group {
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.search-group:last-of-type {
    border-bottom: none;
}

.search-group-label {
    padding: 0.5rem 1rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gold, #d4af37);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.search-group-label i {
    font-size: 0.65rem;
}

/* Search Result Item */
.search-result-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.search-result-item:hover,
.search-result-item.selected {
    background: rgba(212, 175, 55, 0.1);
}

.search-result-thumb {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.05);
}

.search-result-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.search-premium-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: linear-gradient(135deg, var(--gold, #d4af37), #c9a227);
    color: #000;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.5rem;
}

.search-result-info {
    flex: 1;
    min-width: 0;
}

.search-result-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary, #e8e8e8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-subtitle {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.search-result-meta {
    font-size: 0.7rem;
    color: var(--gold, #d4af37);
    margin-top: 2px;
}

.search-result-arrow {
    color: rgba(255, 255, 255, 0.2);
    font-size: 0.75rem;
    transition: color 0.2s, transform 0.2s;
}

.search-result-item:hover .search-result-arrow {
    color: var(--gold, #d4af37);
    transform: translateX(3px);
}

/* See All Results Link */
.search-see-all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    color: var(--gold, #d4af37);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    transition: background 0.2s;
}

.search-see-all:hover {
    background: rgba(212, 175, 55, 0.1);
}

/* No Results */
.search-no-results,
.search-error {
    padding: 2rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
}

.search-no-results i,
.search-error i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.search-no-results p,
.search-error p {
    margin: 0 0 1rem;
}

.search-no-results a {
    color: var(--gold, #d4af37);
    text-decoration: none;
}

.search-no-results a:hover {
    text-decoration: underline;
}

/* Loading State */
.search-loading {
    padding: 2rem;
    text-align: center;
    color: var(--gold, #d4af37);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

/* Recent & Popular Searches */
.search-suggestions {
    padding: 0.5rem 0;
}

.search-popular-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
}

.search-tag {
    padding: 0.375rem 0.875rem;
    background: rgba(212, 175, 55, 0.15);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 50px;
    color: var(--gold, #d4af37);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.search-tag:hover {
    background: rgba(212, 175, 55, 0.25);
    border-color: rgba(212, 175, 55, 0.5);
}

.search-recent-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.search-recent-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.search-recent-item i {
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.8rem;
}

.search-recent-item span {
    flex: 1;
    color: var(--text-primary, #e8e8e8);
    font-size: 0.9rem;
}

.search-remove-recent {
    background: none;
    border: none;
    padding: 0.25rem;
    color: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: color 0.2s;
}

.search-remove-recent:hover {
    color: #f44336;
}

.search-clear-recent {
    display: block;
    width: 100%;
    padding: 0.75rem;
    background: none;
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.8rem;
    cursor: pointer;
    transition: color 0.2s;
}

.search-clear-recent:hover {
    color: var(--gold, #d4af37);
}

/* Search Overlay */
.search-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

/* Mobile Styles */
@media (max-width: 768px) {
    .global-search-container {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        padding: 0.75rem;
        background: rgba(10, 10, 15, 0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        z-index: 1001;
        transform: translateY(-100%);
        transition: transform 0.3s ease;
    }

    .global-search-container.mobile-open {
        transform: translateY(0);
    }

    .global-search-input {
        width: 100%;
        padding-right: 3rem;
    }

    .global-search-input:focus {
        width: 100%;
    }

    .global-search-close {
        position: absolute;
        right: 0.5rem;
        background: none;
        border: none;
        color: rgba(255, 255, 255, 0.5);
        padding: 0.5rem;
        cursor: pointer;
    }

    .global-search-dropdown {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        min-width: unset;
        max-width: unset;
        max-height: calc(100vh - 60px);
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    /* Mobile Search Button (in header) */
    .mobile-search-btn {
        display: flex !important;
    }
}

@media (min-width: 769px) {
    .mobile-search-btn {
        display: none !important;
    }

    .global-search-close {
        display: none;
    }
}

/* Scrollbar Styles */
.global-search-dropdown::-webkit-scrollbar {
    width: 6px;
}

.global-search-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.global-search-dropdown::-webkit-scrollbar-thumb {
    background: rgba(212, 175, 55, 0.3);
    border-radius: 3px;
}

.global-search-dropdown::-webkit-scrollbar-thumb:hover {
    background: rgba(212, 175, 55, 0.5);
}