/* Global Search Bar Styles - Desktop Defaults (Light Theme) */
.nav-search-container {
    position: relative;
    margin-left: auto;
    display: flex;
    align-items: center;
    z-index: 100;
}

.nav-search-input {
    background: #F8FAF7;
    border: 1px solid rgba(11, 60, 35, 0.15);
    border-radius: 20px;
    padding: 7px 16px;
    padding-right: 34px;
    color: var(--color-deep-forest, #0B3C23);
    font-size: 0.82rem;
    font-family: var(--font-body, 'Inter', sans-serif);
    font-weight: 500;
    width: 130px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    height: 36px;
    box-shadow: 0 1px 4px rgba(11, 60, 35, 0.03);
}

.nav-search-input:focus {
    width: 210px;
    background: #ffffff;
    outline: none;
    border-color: var(--accent-gold, #C59B27);
    box-shadow: 0 2px 12px rgba(197, 155, 39, 0.2);
}

.nav-search-input::placeholder {
    color: #7A8B7E;
    font-weight: 400;
}

.nav-search-icon {
    position: absolute;
    right: 12px;
    color: var(--accent-gold, #C59B27);
    pointer-events: none;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    top: 0;
    z-index: 10;
    transition: color 0.25s ease, opacity 0.2s ease;
}

.nav-search-icon svg {
    width: 15px;
    height: 15px;
    display: block;
    stroke: currentColor;
}

/* Dropdown Styles */
.search-results-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 320px;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 12px 36px rgba(11, 60, 35, 0.14);
    overflow: hidden;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(11, 60, 35, 0.08);
}

.search-results-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.search-result-header {
    padding: 10px 16px;
    background: #F5F9F6;
    font-size: 0.68rem;
    font-weight: 700;
    color: #55705E;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(11, 60, 35, 0.06);
}

.search-results-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 340px;
    overflow-y: auto;
}

.search-result-item {
    display: flex;
    flex-direction: column;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(11, 60, 35, 0.04);
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    color: inherit;
}

.search-result-item:hover,
.search-result-item.active-keyboard {
    background: #F0FDF4;
    border-left: 3px solid var(--accent-gold, #C59B27);
    padding-left: 14px;
}

.result-title {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--primary-forest, #0B3C23);
    display: block;
}

.result-category {
    font-size: 0.7rem;
    color: #6B7C70;
    margin-top: 2px;
}

/* ~~~~~ MOBILE OPTIMIZED LAYOUT ~~~~~ */
@media (max-width: 992px) {
    .nav-container {
        display: flex;
        justify-content: space-between;
        align-items: center;
        position: relative;
    }

    .nav-search-container {
        margin-right: 10px;
        margin-left: auto;
        width: 38px;
        height: 38px;
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .nav-search-input {
        width: 38px;
        height: 38px;
        padding: 0;
        border-radius: 50%;
        background: #F5F9F6;
        border: 1.5px solid rgba(11, 60, 35, 0.2);
        color: transparent;
        cursor: pointer;
        position: relative;
        z-index: 5;
        transition: all 0.2s ease;
    }

    .nav-search-input:hover {
        background: #E8F5E9;
        border-color: #0B3C23;
    }

    .nav-search-input::placeholder {
        color: transparent;
    }

    .nav-search-icon {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        margin: auto;
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--primary-forest, #0B3C23);
        z-index: 6; /* Always clearly rendered above the input circle */
        pointer-events: none;
    }

    .nav-search-icon svg {
        width: 17px;
        height: 17px;
        stroke: #0B3C23;
        stroke-width: 2.4;
    }

    /* EXPANDED STATE (Focus) - Mobile Top Overlay Bar */
    .nav-search-input:focus {
        position: fixed;
        top: calc(74px + env(safe-area-inset-top, 0px));
        left: calc(14px + env(safe-area-inset-left, 0px));
        right: calc(14px + env(safe-area-inset-right, 0px));
        width: calc(100% - 28px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
        height: 46px;
        background: #FFFFFF;
        color: #123315;
        font-size: 16px; /* Prevents iOS auto-zoom */
        border-radius: 8px;
        padding: 0 16px;
        border: 1.5px solid var(--accent-gold, #C59B27);
        box-shadow: 0 10px 30px rgba(11, 60, 35, 0.15);
        z-index: 1001;
        opacity: 1;
        cursor: text;
    }
    
    .nav-search-input:focus::placeholder {
        color: #889488;
    }

    .nav-search-input:focus ~ .nav-search-icon {
        opacity: 0;
        visibility: hidden;
    }

    .search-results-dropdown {
        position: fixed;
        top: calc(128px + env(safe-area-inset-top, 0px));
        left: calc(14px + env(safe-area-inset-left, 0px));
        right: calc(14px + env(safe-area-inset-right, 0px));
        width: calc(100% - 28px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
        max-height: 50vh;
        max-height: 50dvh;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        z-index: 1002;
    }
}
