/* Search Container */
.manual-search-container {
    position: relative;
    display: flex;
    align-items: center;
}

/* Search Input */
.search-input {
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    /* Matches buttons */
    color: #ffffff;
    font-family: 'Arial', sans-serif;
    /* Fallback for better input typing */
    font-size: 14px;
    padding: 8px 12px;
    width: 180px;
    transition: all 0.3s ease;
    outline: none;
}

/* Use Sui Generis if desired, but Arial is safer for inputs to avoid layout shifts/rendering issues during typing */
/* Overriding to match brand if preferred: */
.search-input {
    font-family: 'Sui Generis', sans-serif;
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    font-size: 10px;
    /* Smaller placeholder */
    letter-spacing: 1px;
}

.search-input:focus {
    background-color: rgba(255, 255, 255, 0.2);
    /* Brand color from logo/download button */
    box-shadow: 0 0 10px rgba(239, 64, 92, 0.5);
    /* width: 280px; Removed expansion to prevent layout shift */
}

/* Search Results Dropdown */
.search-results-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    /* Matches input width (which expands, so need JS to sync or use min-width) */
    min-width: 300px;
    /* Ensure dropdown is wide enough even if input shrinks */
    background-color: #000000;
    border: 1px solid #333;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 350px;
    overflow-y: auto;
    z-index: 20010;
    /* Above header z-index 20000 */
    display: none;
    /* Hidden by default */
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.9);
    margin-top: 5px;
    /* Slight gap */
}

.search-results-dropdown.active {
    display: block;
}

/* Scrollbar styling for results */
.search-results-dropdown::-webkit-scrollbar {
    width: 6px;
}

.search-results-dropdown::-webkit-scrollbar-thumb {
    background-color: #666;
    border-radius: 4px;
}

.search-results-dropdown::-webkit-scrollbar-track {
    background-color: #222;
}

/* Toggle Button (Hidden on Desktop) */
.search-toggle {
    display: none;
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 0;
    margin-right: 0;
    transition: color 0.3s;
}

.search-toggle:hover {
    color: #EF405C;
}

/* Responsive adjustments */
@media (max-width: 1000px) {

    /* Show Toggle */
    .search-toggle {
        display: block;
        margin-right: 15px;
    }

    /* Hide wrapper initially */
    .search-wrapper {
        display: none;
        position: fixed;
        /* Fixed to viewport so it floats above everything */
        top: 80px;
        /* Below header height */
        left: 0;
        right: 0;
        width: 100%;
        /* Changed from 100vw to 100% to avoid horizontal scroll */
        background-color: #000000;
        padding: 20px;
        border-bottom: 3px solid #EF405C;
        /* Visual Separation */
        z-index: 20005;
        /* Above other content */
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.9);
    }

    /* When active class added via JS to container */
    .manual-search-container.active .search-wrapper {
        display: flex;
        flex-direction: column;
        align-items: center;
        /* Stack input and results */
    }

    /* Input full width on mobile popup */
    .search-input {
        width: 100%;
        max-width: 600px;
        font-size: 16px;
        /* Avoid iOS zoom */
        margin: 0 auto;
        padding: 12px;
        background-color: #222;
        border: 1px solid #444;
    }

    .search-input:focus {
        width: 100%;
        border-color: #EF405C;
    }

    /* Dropdown under input on mobile */
    .search-results-dropdown {
        position: relative;
        /* Flow relative to input wrapper */
        top: 15px;
        left: 0;
        right: 0;
        width: 100%;
        min-width: unset;
        max-width: 600px;
        margin: 0 auto;
        max-height: 60vh;
        border: none;
        background-color: transparent;
        border-top: 1px solid #333;
        padding-top: 10px;
    }

    /* Highlight Toggle when active */
    .manual-search-container.active .search-toggle {
        color: #EF405C;
    }
}

/* --- Search Result Item Styles --- */

.search-result-item {
    padding: 15px;
    border-bottom: 1px solid #222;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background-color: #111;
}

.result-title {
    font-family: 'Sui Generis', sans-serif;
    font-size: 13px;
    color: #FD724C;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: normal;
}

.result-snippet {
    font-family: 'Arial', sans-serif;
    /* Clean font for reading large chunks of text */
    font-size: 14px;
    line-height: 1.5;
    color: #cccccc;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    /* Limit height if necessary, but snippets are already cropped in JS */
}

/* Override font if UI prefers Sui Generis for consistency, but keep it small */
.result-snippet {
    font-family: 'Sui Generis', sans-serif;
    font-size: 12px;
    letter-spacing: 0.5px;
}

.highlight {
    color: #FFFFFF;
    background-color: rgba(239, 64, 92, 0.4);
    padding: 0 2px;
    border-radius: 2px;
    font-weight: bold;
}

.search-result-item:hover .result-title {
    color: #EF405C;
}

/* Desktop Dropdown specific item padding */
@media (min-width: 1001px) {
    .search-result-item {
        padding: 12px 15px;
    }
}