/* =============================
   TOP BAR
   ============================= */
.top-bar {
    background-color: var(--color-primary);
    color: white;
    padding: 8px 0;
    font-size: 14px;
}

.top-bar a {
    color: white;
    text-decoration: none;
    transition: opacity 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-style: normal;
}

.top-bar .contact-info {
    text-decoration: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0;
}

/* =============================
   MAIN HEADER
   ============================= */
.main-header {
    background-color: var(--color-accent);
    padding: 5px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 30px;
}

nav {
    flex-grow: 1;
    display: flex;
    justify-content: center;
}

.container {
    max-width: 1480px;
    margin: 0 auto;
    padding: 0 15px;
}

.logo {
    width: auto;
    height: 45px;
}

.header-actions {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 15px;
}

/* =============================
   NAVIGATION MENU
   ============================= */
.nav-menu {
    display: flex;
    gap: 40px;
    align-items: center;
    list-style: none;
    margin: 0;
}

.nav-menu li {
    position: static;
}

.nav-menu .has-mega-menu {
    position: static;
}

.nav-menu > li > a {
    color: white;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    transition: opacity 0.3s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-menu > li > a:hover {
    opacity: 0.8;
}

/* Icon Color on Hover */
.nav-menu > li > a:hover .nav-chevron,
.nav-menu > li > a:hover i {
    color: white;
    stroke: white;
}

.nav-menu .nav-cta {
    display: none;
}

/* CTA Button */
.cta-button {
    background-color: var(--color-primary) !important;
    color: white !important;
    padding: 8px 28px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 400;
    transition: all 0.3s;
    white-space: nowrap;
    border: 2px solid var(--color-primary);
    cursor: pointer;
}

.cta-button:hover {
    background-color: #004d3d !important; /* Slightly darker manual shade */
    border-color: #004d3d;
    color: white !important;
    transform: translateY(-2px);
}

/* =============================
   MEGA MENU (DESKTOP)
   ============================= */
.mega-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
    min-width: 1000px;
    padding: 30px;
    margin-top: 10px;
}

.nav-menu li:hover .mega-menu {
    opacity: 1;
    visibility: visible;
}

.mega-menu-content {
    display: flex;
    gap: 30px;
}

/* Mega Menu Sidebar */
.mega-menu-sidebar {
    min-width: 280px;
    background-color: white;
    padding: 0;
    border-right: 1px solid var(--color-accent-dim);
    padding-right: 30px;
}

.mega-menu-sidebar h3 {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 20px;
    padding: 0 10px;
}

.service-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.service-list li {
    margin-bottom: 8px;
}

.service-list a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--color-primary) !important;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
    font-size: 15px;
    font-weight: 500;
}

.service-list a svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: var(--color-primary);
    stroke: var(--color-primary);
}

.service-list a:hover {
    background-color: #f3f4f6;
    color: var(--color-primary) !important;
}

/* Active sidebar item on hover */
.service-list a.active {
    background-color: var(--color-primary) !important;
    color: white !important;
    border-radius: 4px;
    box-shadow: 0px 5px 11.8px rgba(0, 53, 43, 0.45); /* Adjusted shadow to match primary */
}

.service-list a.active svg {
    color: white !important;
    stroke: white !important;
}

/* Mega Menu Main Content */
.mega-menu-main {
    flex: 1;
    padding-top: 10px;
    position: relative;
    overflow: hidden;
}

.mega-menu-main::after {
    content: "";
    position: absolute;
    top: 0;
    right: -30px;
    bottom: 0;
    width: 300px;
    background-image: url("https://images.unsplash.com/photo-1542838681-7c933b91a329?q=80&w=1974&auto=format&fit=crop");
    background-size: cover;
    background-position: center;
    opacity: 0.5;
    pointer-events: none;
    z-index: 1;
    border-radius: 0 16px 16px 0;
}

.mega-menu-header {
    position: relative;
    z-index: 2;
    margin-bottom: 1rem;
}

.mega-menu-header h2 {
    color: var(--color-accent);
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 8px;
}

.mega-menu-header p {
    color: var(--color-primary);
    font-size: 12px;
    margin: 0;
}

/* Main Content Grid */
.mega-menu-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    position: relative;
    z-index: 2;
}

/* Grid item styling */
.mega-menu-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px;
    border: 1px solid transparent;
    border-radius: 12px;
    transition: all 0.2s;
    text-decoration: none;
    color: inherit;
}

.mega-menu-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.mega-menu-icon {
    width: 24px;
    height: 24px;
    background-color: transparent;
    border-radius: 0;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 0;
    padding-top: 2px;
}

.mega-menu-icon svg {
    width: 24px;
    height: 24px;
    color: var(--color-primary);
    stroke: var(--color-primary);
}

.mega-menu-text h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-primary);
}

.mega-menu-text p {
    font-size: 12px;
    font-weight: 500;
    color: var(--color-primary);
    opacity: 0.8;
    margin: 0;
}

/* Mobile Menu Toggle (Button) */
.mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
}

.mobile-toggle svg {
    width: 28px;
    height: 28px;
}

.close-menu {
    display: none;
}

/* ============================================== */
/* WHY AUSTRALIA MEGA MENU STYLES (DESKTOP)       */
/* ============================================== */

.why-australia-item {
    position: static !important;
}

.why-australia-mega-menu {
    min-width: 850px;
    padding: 30px;
}

.why-australia-content {
    display: flex;
    gap: 30px;
    align-items: stretch;
}

.why-australia-links {
    width: 50%;
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding-top: 10px;
}

.why-item {
    padding: 10px;
    align-items: center;
}

