/**
 * 4D Greens Website - Responsive Header Styles
 * 
 * Contains styles for header elements including:
 * - Date/Time/Weather display
 * - Mobile navigation drawer
 * - Logo and brand positioning
 */

/* Header info chip styles */
#header-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-right: 15px;
}

#header-date-time,
#header-weather {
    background: rgba(0, 0, 0, 0.1);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--primary-color);
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#header-weather i {
    margin-right: 6px;
}

/* Mobile Navigation Drawer */
@media (max-width: 991.98px) {
    /* Ensure hamburger toggle is visible and above overlay */
    .menu-toggle {
        display: inline-block;
            z-index: 4500;
    }

    /* Explicitly control mobile menu display to override earlier styles */
    .main-nav .nav-menu { display: none; }
    .main-nav .nav-menu.active { display: flex; flex-direction: column; }
    .main-nav .nav-menu {
        position: fixed;
        top: 0;
        right: -280px; /* Start off-canvas */
        width: 280px;
        height: 100vh;
        background: white;
        padding: 20px;
        transition: right 0.3s ease-in-out;
        box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
        overflow-y: auto;
            z-index: 4400;
    }

    .main-nav .nav-menu.active {
        right: 0;
    }

    /* Overlay when menu is open */
    .nav-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
            z-index: 4350;
        backdrop-filter: blur(2px);
    }

    .nav-overlay.active {
        display: block;
    }

    /* Stronger specificity and layering to ensure drawer slides over overlay */
    .site-header nav.main-nav > ul.nav-menu {
        position: fixed;
        top: 0;
        right: -300px; /* hidden off-canvas */
        width: 80vw;
        max-width: 320px;
        height: 100vh;
        background: #fff;
        padding: 80px 20px 20px;
        box-shadow: -2px 0 10px rgba(0,0,0,0.15);
        overflow-y: auto;
            z-index: 4450; /* above overlay */
        transition: right .3s cubic-bezier(.2,.9,.2,1);
    }
    .site-header nav.main-nav > ul.nav-menu.active { right: 0 !important; display: flex !important; }
        .site-header .nav-overlay { z-index: 4350; }

    /* Close button styling */
    .menu-close {
        position: absolute;
        top: 15px;
        right: 15px;
        width: 30px;
        height: 30px;
        border: none;
        background: none;
        cursor: pointer;
    }

    .menu-close::before,
    .menu-close::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 0;
        width: 100%;
        height: 2px;
        background: var(--primary-color);
    }

    .menu-close::before {
        transform: rotate(45deg);
    }

    .menu-close::after {
        transform: rotate(-45deg);
    }

    /* Menu items styling */
    .nav-menu li {
        margin: 0;
        padding: 0;
    }

    .nav-menu a {
        padding: 12px 0;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        font-size: 1.1rem;
    }

    .nav-menu li:last-child a {
        border-bottom: none;
    }

    /* Prevent body scroll when menu is open */
    body.menu-open {
        overflow: hidden;
    }

    /* New off-canvas mobile drawer */
    .offcanvas-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        display: none;
        opacity: 0;
        transition: opacity .24s ease;
            z-index: 4350;
    }
    .offcanvas-overlay.open { display: block; opacity: 1; }

    .offcanvas {
        position: fixed;
        top: 0;
        right: -320px;
        width: 80vw;
        max-width: 320px;
        height: 100vh;
        /* Sleek dark card design */
        background: #2a2d32;
            z-index: 4400;
        box-shadow: -2px 0 22px rgba(0,0,0,0.28);
        transition: right .28s cubic-bezier(.2,.9,.2,1);
        overflow-y: auto;
        padding: 70px 18px 24px;
        border-left: 1px solid rgba(255,255,255,0.1);
        box-sizing: border-box;
    }
    .offcanvas.open { right: 0; }
    .offcanvas .offcanvas-close {
        position: absolute;
        top: 16px;
        right: 16px;
        background: rgba(255,255,255,0.08);
        border: 1px solid rgba(255,255,255,0.12);
        width: 36px;
        height: 36px;
        border-radius: 10px;
        font-size: 1.25rem;
        line-height: 34px;
        color: #fff;
        transition: all 0.2s ease;
    }
    .offcanvas .offcanvas-close:hover { 
        background: rgba(255,255,255,0.12); 
        border-color: rgba(255,255,255,0.2);
        box-shadow: 0 0 8px rgba(255,255,255,0.15);
    }
    .offcanvas .mobile-nav-list { list-style: none; margin: 0; padding: 0; }
    .offcanvas .mobile-nav-list > li { margin: 0; }
    .offcanvas .mobile-nav-list a { 
        display: block; 
        padding: 14px 16px; 
        margin: 6px 0; 
        border-radius: 12px; 
        color: #e8e8e8; 
        text-decoration: none; 
        background: rgba(255,255,255,0.04); 
        border: 1px solid rgba(255,255,255,0.08); 
        transition: all 0.2s ease;
        font-size: 0.95rem;
    }
    .offcanvas .mobile-nav-list a:hover { 
        background: rgba(255,255,255,0.08); 
        border-color: rgba(255,255,255,0.15);
        box-shadow: 0 0 12px rgba(255,255,255,0.1);
        transform: translateX(2px); 
    }
    body.mobile-nav-open { overflow: hidden; }
}

/* Desktop Navigation */
@media (min-width: 992px) {
    .nav-menu {
        display: flex !important;
        flex-direction: row;
    }

    .nav-menu li {
        margin-left: 25px;
    }

    .nav-menu a {
        position: relative;
    }

    .nav-menu a::after {
        content: '';
        position: absolute;
        bottom: -2px;
        left: 0;
        width: 0;
        height: 2px;
        background: var(--primary-color);
        transition: width 0.3s ease;
    }

    .nav-menu a:hover::after,
    .nav-menu li.active a::after {
        width: 100%;
    }
}

/* Ensure off-canvas never shows on desktop */
@media (min-width: 992px) {
    .offcanvas-overlay, .offcanvas { display: none !important; }
    .offcanvas .mobile-nav-list a.active { 
        background: rgba(200,200,200,0.15); 
        border-color: rgba(200,200,200,0.3);
        box-shadow: 0 0 16px rgba(200,200,200,0.15);
        color: #e8e8e8;
    }
    .offcanvas .menu-section { 
        padding: 8px 6px; 
        margin: 16px 0 8px; 
        color: rgba(255,255,255,0.85); 
        font-weight: 600; 
        font-size: 0.75rem; 
        letter-spacing: .08em; 
        text-transform: uppercase; 
    }
}