/* =================================================================== */
/* ✅ FINAL navigation.css WITH GLOBAL RENDERING FIX ✅                */
/* =================================================================== */

/* --- Main Header Structure --- */
.main-header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    transition: background-color 0.4s ease;
    /* THIS IS THE CRITICAL FIX: It creates a new rendering layer for the entire header */
    transform: translateZ(0);
}

.main-header.scrolled {
    position: fixed;
    background-color: #000000;
}

.main-header .container {
    display: flex;
    gap: 4.5in;
    align-items: center;

}

.logo img {
    height: 60px;
    width: auto;
    padding-top: 20px;
}

/* --- Desktop Navigation --- */

.main-nav .nav-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;

}

.main-nav .nav-links>li {
    margin: 0 20px;
}

.main-nav .nav-links>li>a {
    color: #ffffff;
    text-decoration: none;
    font-weight: 500;
    font-size: 16px;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.main-nav .nav-links>li>a:hover {
    color: #d80000;
}

/* --- Mega Menu Dropdowns (Desktop) --- */
.mega-menu {
    position: static;
}

.mega-menu .dropdown-content {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: #000000;
    box-shadow: 0px 8px 25px rgba(0, 0, 0, 0.3);
    padding: 40px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.4s ease;
}

.mega-menu:hover .dropdown-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.mega-menu-inner {
    width: 90%;
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    gap: 60px;
    align-items: flex-start;
}

.mega-menu-column {
    flex: 1;
}

.mega-menu-column h4 {
    color: #d80000;
    text-transform: uppercase;
    font-size: 14px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.mega-menu-column a {
    display: block;
    color: #fff;
    padding: 8px 0;
    transition: color 0.3s ease;
}

.mega-menu-column a:hover {
    color: #d80000;
}

.mega-menu-column:only-child {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px 30px;
}

.mega-menu-column:only-child h4 {
    grid-column: 1 / -1;
}

/* --- Header Right Side & Hamburger --- */
.header-right {
    display: flex;
    align-items: center;
}

.mobile-nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 9999;
    padding: 15px;
}

.hamburger {
    display: block;
    position: relative;
    width: 24px;
    height: 2px;
    background-color: #fff;
    transition: all 0.3s ease-in-out;
}

.hamburger::before,
.hamburger::after {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: #fff;
    transition: all 0.3s ease-in-out;
}

.hamburger::before {
    top: -8px;
}

.hamburger::after {
    bottom: -8px;
}

.mobile-nav-toggle.active .hamburger {
    background-color: transparent;
}

.mobile-nav-toggle.active .hamburger::before {
    transform: translateY(8px) rotate(45deg);
}

.mobile-nav-toggle.active .hamburger::after {
    transform: translateY(-8px) rotate(-45deg);
}

.dropdown-arrow {
    display: none;
}

/* ========================================================== */
/* ---        ✅ FINAL RESPONSIVE DROP-DOWN LOGIC ✅        --- */
/* ========================================================== */
@media (max-width: 1080px) {
    .main-header {
        height: 80px;
        background-color: #000;
    }

    .main-header .logo {
        height: 100%;
        padding-left: 25px;
        display: flex;
        align-items: center;
    }

    .logo img {
        height: 50px;
    }

    .header-right {
        height: 100%;
    }

    .mobile-nav-toggle {
        display: flex;
        align-items: center;
        height: 100%;
    }

    .main-nav {
        position: absolute;
        top: 80px;
        left: 0;
        width: 100%;
        background-color: #111;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px);
        transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
        height: calc(100vh - 80px);
        overflow-y: auto;
    }

    .main-nav.active {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .main-nav .nav-links {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        padding: 10px 0;
    }

    .main-nav .nav-links>li {
        width: 100%;
    }

    .main-nav .nav-links>li>a {
        font-size: 1.3rem;
        font-weight: 500;
        padding: 15px 30px;
        width: 100%;
        text-align: center;
    }

    .mega-menu:hover>.dropdown-content {
        display: none;
    }

    .mega-menu .dropdown-content {
        position: static;
        background-color: rgba(0, 0, 0, 0.2);
        box-shadow: none;
        padding: 0;
        opacity: 1;
        visibility: visible;
        transform: none;
        width: 100%;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.4s ease-out, padding 0.4s ease-out;
    }

    .mega-menu.active>.dropdown-content {
        max-height: 1000px;
        padding: 10px 0;
        transition: max-height 0.4s ease-in, padding 0.4s ease-in;
    }

    .dropdown-content .mega-menu-inner,
    .dropdown-content .mega-menu-column {
        display: block;
        width: 100%;
        background: none;
        padding: 0;
        margin: 0;
        border-radius: 0;
    }

    .dropdown-content .mega-menu-column h4 {
        display: none;
    }

    /* --- ✅ THIS IS THE COMPLETED RULE --- */
    .dropdown-content .mega-menu-column a {
        font-size: 1rem;
        color: #ccc;
        padding: 12px 50px;
        text-align: left;
    }

    .dropdown-arrow {
        display: inline-block;
        width: 10px;
        height: 10px;
        border-right: 2px solid #fff;
        border-bottom: 2px solid #fff;
        transform: rotate(45deg);
        transition: transform 0.3s ease-in-out;
    }

    .mega-menu.active>a>.dropdown-arrow {
        transform: rotate(225deg);
    }

    /* --- THIS IS THE FIX --- */
    .main-header .container {
        display: flex;
        /* Ensure flex is still applied */
        justify-content: space-between;
        /* Pushes logo and nav toggle to opposite ends */
        align-items: center;
        /* Vertically aligns them */
        width: 100%;
        /* Adds some space on the sides */
        gap: 0;
        /* Removes the fixed gap that was breaking the layout */
    }
}