.why-australia-cta-box {
    width: 50%;
    background-color: var(--color-bg-cream);
    border-radius: 10px;
    padding: 30px;
    text-align: center;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.why-australia-cta-box .cta-box-content {
    position: relative;
    z-index: 2;
}

.why-australia-cta-box h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-primary);
}

.why-australia-cta-box p {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.why-australia-cta-box::before {
    content: "";
    position: absolute;
    top: 30px;
    right: 40px;
    width: 60px;
    height: 60px;
    background-color: rgba(224, 224, 224, 0.4);
    border-radius: 8px;
    transform: rotate(15deg);
}

.why-australia-cta-box .cta-button {
    width: 100%;
    padding: 10px 20px;
}

/* ============================================== */
/* TOOLS & RESOURCES MEGA MENU STYLES (DESKTOP)   */
/* ============================================== */

.resources-item {
    position: static !important;
}

.resources-mega-menu {
    min-width: 850px;
    padding: 30px;
}

.resources-content {
    display: flex;
    gap: 30px;
    align-items: stretch;
}

.resources-links {
    width: 50%;
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding-top: 10px;
}

.resource-item {
    padding: 15px;
    align-items: center;
}

.resources-calculator-box {
    width: 50%;
    background-color: var(--color-bg-cream);
    border-radius: 10px;
    padding: 30px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 15px;
}

.resources-calculator-box .mega-menu-header {
    margin-bottom: 20px;
}

.nav-chevron {
    width: 16px;
    height: 16px;
    color: white;
    stroke: white;
    transition: transform 0.3s ease;
}

.nav-menu li:hover .nav-chevron {
    transform: rotate(180deg);
}

/* ============================================== */
/* MOBILE DRAWER STYLES                           */
/* ============================================== */

#mobile-menu-drawer {
    display: none;
}

/* Overlay for mobile */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

@media (max-width: 991px) {
    /* Hide Desktop Elements */
    .logo {
        width: auto;
        height: 40px;
    }

    .main-header nav,
    .header-actions .cta-button {
        display: none;
    }

    .container {
        padding: 0 15px;
    }

    /* Show Mobile Toggle */
    .mobile-toggle {
        display: block;
    }

    /* Drawer Container */
    #mobile-menu-drawer {
        display: block;
        position: fixed;
        top: 0;
        right: 0;
        height: 100vh;
        width: 100%;
        background-color: white;
        z-index: 999;
        transform: translateX(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        box-shadow: -5px 0 25px rgba(0, 0, 0, 0.1);
        padding-bottom: 40px;
    }

    #mobile-menu-drawer.active {
        transform: translateX(0);
    }

    /* Drawer Header */
    .drawer-header {
        display: flex;
        justify-content: end;
        align-items: center;
        padding: 20px 24px;
        border-bottom: 1px solid var(--color-border);
    }

    .drawer-title {
        font-size: 18px;
        font-weight: 700;
        color: var(--color-primary);
    }

    .close-drawer-btn {
        background: none;
        border: none;
        color: #6b7280;
        cursor: pointer;
        padding: 4px;
    }

    /* Mobile List */
    .mobile-nav-list {
        padding: 16px;
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    /* Mobile Links & Toggles */
    .mobile-link,
    .mobile-accordion-toggle {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 12px;
        border-radius: 8px;
        text-decoration: none;
        font-size: 15px;
        font-weight: 500;
        color: #374151; /* Standard dark gray */
        background: none;
        border: none;
        cursor: pointer;
        transition: background-color 0.2s;
        text-align: left;
    }

    .mobile-link:hover,
    .mobile-accordion-toggle:hover {
        background-color: #f3f4f6;
        color: var(--color-primary);
    }

    .mobile-link-content {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .mobile-icon {
        width: 20px;
        height: 20px;
        color: var(--color-accent);
    }

    /* Active State for Mobile Icons */
    .mobile-accordion-toggle[aria-expanded="true"] .mobile-icon,
    .mobile-link:hover .mobile-icon {
        color: var(--color-accent);
    }

    .mobile-chevron {
        width: 16px;
        height: 16px;
        color: var(--color-accent);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .mobile-accordion-toggle[aria-expanded="true"] .mobile-chevron {
        transform: rotate(180deg);
        color: var(--color-accent);
    }

    /* --- MOBILE TREE ANIMATION & STRUCTURE --- */

    .mobile-tree-container {
        display: flex;
        flex-direction: column;
        gap: 2px;
        max-height: 0;
        opacity: 0;
        overflow: hidden;
        transition: max-height 0.4s ease-in-out, opacity 0.4s ease-in-out, margin 0.3s ease;

        /* Border Logic */
        border-left: 2px solid var(--color-border);
        border-left-color: transparent;
        margin-left: 22px;
        padding-left: 12px;
    }

    .mobile-tree-container.open {
        max-height: 1000px;
        opacity: 1;
        margin-top: 4px;
        margin-bottom: 4px;
        border-left-color: var(--color-accent);
    }

    .mobile-tree-item {
        position: relative;
        display: flex;
        align-items: center;
        padding: 10px 12px;
        font-size: 14px;
        color: #4b5563;
        text-decoration: none;
        border-radius: 6px;
        transition: background 0.2s;
    }

    .mobile-tree-item:hover {
        background-color: #f9fafb;
        color: var(--color-primary);
    }

    /* Horizontal Connector Line */
    .mobile-tree-item::before {
        content: "";
        position: absolute;
        left: -12px;
        top: 50%;
        width: 10px;
        height: 2px;
        background-color: var(--color-accent);
    }

    /* Mobile CTA */
    .mobile-cta-container {
        padding: 20px;
        margin-top: 10px;
    }

    .mobile-cta-container .cta-button {
        display: block;
        width: 100%;
        text-align: center;
    }
}