/* =============================================
   NAVBAR + MEGA-MENU STYLES
   Engineering Plastics Information Portal
   ============================================= */

/* --- Topbar --- */
.topbar {
    background: #111111;
    height: 32px;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.topbar-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 32px;
    width: 100%;
    display: flex;
    justify-content: flex-end;
}

.topbar-items {
    display: flex;
    align-items: center;
    gap: 0;
}

.topbar-item {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 700;
    color: #FFFFFF;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    white-space: nowrap;
}

.topbar-divider {
    font-family: var(--font-mono);
    font-size: 10px;
    color: #333333;
    margin: 0 12px;
}

/* --- Navbar --- */
.navbar {
    background: var(--bg-nav);
    height: 64px;
    border-bottom: 1px solid var(--border-default);
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
}

.navbar-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 32px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Logo */
.navbar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
}

.logo-mark {
    display: flex;
    align-items: center;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 16px;
    text-transform: uppercase;
    color: var(--text-primary);
    letter-spacing: 0.04em;
    line-height: 1;
}

.logo-subtitle {
    font-family: var(--font-mono);
    font-size: 15px;
    font-weight: 700;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 0.2em;
    margin-top: 4px;
    line-height: 1;
}

/* Nav Links - Default to Mobile State */
.navbar-links {
    display: none;
    position: fixed;
    top: 96px; /* topbar 32px + navbar 64px */
    left: 0;
    right: 0;
    background: var(--bg-surface);
    flex-direction: column;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-default);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    z-index: 998;
}

.navbar-links.open {
    display: flex;
}

.nav-link {
    font-family: var(--font-main);
    font-size: 16px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #2d2d2d;
    padding: 16px 32px;
    width: 100%;
    position: relative;
    transition: color 0.2s ease;
    background: transparent;
    border: none;
    margin: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    text-decoration: none;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background-color: var(--gold);
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.25s ease;
}

.nav-link:hover {
    color: #111111;
}

.nav-link:hover::after {
    transform: scaleX(1);
}

.nav-link.active {
    color: #111111;
}

.nav-link.active::after {
    transform: scaleX(1);
}

.nav-chevron {
    transition: transform 0.2s ease;
}

.nav-dropdown-toggle[aria-expanded="true"] .nav-chevron {
    transform: rotate(180deg);
}

/* CTA Button - Hidden on mobile by default */
.navbar-cta {
    display: none;
    font-family: var(--font-main);
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background-color: var(--gold);
    color: var(--text-primary);
    padding: 12px 28px;
    transition: background-color 0.2s ease;
    flex-shrink: 0;
    border-radius: 0;
}

.navbar-cta:hover {
    background-color: var(--gold-light);
}

/* Mobile Toggle - Default to Visible */
.mobile-toggle {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 8px;
    cursor: pointer;
    background: none;
    border: none;
}

.mobile-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-primary);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.mobile-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}
.mobile-toggle.active span:nth-child(2) {
    opacity: 0;
}
.mobile-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* --- Mega Menu --- */
.mega-menu {
    position: fixed;
    top: 96px; /* topbar 32px + navbar 64px */
    left: 0;
    right: 0;
    z-index: 999;
    pointer-events: none;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.35s cubic-bezier(0.4,0,0.2,1), max-height 0.35s cubic-bezier(0.4,0,0.2,1);
}

.mega-menu.open {
    pointer-events: auto;
    opacity: 1;
    max-height: 440px;
}

.mega-menu-inner {
    max-width: 1400px;
    margin: 0 auto;
    background: #FFFFFF;
    border-top: 2px solid var(--gold);
    box-shadow: 0 12px 40px rgba(0,0,0,0.10);
    display: flex;
    min-height: 340px;
}

/* Category List (Left) */
.mega-menu-categories {
    width: 260px;
    background: var(--bg-card);
    border-right: 1px solid var(--border-default);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding: 8px 0;
}

.mega-cat-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    color: #111111;
    border: none;
    background: none;
    cursor: pointer;
    border-left: 2px solid transparent;
    transition: background-color 0.15s ease, border-color 0.15s ease;
    text-align: left;
    width: 100%;
    letter-spacing: 0.01em;
}

.mega-cat-item:hover {
    border-left-color: var(--gold);
    background: #E8E7E1;
}

.mega-cat-item.active {
    background: #FFFFFF;
    border-left-color: var(--gold);
}

.mega-cat-count {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--gold-dim);
    background: rgba(0,123,255,0.12);
    padding: 2px 10px;
    letter-spacing: 0;
}

/* Right Panel */
.mega-menu-panels {
    flex: 1;
    padding: 28px 32px;
    position: relative;
    overflow-y: auto;
}

.mega-panel {
    display: none;
}

.mega-panel.active {
    display: block;
}

.mega-panel-label {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.15em;
}

.mega-panel-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 26px;
    text-transform: uppercase;
    color: #111111;
    margin-top: 6px;
    letter-spacing: 0.01em;
}

.mega-panel-rule {
    border: none;
    border-top: 1px solid var(--border-default);
    margin: 16px 0;
}

.mega-panel-columns {
    display: flex;
    flex-wrap: wrap;
    gap: 32px;
}

.mega-subcategory {
    min-width: 180px;
}

.mega-sub-label {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--gold-dim);
    letter-spacing: 0.15em;
    display: block;
    margin-bottom: 12px;
}

.mega-plastic-list {
    list-style: none;
    padding: 0;
}

.mega-plastic-list li {
    margin-bottom: 4px;
}

.mega-plastic-link {
    font-family: var(--font-main);
    font-weight: 500;
    font-size: 13.5px;
    text-transform: uppercase;
    color: #444444;
    letter-spacing: 0.01em;
    padding: 4px 0;
    display: inline-flex;
    align-items: center;
    gap: 0;
    transition: color 0.2s ease, padding-left 0.2s ease;
}

.mega-plastic-link:hover {
    color: var(--gold-dim);
    padding-left: 4px;
}

.mega-plastic-link:hover::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 4px;
    background: var(--gold);
    margin-right: 8px;
    flex-shrink: 0;
}

/* --- Desktop Enhancements --- */
@media (min-width: 1025px) {
    .navbar-links {
        display: flex;
        position: static;
        flex-direction: row;
        padding: 0;
        height: 100%;
        background: transparent;
        box-shadow: none;
        border: none;
        width: auto;
    }

    .nav-link {
        height: 64px;
        width: auto;
        padding: 0 22px;
        font-size: 13.5px;
        justify-content: center;
    }

    .nav-link::after {
        display: block; /* Show underline on desktop */
    }

    .navbar-cta {
        display: block;
    }

    .mobile-toggle {
        display: none;
    }

    .mega-menu {
        top: 96px;
    }

    .mega-menu-inner {
        flex-direction: row;
    }

    .mega-menu-categories {
        width: 260px;
        flex-direction: column;
        overflow-x: visible;
        border-right: 1px solid var(--border-default);
        border-bottom: none;
    }

    .mega-cat-item {
        padding: 12px 20px;
        border-left: 2px solid transparent;
        border-bottom: none;
    }

    .mega-cat-item:hover,
    .mega-cat-item.active {
        border-left-color: var(--gold);
        border-bottom-color: transparent;
    }

    .mega-panel-columns {
        flex-direction: row;
    }
}

@media (max-width: 768px) {
    .topbar {
        display: none;
    }
    
    .navbar {
        top: 0;
    }

    .mega-menu {
        top: 64px;
    }

    .navbar-links {
        top: 64px;
    }
}
