/* ========================================
   Menu Bar Component Styles
   Genre/Year dropdowns, search bar, mobile search
   Used by menu_bar.php partial
   v1.0.0
   ======================================== */

/* ========== MENU BAR ========== */
.menu-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(24, 24, 27, 0.95);
    border: 1px solid #27272a;
    border-radius: 8px;
    padding: 10px 16px;
    margin-bottom: 20px;
}

.menu-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

/* Navbar Dropdown */
.navbar-dropdown {
    position: relative;
}

.navbar-dropdown-btn {
    background: transparent;
    border: 1px solid #3f3f46;
    color: #a1a1aa;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.navbar-dropdown-btn:hover {
    border-color: #52525b;
    color: #fff;
}

.navbar-dropdown-btn .dropdown-arrow {
    font-size: 8px;
    transition: transform 0.2s ease;
}

.navbar-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

.navbar-dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: rgba(24, 24, 27, 0.98);
    border: 1px solid #3f3f46;
    border-radius: 10px;
    padding: 12px;
    padding-top: 20px;
    margin-top: 0;
    z-index: 1000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
}

/* Bridge the gap for hover - invisible area above dropdown */
.navbar-dropdown-content::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    height: 10px;
}

.navbar-dropdown-content.show {
    display: block;
}

.dropdown-grid {
    display: grid;
    gap: 4px;
}

/* Both genres and years use 2-column layout */
.dropdown-grid.genres-grid,
.dropdown-grid.years-grid {
    grid-template-columns: repeat(2, 1fr);
}

.dropdown-grid a {
    color: #a1a1aa;
    text-decoration: none;
    font-size: 13px;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.dropdown-grid a:hover {
    background: rgba(138, 33, 40, 0.2);
    color: #fff;
}

.dropdown-grid a.older-link {
    grid-column: 1 / -1;
    text-align: center;
    margin-top: 8px;
    border-top: 1px solid #3f3f46;
    padding-top: 12px;
    color: #8a2128;
}

/* Older link outside the grid */
.dropdown-older-link {
    display: block;
    text-align: center;
    margin-top: 8px;
    padding: 10px 12px;
    border-top: 1px solid #3f3f46;
    color: #8a2128;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s ease;
}

.dropdown-older-link:hover {
    background: rgba(138, 33, 40, 0.2);
    color: #fff;
}

/* Mobile older link */
.mobile-older-link {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 8px;
    padding-top: 12px !important;
    color: #8a2128 !important;
    font-weight: 500;
}

/* ========== MENU SEARCH ========== */
.menu-search {
    position: relative;
    min-width: 300px;
}

.menu-search-box {
    display: flex;
    background: rgba(39, 39, 42, 0.8);
    border: 1px solid #3f3f46;
    border-radius: 50px;
    overflow: hidden;
}

.menu-search-box input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 10px 18px;
    color: var(--text);
    font-size: 13px;
    outline: none;
    min-width: 200px;
}

.menu-search-box input::placeholder {
    color: var(--text-dim);
}

.menu-search-box button {
    background: #8a2128;
    border: none;
    padding: 10px 20px;
    color: white;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.3s ease;
    border-radius: 50px;
    margin: 3px;
}

.menu-search-box button:hover {
    background: #6e1a20;
}

/* Search Dropdown for Menu Bar */
.menu-search .search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(20, 20, 25, 0.98);
    border: 1px solid rgba(60, 60, 70, 0.5);
    border-top: none;
    border-radius: 0 0 12px 12px;
    max-height: 400px;
    overflow-y: auto;
    display: none;
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

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

/* ========== SEARCH ICON TOGGLE ========== */
/* Hidden by default, shown on mobile */
.search-icon-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(39, 39, 42, 0.8);
    border: 1px solid #3f3f46;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    color: #a1a1aa;
    transition: all 0.3s ease;
}

.search-icon-toggle:hover {
    background: rgba(138, 33, 40, 0.2);
    border-color: #8a2128;
    color: #fff;
}

