/* ==================================================
   NAVBAR
================================================== */

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    max-width: 100vw;
    /* overflow must NOT be hidden — dropdowns need to escape the navbar bounds */
    background: #000;
    z-index: 99999;
    box-sizing: border-box;
}

.nav-container {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 0.7rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-sizing: border-box;
}

/* LOGO */
.logo img {
    width: 180px;
    height: auto;
    display: block;
}

/* ==================================================
   SEARCH BAR (CENTERED)
================================================== */

.top-search-bar {
    flex: 1;
    display: flex;
    justify-content: center;
}

/* wrapper */
.top-search-bar > div {
    position: relative;
    max-width: 420px;
    width: 100%;
}

/* SEARCH BOX */
.search-wrapper {
    display: flex;
    align-items: center;
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    padding: 0.35rem 0.8rem;
    transition: all 0.25s ease;
}

.search-wrapper:focus-within {
    border-color: var(--primary);
    background: rgba(233, 30, 140, 0.05);
    box-shadow: 0 0 0 2px rgba(233, 30, 140, 0.2);
}

.search-wrapper svg {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

.search-wrapper input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-light);
    font-size: 0.85rem;
    padding: 0.2rem 0.5rem;
}

.search-wrapper input::placeholder {
    color: var(--text-muted);
}

.search-wrapper button {
    background: var(--primary);
    border: none;
    border-radius: 50px;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.3rem 0.8rem;
    cursor: pointer;
}

.search-wrapper button:hover {
    background: var(--primary-dark);
}

/* ==================================================
   SEARCH DROPDOWN
================================================== */

.search-results-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 100%;
    max-height: 300px;
    overflow-y: auto;
    background: var(--dark-gray);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
    display: none;
    z-index: 999;
}

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

.search-result-item {
    display: flex;
    gap: 0.7rem;
    align-items: center;
    padding: 0.6rem 0.8rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    text-decoration: none;
    color: var(--text-light);
}

.search-result-item:hover {
    background: rgba(233, 30, 140, 0.08);
}

.search-result-item img {
    width: 42px;
    height: 28px;
    object-fit: cover;
    border-radius: 6px;
}

.search-result-item .res-title {
    font-size: 0.8rem;
    font-weight: 600;
}

.search-result-item .res-cat {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.search-no-results {
    padding: 1rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ==================================================
   NAV MENU (DESKTOP)
================================================== */

.nav-menu {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    z-index: 10003;
}

.nav-menu a,
.dropdown button {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-light);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.55rem 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.25s ease;
}

.nav-menu a:hover,
.dropdown button:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.active-nav {
    background: linear-gradient(135deg, var(--primary), var(--secondary)) !important;
    color: #fff !important;
    border: none !important;
}

/* ==================================================
   DROPDOWN
================================================== */

.dropdown {
    position: relative;
}

.dropdown-content {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 220px;
    background: var(--dark-gray);
    border-radius: 12px;
    padding: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.25s ease;
    z-index: 99998; /* Just below the navbar itself, above all page content */
}

.dropdown-content a {
    display: block;
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    color: var(--text-light);
    text-decoration: none;
}

.dropdown-content a:hover {
    background: rgba(233, 30, 140, 0.1);
    color: var(--primary);
}

@media (min-width: 769px) {
    .dropdown:hover .dropdown-content {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
}

/* ==================================================
   HAMBURGER BUTTON
   Hidden on desktop, shown on mobile
================================================== */

.mobile-menu-btn {
    display: none;
    margin-left: auto;
    flex-shrink: 0;
    font-size: 1.8rem;
    background: #111;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0;
    line-height: 1;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    min-width: 42px;
    cursor: pointer;
    z-index: 1002;
}

/* ==================================================
   MOBILE MENU
================================================== */

@media (max-width: 768px) {

    .navbar {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        max-width: 100vw;
        /* No overflow:hidden here — that would clip the dropdown */
        background: #000;
        z-index: 99999;
        box-sizing: border-box;
    }

    .nav-container {
        padding: 0.6rem 0.8rem;
        width: 100%;
        max-width: 100vw;
        box-sizing: border-box;
        overflow: hidden; /* Prevent the flex row itself from overflowing */
        gap: 0.5rem;
    }

    /* Shrink logo on small screens so hamburger stays visible */
    .logo img {
        width: clamp(120px, 40vw, 160px);
        height: auto;
    }

    /* Show hamburger button */
    .mobile-menu-btn {
        display: flex;
    }

    /* Hide desktop nav links */
    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 85%;
        max-width: 380px;
        height: 100vh;
        background: #0a0a0a;
        flex-direction: column;
        padding: 5rem 1.5rem 2rem;
        gap: 1rem;
        overflow-y: auto;
        transition: right 0.3s ease;
        z-index: 100;
        display: flex;
    }

    .nav-menu.active {
        right: 0;
    }

    .nav-menu a,
    .dropdown button {
        width: 100%;
        justify-content: space-between;
        padding: 0.9rem 1rem;
        border-radius: 10px;
        font-size: 1rem;
        background: #111;
    }

    .dropdown {
        width: 100%;
    }

    .dropdown-content {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        max-height: 0;
        overflow: hidden;
        background: transparent;
        padding: 0;
        transition: max-height 0.3s ease;
    }

    .dropdown.active .dropdown-content {
        max-height: 400px;
    }

    /* Hide search bar on mobile */
    .top-search-bar {
        display: none;
    }
}
