/* ============================================
   MODERN HEADER CSS - COMPLETE FIX
   ============================================
   File: public/css/header_modern.css
   
   ALL FIXES APPLIED:
   1. Mobile menu COMPLETELY hidden (no ghost content)
   2. Proper z-index so menu doesn't cover page content
   3. Mobile menu links properly styled
   4. Reduced spacing between cards and promotions
   ============================================ */

/* ============================================
   THEME VARIABLES
   ============================================ */
:root,
.mh-theme-light {
    --mh-primary: #667eea;
    --mh-primary-dark: #5568d3;
    --mh-primary-light: #7c8ff0;
    --mh-bg-main: #ffffff;
    --mh-bg-secondary: #f7fafc;
    --mh-bg-hover: #edf2f7;
    --mh-text-primary: #2d3748;
    --mh-text-secondary: #4a5568;
    --mh-text-muted: #718096;
    --mh-text-white: #ffffff;
    --mh-border: #e2e8f0;
    --mh-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --mh-shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);
    --mh-header-bg: #ffffff;
    --mh-logo-color: #667eea;
    --mh-nav-color: #2d3748;
    --mh-nav-hover: #667eea;
}

.mh-theme-dark {
    --mh-primary: #8b9dff;
    --mh-primary-dark: #7c8ff0;
    --mh-primary-light: #a0aeff;
    --mh-bg-main: #1a202c;
    --mh-bg-secondary: #2d3748;
    --mh-bg-hover: #4a5568;
    --mh-text-primary: #f7fafc;
    --mh-text-secondary: #e2e8f0;
    --mh-text-muted: #cbd5e0;
    --mh-text-white: #ffffff;
    --mh-border: #4a5568;
    --mh-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --mh-shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.4);
    --mh-header-bg: #2d3748;
    --mh-logo-color: #8b9dff;
    --mh-nav-color: #f7fafc;
    --mh-nav-hover: #8b9dff;
}

/* ============================================
   HEADER CONTAINER
   ============================================ */
.mh-header {
    background-color: var(--mh-header-bg);
    box-shadow: var(--mh-shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: all 0.3s ease;
}

.mh-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

/* ============================================
   LOGO SECTION
   ============================================ */
.mh-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    z-index: 1001;
}

.mh-logo__image {
    max-width: 180px;
    max-height: 50px;
    width: auto;
    height: auto;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.mh-logo__image:hover {
    transform: scale(1.05);
}

.mh-logo__text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--mh-logo-color);
    transition: color 0.3s ease;
}

.mh-logo:hover .mh-logo__text {
    color: var(--mh-primary-dark);
}

/* ============================================
   DESKTOP NAVIGATION
   ============================================ */
.mh-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mh-nav__link {
    position: relative;
    padding: 10px 16px;
    color: var(--mh-nav-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    border-radius: 6px;
    transition: all 0.3s ease;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.mh-nav__link:hover {
    color: var(--mh-nav-hover);
    background-color: var(--mh-bg-hover);
}

.mh-nav__link::after {
    content: '';
    position: absolute;
    bottom: 5px;
    left: 16px;
    right: 16px;
    height: 2px;
    background-color: var(--mh-primary);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.mh-nav__link:hover::after {
    transform: scaleX(1);
}

.mh-nav__link--primary {
    background: linear-gradient(135deg, var(--mh-primary) 0%, var(--mh-primary-dark) 100%);
    color: var(--mh-text-white) !important;
    padding: 10px 24px;
    border-radius: 25px;
    margin-left: 8px;
}

.mh-nav__link--primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--mh-shadow-lg);
}

.mh-nav__link--primary::after {
    display: none;
}

.mh-nav__user {
    color: var(--mh-text-secondary);
    font-size: 0.9rem;
    padding: 8px 12px;
    background-color: var(--mh-bg-secondary);
    border-radius: 6px;
    margin-right: 8px;
}

.mh-nav__user span {
    color: var(--mh-primary);
    font-weight: 600;
}

.mh-nav__user a {
    color: inherit;
    text-decoration: none;
}

/* ============================================
   THEME TOGGLE BUTTON
   ============================================ */
.mh-theme-toggle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: var(--mh-bg-secondary);
    border: 2px solid var(--mh-border);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    margin-left: 12px;
    flex-shrink: 0;
    z-index: 1001;
}

