/* ================================================
   SEARCH FEATURE STYLES
   ================================================ */

/* --- SEARCH ICON --- */
.search-icon {
    cursor: pointer;
    color: #fff;
    padding: 5px;
    transition: color 0.3s ease;
}

.search-icon:hover {
    color: #098317;
}

/* --- PREVENT BACKGROUND SCROLL JUMPING --- */
body.search-open {
    overflow: hidden; /* Locks the background page in place */
    height: 100vh;    /* Forces page to stay at current viewport height */
}

.search-overlay {
    position: fixed; /* Keep it outside the normal document flow */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    display: none;
    padding: 20px;
    overflow-y: auto; /* Allow the results to scroll inside the overlay */
}

/* Ensure the container doesn't shift the header */
.search-container {
    max-width: 600px;
    margin: 0 auto;
    padding-top: 60px; /* Space from the top of the fixed overlay */
}

/* Mobile: Show search icon */
@media screen and (max-width: 900px) {
    .search-icon {
        display: block;
        position: absolute;
        right: 20px;
        z-index: 1001;
    }
}

/* Desktop: Hide search icon */
@media screen and (min-width: 901px) {
    .search-icon {
        display: none;
    }
}

/* --- SEARCH OVERLAY (Mobile Fullscreen) --- */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    display: none; /* Hidden by default */
    padding: 20px;
}

.search-overlay.active {
    display: block;
}

.search-container {
    max-width: 600px;
    margin: 0 auto;
    padding-top: 20px;
}

.search-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.search-input {
    flex: 1;
    padding: 15px;
    font-size: 18px;
    border: 2px solid #098317;
    border-radius: 8px;
    background: #fff;
    color: #333;
    font-family: "Tektur", sans-serif;
}

.search-input:focus {
    outline: none;
    border-color: #0ab31e;
}

.search-close {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-close:hover {
    color: #098317;
}

/* --- SEARCH RESULTS --- */
.search-results {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
    color: #333;
    overflow-anchor: none;
}

.search-results h2 {
    font-size: 1.2rem;
    color: #098317;
    margin-bottom: 10px;
}

.search-results h3 {
    font-size: 1rem;
    margin: 15px 0 5px 0;
    color: #333;
}

.search-results p {
    margin: 5px 0;
    color: #666;
    line-height: 1.6;
}

.no-results {
    text-align: center;
    color: #999;
    padding: 40px 20px;
    font-size: 1.1rem;
}

.result-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.result-section:last-child {
    border-bottom: none;
}

.result-count {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 20px;
}

/* --- SEARCH RESULT ITEM (Clickable) --- */
.search-result-item {
    display: block;
    text-decoration: none;
    color: inherit;
    padding: 12px;
    margin: 8px 0;
    border-radius: 6px;
    transition: background-color 0.3s ease;
    cursor: pointer;
}


.search-result-item:hover {
    background-color: #098317;  /* Changed from #f0f0f0 to your green */
}

.search-result-item:hover h3,
.search-result-item:hover p {
    color: #fff;  /* Make text white when hovering */
}

.search-result-item h3 {
    color: #098317;
    margin: 0 0 5px 0;
    font-size: 1rem;
}

.search-result-item p {
    margin: 0;
    color: #666;
    line-height: 1.6;
}


/* ================================================
   DESKTOP SEARCH BAR
   ================================================ */

/* Hide desktop search by default */
.desktop-search {
    display: none;
}

/* Show on desktop */
@media screen and (min-width: 901px) {
    .desktop-search {
        display: block;
        position: relative;
        margin-left: auto;
        margin-right: 20px;
    }

    .desktop-search-wrapper {
        display: flex;
        align-items: center;
        background: rgba(255, 255, 255, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.3);
        border-radius: 8px;
        padding: 8px 15px;
        width: 150px;
        transition: all 0.3s ease;
    }

    .desktop-search-wrapper:focus-within {
        background: rgba(255, 255, 255, 0.15);
        border-color: #098317;
        box-shadow: 0 0 0 3px rgba(9, 131, 23, 0.1);
    }

    .search-icon-desktop {
        color: rgba(255, 255, 255, 0.6);
        margin-right: 10px;
        flex-shrink: 0;
    }

    .desktop-search-input {
        background: transparent;
        border: none;
        color: #fff;
        font-size: 14px;
        width: 100%;
        outline: none;
        font-family: "Tektur", sans-serif;
    }

    .desktop-search-input::placeholder {
        color: rgba(255, 255, 255, 0.5);
    }

    /* Desktop Search Results Dropdown */
    .desktop-search-results {
        position: absolute;
        top: calc(100% + 10px);
        left: 0;
        width: 450px;
        max-height: 400px;
        overflow-y: auto;
        background: #fff;
        border-radius: 8px;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
        z-index: 3000;
        display: none;
        padding: 15px;
        overflow-anchor: none;
    }

    .desktop-search-results.active {
        display: block;
    }

    /* Results styling (reuse mobile styles) */
    .desktop-search-results h2 {
        font-size: 1.1rem;
        color: #098317;
        margin-bottom: 10px;
    }

    .desktop-search-results .result-count {
        color: #666;
        font-size: 0.85rem;
        margin-bottom: 15px;
    }

    .desktop-search-results .result-section {
        margin-bottom: 20px;
        padding-bottom: 15px;
        border-bottom: 1px solid #eee;
    }

    .desktop-search-results .result-section:last-child {
        border-bottom: none;
    }

    .desktop-search-results .search-result-item {
        display: block;
        text-decoration: none;
        color: inherit;
        padding: 10px;
        margin: 5px 0;
        border-radius: 6px;
        transition: background-color 0.3s ease;
        cursor: pointer;
    }

    .desktop-search-results .search-result-item:hover {
        background-color: #098317;
    }

    .desktop-search-results .search-result-item:hover h3,
    .desktop-search-results .search-result-item:hover p {
        color: #fff;
    }

    .desktop-search-results .search-result-item h3 {
        color: #098317;
        margin: 0 0 5px 0;
        font-size: 0.95rem;
    }

    .desktop-search-results .search-result-item p {
        margin: 0;
        color: #666;
        line-height: 1.5;
        font-size: 0.85rem;
    }

    .desktop-search-results .no-results {
        text-align: center;
        color: #999;
        padding: 30px 20px;
        font-size: 1rem;
    }
}