/*
 * ConsoleSniper - header.css
 * This file contains all styles for the main site header,
 * including desktop, mobile, and navigation elements.
 */

/* --- Main Header Structure --- */
.main-header {
    background: #000000;
    color: #f7fafc;
    padding: 0.5rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 6px 24px rgba(2,6,23,0.6);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
}

.header-row-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
}

/* --- Logo --- */
.consolesniper-logo {
    font-family:  sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: #e6f6f1;
    text-decoration: none;
    flex-shrink: 0;
}
.consolesniper-logo .logo-text {
    background: linear-gradient(90deg, #27c5a1, #f88d01);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    /* fallback handled by -webkit-text-fill-color */
}

/* --- Search Bar --- */
.header-search {
    flex-grow: 1;
    max-width: 600px;
    display: flex;
}
.header-search input {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 1px solid rgba(39,197,161,0.18);
    border-radius: 20px 0 0 20px;
    background: #000000;
    color: #fff;
    font-size: 1rem;
}
.header-search button {
    background: linear-gradient(90deg,#27c5a1);
    border: 1px solid rgba(39,197,161,0.12);
    border-left: none;
    border-radius: 0 20px 20px 0;
    cursor: pointer;
    padding: 0 1rem;
}
.header-search button svg {
    width: 20px;
    height: 20px;
    fill: rgba(255,255,255,0.92);
}

/* --- Account Actions --- */
.header-actions {
    display: flex;
    align-items: baseline;
}
.account-link {
    color: #9be6cf;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 8px;
    transition: background 0.2s;
}
.account-link:hover { background: #2d3748; }
.account-link svg { width: 24px; height: 24px; stroke: #27c5a1; }

/* --- Categories Navigation --- */
.categories-nav {
    background: transparent;
    padding: 0;
    margin: 1.9rem 0 -0.5rem 0; /* Align with header content */
}
.categories-container {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 1rem;
    margin: 0;
    padding: 0;
}
.nav-item {
    color: #ffffff;
    text-decoration: none;
     padding: 0.8rem 0.2rem;
    transition: all 0.2s;
}


/* --- Mobile-only header items (inside nav) --- */
.mobile-nav-header {
    display: none; /* Hidden on desktop */
    padding: 1rem;
    border-bottom: 1px solid #4a5568;
    margin-bottom: 1rem;
    display: none;
    gap: 1rem;
}

/* --- Mobile Menu Button (Hamburger) --- */
.mobile-menu-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.04);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 10px;
    display: none !important; /* Hidden on desktop by default */
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    /* stack bars vertically and keep them centered */
    flex-direction: column;
    gap: 6px;
}
.mobile-menu-btn .bar {
    display: block;
    width: 22px;
    height: 3px;
    margin: 0;
    background: linear-gradient(90deg,#27c5a1, #f88d01);
    border-radius: 2px;
    transition: transform 0.28s cubic-bezier(.2,.9,.3,1), opacity 0.18s ease;
}

/* --- Mobile Search Button --- */
.mobile-search-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    display: none !important; /* Hidden on desktop */
    align-items: center;
    justify-content: center;
}
.mobile-search-btn svg {
    width: 24px;
    height: 24px;
    fill: #27c5a1;
    stroke: #27c5a1;
}

/* --- Mobile Responsive Styles (max-width: 992px) --- */
@media (max-width: 992px) {
    .main-header { padding: 0.5rem 1rem; }
    /* Hide desktop search and actions */
    .header-row-top > .header-search-container,
    .header-row-top > .header-actions {
        display: none;
    }
    /* Show mobile search button */
    .mobile-search-btn {
        display: inline-flex !important;
    }
    
    /* Mobile Navigation with proper scrolling */
    .categories-nav {
        display: none;
        position: fixed;
        /* place the nav directly below the sticky header (fallback to 56px) */
        top: calc(var(--header-height, 56px) + 8px);
        left: 12px;
        right: 12px;
        max-height: calc(100vh - 80px);
        background: linear-gradient(180deg, rgba(2,6,23,0.96), rgba(2,10,20,0.98));
        padding: 0.8rem;
        border-radius: 12px;
        box-shadow: 0 10px 30px rgba(2,6,23,0.6);
        transform-origin: top center;
        overflow-y: auto;
        overflow-x: hidden;
        /* must be above the sticky header which has z-index:1000 */
        z-index: 2001;
    }
    .main-header.menu-open .categories-nav,
    .categories-nav.active {
        display: flex;
        animation: slideInNav 220ms cubic-bezier(.2,.9,.3,1);
    }
    
    @keyframes slideInNav {
        from {
            opacity: 0;
            transform: translateY(-8px) scale(0.995);
        }
        to {
            opacity: 1;
            transform: translateY(0) scale(1);
        }
    }
    
    .categories-container {
        flex-direction: column;
        align-items: flex-start;
        padding: 0.5rem;
        gap: 0.5rem;
    }
    
    .mobile-menu-btn {
        display: inline-flex !important;
        flex-direction: column !important;
        align-items: center;
        justify-content: center;
        gap: 6px;
        padding: 0.45rem;
    }
    .mobile-menu-btn:focus { outline: none; box-shadow: 0 6px 18px rgba(53,176,230,0.12); transform: translateY(-1px); }
    /* Hamburger animation */
    .mobile-menu-btn.active .bar:nth-child(2) { opacity: 0; }
    .mobile-menu-btn.active .bar:nth-child(1) { transform: translateY(8px) rotate(45deg); }
    .mobile-menu-btn.active .bar:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

    .nav-item {
        display: block;
        background: transparent;
        padding: 0.65rem 0.9rem;
        width: 100%;
        border-radius: 8px;
        transition: background 160ms, transform 120ms;
    }
    .nav-item:hover { background: rgba(59,130,246,0.06); transform: translateX(4px); }

    /* Active nav link styling */
    .nav-item.active {
        color: #27c5a1;
        font-weight: 600;
        background: rgb(0, 0, 0);
        box-shadow: inset 0 -3px 0 rgba(39,197,161,0.06);
    }
    
    /* Show mobile account link in mobile menu */
    .mobile-account-link {
        display: block !important;
        border-top: 1px solid rgba(255,255,255,0.1);
        margin-top: 0.5rem;
        padding-top: 0.75rem;
    }
}

/* Desktop: ensure hamburger is hidden and nav is displayed normally */
@media (min-width: 993px) {
    .mobile-menu-btn { display: none !important; }
    
    /* Hide mobile account link on desktop */
    .mobile-account-link {
        display: none !important;
    }
    
    /* Hide mobile account link on desktop */
    .mobile-account-link {
        display: none !important;
    }
    .categories-nav { 
        display: flex !important; 
        position: static !important; 
        top: auto !important; 
        left: auto !important; 
        right: auto !important; 
        background: transparent !important; 
        padding: 0 1.5rem !important;
        box-shadow: none !important; 
        opacity: 1 !important; 
        visibility: visible !important; 
        transform: none !important;
        max-height: none !important;
    }
}

/* Active nav link styling (global) */
.nav-item.active {
    color: #27c5a1;
    font-weight: 600;
    background: rgb(0, 0, 0);
    box-shadow: inset 0 -3px 0 rgba(39,197,161,0.06);
}

@media (max-width: 600px) {
    .header-row-top { justify-content: space-between; }
    .consolesniper-logo { font-size: 1.5rem; }
}

/* --- Search Suggestions Dropdown --- */
.header-search-container {
    flex-grow: 1;
    max-width: 600px;
    position: relative;
}

.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1a202c;
    border: 1px solid rgba(39, 197, 161, 0.2);
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1001;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.suggestions-list {
    padding: 0.5rem 0;
}

.suggestion-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    transition: background 150ms ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.suggestion-item:hover {
    background: rgba(39, 197, 161, 0.1);
}

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

.suggestion-title {
    color: #e6f6f1;
    font-weight: 500;
    font-size: 0.95rem;
}

.suggestion-category {
    color: #9be6cf;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.suggestion-item.loading,
.suggestion-item.no-results,
.suggestion-item.error {
    cursor: default;
    justify-content: center;
}

.suggestion-item.loading {
    color: #9be6cf;
}

.suggestion-item.no-results,
.suggestion-item.error {
    color: #fc8181;
}

/* Scrollbar styling for suggestions */
.search-suggestions::-webkit-scrollbar {
    width: 8px;
}

.search-suggestions::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.search-suggestions::-webkit-scrollbar-thumb {
    background: rgba(39, 197, 161, 0.3);
    border-radius: 4px;
}

.search-suggestions::-webkit-scrollbar-thumb:hover {
    background: rgba(39, 197, 161, 0.5);
}

/* --- Mobile Search Modal --- */
.mobile-search-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: flex-start;
    animation: slideInModal 300ms ease;
}

.mobile-search-modal.active {
    display: flex;
}

@keyframes slideInModal {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.mobile-search-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
}

.mobile-search-popup {
    position: relative;
    width: 100%;
    height: 100%;
    background: #000000;
    display: flex;
    flex-direction: column;
    z-index: 2001;
    animation: slideUp 300ms cubic-bezier(.2,.9,.3,1);
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.mobile-search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid rgba(39, 197, 161, 0.2);
}

.mobile-search-header h2 {
    margin: 0;
    font-size: 1.2rem;
    color: #e6f6f1;
}

.mobile-search-close {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-search-close svg {
    width: 24px;
    height: 24px;
    stroke: #27c5a1;
}

.mobile-search-form {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-search-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(39, 197, 161, 0.3);
    border-radius: 20px;
    background: #1a202c;
    color: #fff;
    font-size: 1rem;
}

.mobile-search-input::placeholder {
    color: #9be6cf;
}

.mobile-search-submit {
    background: linear-gradient(90deg, #27c5a1, #f88d01);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 150ms;
}

.mobile-search-submit:active {
    transform: scale(0.95);
}

.mobile-search-submit svg {
    width: 20px;
    height: 20px;
    fill: white;
}

.mobile-search-suggestions {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.mobile-search-suggestions .suggestions-list {
    padding: 0.5rem 0;
}

.mobile-search-suggestions::-webkit-scrollbar {
    width: 8px;
}

.mobile-search-suggestions::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.mobile-search-suggestions::-webkit-scrollbar-thumb {
    background: rgba(39, 197, 161, 0.3);
    border-radius: 4px;
}

.mobile-search-suggestions::-webkit-scrollbar-thumb:hover {
    background: rgba(39, 197, 161, 0.5);
}

/* Mobile responsive search suggestions */
@media (max-width: 768px) {
    .search-suggestions {
        max-height: 300px;
        font-size: 0.9rem;
    }

    .suggestion-item {
        padding: 0.6rem 0.8rem;
    }
}