.mh-theme-toggle:hover {
    background-color: var(--mh-bg-hover);
    transform: rotate(20deg) scale(1.1);
    border-color: var(--mh-primary);
}

.mh-theme-toggle svg {
    width: 20px;
    height: 20px;
    fill: var(--mh-text-primary);
    stroke: var(--mh-text-primary);
    transition: all 0.3s ease;
}

.mh-theme-light .mh-icon-moon {
    display: block;
}

.mh-theme-light .mh-icon-sun {
    display: none;
}

.mh-theme-dark .mh-icon-moon {
    display: none;
}

.mh-theme-dark .mh-icon-sun {
    display: block;
}

/* ============================================
   MOBILE MENU TOGGLE
   ============================================ */
.mh-mobile-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: background-color 0.3s ease;
    margin-left: 12px;
    flex-shrink: 0;
    z-index: 1001;
}

.mh-mobile-toggle:hover {
    background-color: var(--mh-bg-hover);
}

.mh-mobile-toggle span {
    width: 24px;
    height: 3px;
    background-color: var(--mh-text-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.mh-mobile-toggle.mh-active span:nth-child(1) {
    transform: rotate(45deg) translate(7px, 7px);
}

.mh-mobile-toggle.mh-active span:nth-child(2) {
    opacity: 0;
}

.mh-mobile-toggle.mh-active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* ============================================
   MOBILE MENU - COMPLETELY FIXED
   ============================================ */
.mh-mobile-menu {
    /* CRITICAL FIX: visibility:hidden prevents ANY rendering */
    visibility: hidden;
    opacity: 0;
    position: absolute;
    top: 70px;
    left: 0;
    right: 0;
    background-color: var(--mh-header-bg);
    box-shadow: var(--mh-shadow-lg);
    padding: 0;
    max-height: 0;
    overflow: hidden;
    z-index: 999;
    transition: visibility 0s 0.3s, opacity 0.3s ease, max-height 0.4s ease, padding 0.3s ease;
}

.mh-mobile-menu.mh-active {
    visibility: visible;
    opacity: 1;
    max-height: 600px;
    padding: 16px 24px;
    transition: visibility 0s, opacity 0.3s ease, max-height 0.4s ease, padding 0.3s ease;
}

/* Mobile menu links styling */
.mh-mobile-menu__link {
    display: block;
    padding: 14px 16px;
    margin-bottom: 6px;
    color: var(--mh-nav-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    width: 100%;
    text-align: left;
}

.mh-mobile-menu__link:hover {
    color: var(--mh-nav-hover);
    background-color: var(--mh-bg-hover);
    transform: translateX(5px);
}

.mh-mobile-menu__link--primary {
    background: linear-gradient(135deg, var(--mh-primary) 0%, var(--mh-primary-dark) 100%);
    color: var(--mh-text-white) !important;
    margin-top: 12px;
    text-align: center;
    font-weight: 600;
    padding: 14px 24px;
}

.mh-mobile-menu__link--primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--mh-shadow-lg);
}

.mh-mobile-menu__user {
    color: var(--mh-text-secondary);
    font-size: 0.95rem;
    padding: 14px 16px;
    background-color: var(--mh-bg-secondary);
    border-radius: 8px;
    margin-bottom: 16px;
}

.mh-mobile-menu__user span {
    color: var(--mh-primary);
    font-weight: 600;
}

.mh-mobile-menu__user a {
    color: inherit;
    text-decoration: none;
}

.mh-mobile-menu__user a:hover span {
    text-decoration: underline;
}

/* Form buttons in mobile menu */
.mh-mobile-menu form {
    display: block;
    margin-top: 8px;
}

.mh-mobile-menu form button {
    width: 100%;
}

/* ============================================
   SECTION SPACING FIX - MAJOR REDUCTION
   ============================================ */

/* Reduce card section spacing */
.lp-section {
    padding-top: 48px !important;
    padding-bottom: 48px !important;
}

/* Reduce promotions section spacing */
.lp-promotions {
    padding-top: 48px !important;
    padding-bottom: 48px !important;
    margin-top: -24px !important;
}

/* If cards come right before promotions, remove gap */
.lp-section + .lp-promotions,
.lp-section--alt + .lp-promotions {
    margin-top: -48px !important;
}

/* Reduce header spacing in promotions */
.lp-promotions__header {
    margin-bottom: 32px !important;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Tablet - 1024px and below */
@media (max-width: 1024px) {
    .mh-container {
        padding: 0 20px;
    }
    
    .mh-nav__link {
        padding: 10px 12px;
        font-size: 0.9rem;
    }
    
    .mh-nav {
        gap: 4px;
    }
    
    /* Reduce spacing on tablet */
    .lp-section {
        padding-top: 40px !important;
        padding-bottom: 40px !important;
    }
    
    .lp-promotions {
        padding-top: 40px !important;
        padding-bottom: 40px !important;
    }
}

/* Mobile - 768px and below */
@media (max-width: 768px) {
    .mh-container {
        height: 60px;
        position: relative;
    }
    
    /* Hide desktop nav */
    .mh-nav {
        display: none;
    }
    
    /* Show mobile toggle */
    .mh-mobile-toggle {
        display: flex;
    }
    
    /* Mobile menu positioning */
    .mh-mobile-menu {
        top: 60px;
    }
    
    .mh-logo__text {
        font-size: 1.2rem;
    }
    
    .mh-logo__image {
        max-width: 150px;
        max-height: 40px;
    }
    
    .mh-theme-toggle {
        width: 40px;
        height: 40px;
        margin-left: auto;
        margin-right: 8px;
    }
    
    /* Further reduce spacing on mobile */
    .lp-section {
        padding-top: 32px !important;
        padding-bottom: 32px !important;
    }
    
    .lp-promotions {
        padding-top: 32px !important;
        padding-bottom: 32px !important;
        margin-top: -24px !important;
    }
    
    .lp-section + .lp-promotions,
    .lp-section--alt + .lp-promotions {
        margin-top: -32px !important;
    }
}

/* Small Mobile - 480px and below */
@media (max-width: 480px) {
    .mh-container {
        padding: 0 16px;
    }
    
    .mh-logo__text {
        font-size: 1rem;
    }
    
    .mh-logo__image {
        max-width: 120px;
        max-height: 35px;
    }
    
    .mh-theme-toggle {
        width: 36px;
        height: 36px;
    }
    
    .mh-theme-toggle svg {
        width: 18px;
        height: 18px;
    }
    
    .mh-mobile-menu.mh-active {
        padding: 12px 16px;
    }
    
    .mh-mobile-menu__link {
        font-size: 0.95rem;
        padding: 12px 14px;
    }
}

/* ============================================
   SMOOTH TRANSITIONS
   ============================================ */
body {
    transition: background-color 0.3s ease, color 0.3s ease;
}

.mh-header,
.mh-logo__text,
.mh-nav__link,
.mh-nav__user,
.mh-theme-toggle,
.mh-mobile-toggle span,
.mh-mobile-menu {
    transition: all 0.3s ease;
}

/* ============================================
   PREVENT CONTENT SHIFT WHEN MENU OPENS
   ============================================ */
body {
    position: relative;
}

/* Ensure page content stays below header */
main,
.main-content,
section {
    position: relative;
    z-index: 1;
}



/* ============================================
   EMERGENCY FIX - Add to BOTTOM of header_modern.css
   ============================================
   
   Use this ONLY if the mobile menu is still showing
   after applying the main fixes.
   
   This is the "nuclear option" - forces menu hidden
   with maximum CSS specificity.
   ============================================ */

/* Force hide mobile menu when not active - Desktop */
@media (min-width: 769px) {
    .mh-mobile-menu {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        max-height: 0 !important;
        overflow: hidden !important;
        pointer-events: none !important;
    }
}

/* Force hide mobile menu when not active - Mobile */
@media (max-width: 768px) {
    .mh-mobile-menu:not(.mh-active) {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        max-height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: hidden !important;
        pointer-events: none !important;
        transform: translateY(-100%) !important;
    }
    
    /* Ensure menu appears smoothly when active */
    .mh-mobile-menu.mh-active {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        max-height: 600px !important;
        padding: 16px 24px !important;
        overflow-y: auto !important;
        pointer-events: auto !important;
        transform: translateY(0) !important;
        transition: all 0.3s ease !important;
    }
}

/* ============================================
   ADDITIONAL SPACING FIX
   ============================================
   If spacing is STILL too large, use this
   ============================================ */

/* Force reduce section padding everywhere */
.lp-section,
section.lp-section,
div.lp-section {
    padding-top: 48px !important;
    padding-bottom: 48px !important;
}

.lp-promotions,
section.lp-promotions,
div.lp-promotions {
    padding-top: 48px !important;
    padding-bottom: 48px !important;
    margin-top: -48px !important;
}

/* Target the specific combination */
.lp-section + .lp-promotions,
.lp-section--alt + .lp-promotions,
section.lp-section + section.lp-promotions {
    margin-top: -48px !important;
}

/* Reduce header spacing in promotions */
.lp-promotions__header,
.lp-promotions .lp-promotions__header {
    margin-bottom: 24px !important;
}

/* Mobile spacing - even tighter */
@media (max-width: 768px) {
    .lp-section,
    section.lp-section {
        padding-top: 32px !important;
        padding-bottom: 32px !important;
    }
    
    .lp-promotions,
    section.lp-promotions {
        padding-top: 32px !important;
        padding-bottom: 32px !important;
        margin-top: -32px !important;
    }
    
    .lp-section + .lp-promotions,
    .lp-section--alt + .lp-promotions {
        margin-top: -40px !important;
    }
}

/* ============================================
   HEADER Z-INDEX FIX
   ============================================
   Ensures header stays on top but menu doesn't
   cover content
   ============================================ */

/* Header container z-index */
.mh-header {
    position: sticky !important;
    top: 0 !important;
    z-index: 1000 !important;
}

/* Logo and controls stay above menu */
.mh-logo,
.mh-theme-toggle,
.mh-mobile-toggle {
    position: relative !important;
    z-index: 1002 !important;
}

/* Desktop nav stays above menu */
.mh-nav {
    position: relative !important;
    z-index: 1002 !important;
}

/* Mobile menu below header but above content */
.mh-mobile-menu {
    position: absolute !important;
    z-index: 999 !important;
}

/* Page content stays below everything */
main,
section,
.lp-section,
.lp-promotions {
    position: relative !important;
    z-index: 1 !important;
}

/* ============================================
   MOBILE MENU LINK STYLING - FORCE
   ============================================
   If links still aren't styled properly
   ============================================ */

/* Desktop - hide mobile menu classes completely */
@media (min-width: 769px) {
    .mh-mobile-menu,
    .mh-mobile-menu *,
    .mh-mobile-menu__link,
    .mh-mobile-menu__user {
        display: none !important;
    }
}

/* Mobile - force proper styling */
@media (max-width: 768px) {
    .mh-mobile-menu.mh-active .mh-mobile-menu__link {
        display: block !important;
        padding: 14px 16px !important;
        margin-bottom: 6px !important;
        color: var(--mh-nav-color) !important;
        text-decoration: none !important;
        font-weight: 500 !important;
        font-size: 1rem !important;
        border-radius: 8px !important;
        background: transparent !important;
        border: none !important;
        cursor: pointer !important;
        width: 100% !important;
        text-align: left !important;
        transition: all 0.3s ease !important;
    }
    
    .mh-mobile-menu.mh-active .mh-mobile-menu__link:hover {
        color: var(--mh-nav-hover) !important;
        background-color: var(--mh-bg-hover) !important;
        transform: translateX(5px) !important;
    }
    
    .mh-mobile-menu.mh-active .mh-mobile-menu__link--primary {
        background: linear-gradient(135deg, var(--mh-primary) 0%, var(--mh-primary-dark) 100%) !important;
        color: var(--mh-text-white) !important;
        text-align: center !important;
        margin-top: 12px !important;
        font-weight: 600 !important;
    }
    
    .mh-mobile-menu.mh-active .mh-mobile-menu__user {
        display: block !important;
        padding: 14px 16px !important;
        background-color: var(--mh-bg-secondary) !important;
        border-radius: 8px !important;
        margin-bottom: 16px !important;
        color: var(--mh-text-secondary) !important;
    }
}

/* ============================================
   PREVENT LAYOUT SHIFT
   ============================================ */

/* Prevent body from moving when menu opens */
body {
    overflow-x: hidden !important;
}

body.mh-menu-open {
    overflow: hidden !important;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth !important;
}

/* ============================================
   FINAL CATCH-ALL
   ============================================ */

/* If menu STILL shows, this hides everything */
@media (max-width: 768px) {
    .mh-mobile-menu > * {
        display: none !important;
    }
    
    .mh-mobile-menu.mh-active > * {
        display: block !important;
    }
    
    .mh-mobile-menu.mh-active form {
        display: block !important;
    }
    
    .mh-mobile-menu.mh-active button,
    .mh-mobile-menu.mh-active .mh-mobile-menu__link {
        display: block !important;
    }
}


/* ===== MOBILE MENU - TRANSPARENT WHEN CLOSED ===== */
.mh-mobile-menu {
    position: absolute;
    top: 70px;
    left: 0;
    right: 0;
    /* TRANSPARENT - completely invisible */
    background-color: transparent;
    pointer-events: none;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.3s ease;
}

/* WHEN ACTIVE - WHITE BACKGROUND */
.mh-mobile-menu.mh-active {
    background-color: var(--mh-header-bg);
    box-shadow: var(--mh-shadow-lg);
    pointer-events: auto;
    padding: 16px 24px;
    max-height: 600px;
    opacity: 1;
}

/* ===== MOBILE MENU LINKS - PROPER STYLING ===== */
.mh-mobile-menu__link {
    display: block;
    padding: 14px 16px;
    margin-bottom: 6px;
    color: var(--mh-nav-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    width: 100%;
    text-align: left;
}

.mh-mobile-menu__link:hover {
    color: var(--mh-nav-hover);
    background-color: var(--mh-bg-hover);
    transform: translateX(5px);
}

.mh-mobile-menu__link--primary {
    background: linear-gradient(135deg, var(--mh-primary) 0%, var(--mh-primary-dark) 100%);
    color: var(--mh-text-white) !important;
    margin-top: 12px;
    text-align: center;
    font-weight: 600;
}

.mh-mobile-menu__user {
    color: var(--mh-text-secondary);
    font-size: 0.95rem;
    padding: 14px 16px;
    background-color: var(--mh-bg-secondary);
    border-radius: 8px;
    margin-bottom: 16px;
}

.mh-mobile-menu__user span {
    color: var(--mh-primary);
    font-weight: 600;
}

.mh-mobile-menu__user a {
    color: inherit;
    text-decoration: none;
}

/* ===== THEME TOGGLE MOBILE VERSION ===== */
.mh-theme-toggle--mobile {
    display: none; /* Hidden on desktop */
}

/* ===== RESPONSIVE - MOBILE ===== */
@media (max-width: 768px) {
    /* Hide desktop theme toggle */
    .mh-nav .mh-theme-toggle {
        display: none;
    }
    
    /* Show mobile theme toggle */
    .mh-theme-toggle--mobile {
        display: flex;
        position: absolute;
        right: 70px;
        top: 50%;
        transform: translateY(-50%);
        width: 40px;
        height: 40px;
        margin: 0;
    }
    
    /* Mobile menu positioning */
    .mh-mobile-menu {
        top: 60px;
    }
    
    /* Hide desktop nav */
    .mh-nav {
        display: none;
    }
    
    /* Show mobile toggle */
    .mh-mobile-toggle {
        display: flex;
    }
}

/* ===== FORCE HIDE WHEN NOT ACTIVE ===== */
@media (max-width: 768px) {
    .mh-mobile-menu:not(.mh-active) {
        display: block;
        visibility: hidden;
        background: transparent !important;
        pointer-events: none !important;
    }
    
    .mh-mobile-menu.mh-active {
        display: block;
        visibility: visible;
    }
}

/* ===== DESKTOP - COMPLETELY HIDE MOBILE MENU ===== */
@media (min-width: 769px) {
    .mh-mobile-menu {
        display: none !important;
    }
    
    .mh-theme-toggle--mobile {
        display: none !important;
    }
}


/* ============================================
   FINAL FIX - REMOVE GHOST MOBILE MENU OVERLAY
   ============================================ */

.mh-mobile-menu {
    background-color: transparent !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    max-height: 0 !important;
    overflow: hidden !important;
    transition: all 0.3s ease !important;
}

.mh-mobile-menu.mh-active {
    background-color: var(--mh-header-bg) !important;
    box-shadow: var(--mh-shadow-lg) !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    max-height: 600px !important;
    overflow-y: auto !important;
    transition: all 0.3s ease !important;
}