.search-icon-toggle svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* ========== MOBILE SEARCH ========== */
.mobile-search-expanded {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(10, 10, 15, 0.98);
    backdrop-filter: blur(10px);
    z-index: 9999;
    padding: 16px;
    border-bottom: 1px solid #3f3f46;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.mobile-search-expanded.active,
.mobile-search-expanded.show {
    display: block;
}

.mobile-search-inner {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
}

.mobile-search-inner input {
    flex: 1;
    background: rgba(39, 39, 42, 0.8);
    border: 1px solid #3f3f46;
    border-radius: 25px;
    padding: 12px 18px;
    color: #fff;
    font-size: 14px;
    outline: none;
}

.mobile-search-inner input:focus {
    border-color: #8a2128;
}

.mobile-search-inner input::placeholder {
    color: #71717a;
}

.mobile-search-btn {
    background: #8a2128;
    border: none;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.3s ease;
    color: white;
}

.mobile-search-btn:hover {
    background: #6e1a20;
}

.mobile-search-close {
    background: transparent;
    border: 1px solid #3f3f46;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #a1a1aa;
    transition: all 0.3s ease;
}

.mobile-search-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* Mobile Search Dropdown */
.mobile-search-expanded .mobile-dropdown {
    position: relative;
    margin-top: 12px;
    background: rgba(20, 20, 25, 0.95);
    border-radius: 12px;
    max-height: 60vh;
    overflow-y: auto;
}

.mobile-search-expanded .mobile-dropdown:not(:empty) {
    display: block;
    padding: 8px;
    border: 1px solid #3f3f46;
}

/* ========== SEARCH DROPDOWN (Shared) ========== */
.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(20, 20, 25, 0.98);
    border: 1px solid rgba(60, 60, 70, 0.5);
    border-top: none;
    border-radius: 0 0 12px 12px;
    max-height: 400px;
    overflow-y: auto;
    display: none;
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

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

.search-dropdown .search-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    text-decoration: none;
    color: var(--text);
    transition: background 0.2s;
    border-bottom: 1px solid rgba(60, 60, 70, 0.3);
}

.search-dropdown .search-item:last-child {
    border-bottom: none;
}

.search-dropdown .search-item:hover {
    background: rgba(142, 27, 27, 0.3);
}

.search-dropdown .search-item img {
    width: 40px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    background: #222;
}

.search-dropdown .search-item-info {
    flex: 1;
}

.search-dropdown .search-item-info h4 {
    margin: 0 0 4px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.search-dropdown .search-item-info span {
    font-size: 12px;
    color: var(--text-dim);
}

.search-dropdown .search-loading,
.search-dropdown .search-no-results {
    padding: 16px;
    text-align: center;
    color: var(--text-dim);
    font-size: 13px;
}

/* Search section divider */
.search-divider {
    margin: 4px 16px;
    border-top: 1px solid rgba(60, 60, 70, 0.5);
}

/* Cast/Person avatar — circular */
.search-item-person img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

/* ========== RESPONSIVE ========== */

/* Small Tablet / Large Phone */
@media (max-width: 768px) {

    /* Hide Genre/Year dropdowns on mobile - they're in hamburger menu now */
    .menu-left {
        display: none;
    }

    /* Full-width search bar on mobile */
    .menu-bar {
        padding: 10px 12px;
    }

    .menu-search {
        width: 100%;
        min-width: auto;
    }

    .menu-search-box {
        display: flex;
        width: 100%;
    }

    .menu-search-box input {
        min-width: 0;
        flex: 1;
    }
}

/* Mobile - 576px and below */
@media (max-width: 576px) {
    .search-dropdown .search-item {
        padding: 8px 10px;
        gap: 8px;
    }

    .search-dropdown .search-item img {
        width: 32px;
        height: 48px;
    }

    .search-dropdown .search-item-info h4 {
        font-size: 12px;
    }

    .search-dropdown .search-item-info span {
        font-size: 10px;
    }
}