/**
 * SteadyFlow - Apple-inspired Header & Mega Menu
 * Clean, minimal, professional design
 */

/* ===========================================
   NAVIGATION BASE
   =========================================== */

.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 0 40px;
    height: 72px;
    /* Slightly taller for premium feel */
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Theme adaptation - background remains dark/glassy but text stays black as requested */
.nav-dark {
    background: rgba(255, 255, 255, 0.85) !important;
    /* Slightly more opaque glass for black text contrast */
    border-bottom-color: rgba(0, 0, 0, 0.1);
}

/* Consistent black theme for header elements */
.nav-logo,
.nav-link {
    color: var(--black) !important;
}

.mobile-menu-toggle span {
    background-color: black !important;
}

.nav-link:hover {
    background: rgba(0, 0, 0, 0.05);
}

.nav.scrolled {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

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

/* ===========================================
   LOGO
   =========================================== */

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.125rem;
    color: var(--black);
}

.nav-logo svg {
    width: 32px;
    height: 32px;
}

.nav-logo span {
    letter-spacing: -0.02em;
}

/* ===========================================
   NAV LINKS
   =========================================== */

.nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.nav-link:hover {
    color: var(--black);
    background: rgba(0, 0, 0, 0.04);
}

.nav-link .chevron {
    width: 14px;
    height: 14px;
    opacity: 0.5;
    transition: transform 0.2s ease;
}

.nav-item.has-mega:hover .chevron {
    transform: rotate(180deg);
}

/* ===========================================
   NAV ACTIONS (Right side)
   =========================================== */

.nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-actions .btn-primary {
    padding: 10px 20px;
    font-size: 0.875rem;
    font-weight: 600;
}

/* ===========================================
   MEGA MENU - Apple Style
   =========================================== */

.nav-item {
    position: relative;
}

.mega-menu {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);

    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.25s ease;
}

.mega-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.mega-menu-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 40px;
}

/* ===========================================
   MEGA MENU COLUMNS
   =========================================== */

.mega-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.mega-category {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.mega-icon {
    font-size: 1.25rem;
}

.mega-category h3 {
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    margin: 0;
}

/* ===========================================
   MEGA MENU LINKS
   =========================================== */

.mega-links {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mega-links a {
    display: block;
    padding: 12px 16px;
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.mega-links a:hover {
    background: rgba(0, 0, 0, 0.04);
}

.mega-links a strong {
    display: block;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--black);
    margin-bottom: 2px;
}

.mega-links a span {
    display: block;
    font-size: 0.8125rem;
    color: var(--gray-500);
    line-height: 1.4;
}

/* ===========================================
   MEGA MENU HIGHLIGHT COLUMN
   =========================================== */

.mega-col.mega-highlight {
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.08), rgba(129, 140, 248, 0.08));
    padding: 24px;
    border-radius: 16px;
    margin: -24px;
    margin-left: 0;
}

.mega-col.mega-highlight .mega-category {
    border-bottom-color: rgba(96, 165, 250, 0.2);
}

.mega-cta {
    background: linear-gradient(135deg, #60A5FA, #818CF8) !important;
}

.mega-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(96, 165, 250, 0.3);
}

.mega-cta strong {
    color: white !important;
}

.mega-cta span {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* ===========================================
   MOBILE MENU TOGGLE
   =========================================== */

.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: 10px;
    background: none;
    border: none;
    cursor: pointer;
}

.mobile-menu-toggle span {
    width: 24px;
    height: 2px;
    background: var(--black);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ===========================================
   MOBILE MENU OVERLAY
   =========================================== */

.mobile-menu-overlay {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.hero .mobile-menu-overlay,
.section-dark .mobile-menu-overlay {
    background: rgba(15, 23, 42, 0.98);
}

.hero .mobile-menu-overlay a,
.section-dark .mobile-menu-overlay a,
.hero .mobile-menu-overlay .mobile-accordion-trigger,
.section-dark .mobile-menu-overlay .mobile-accordion-trigger {
    color: var(--white);
}

.hero .mobile-menu-overlay .mobile-menu-section,
.section-dark .mobile-menu-overlay .mobile-menu-section {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-menu-content {
    padding: 24px;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mobile-menu-section {
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.mobile-menu-section.link-section a {
    display: block;
    padding: 16px 0;
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--black);
    text-decoration: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.mobile-accordion-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--black);
    cursor: pointer;
}

.mobile-accordion-trigger .chevron {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
    opacity: 0.5;
}

.mobile-accordion-trigger.active .chevron {
    transform: rotate(180deg);
}

.mobile-accordion-content {
    display: none;
    padding: 0 0 16px 16px;
    flex-direction: column;
    gap: 20px;
}

.mobile-accordion-content.active {
    display: flex;
}

.mobile-sub-group {
    padding-bottom: 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.mobile-sub-group:last-child {
    padding-bottom: 0;
    border-bottom: none;
}

.hero .mobile-sub-group,
.section-dark .mobile-sub-group {
    border-bottom-color: rgba(255, 255, 255, 0.04);
}

.mobile-sub-group h5 {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    margin-bottom: 12px;
}

.mobile-sub-group a {
    display: block;
    padding: 8px 0;
    font-size: 0.9375rem;
    color: var(--gray-700);
    text-decoration: none;
}

.mobile-menu-footer {
    padding: 24px 0;
    margin-top: auto;
}

.btn-block {
    display: block;
    width: 100%;
    text-align: center;
}

/* ===========================================
   RESPONSIVE
   =========================================== */

@media (max-width: 1024px) {
    .nav {
        padding: 0 24px;
    }

    .mega-menu-inner {
        grid-template-columns: repeat(2, 1fr);
        padding: 32px;
    }

    .mega-col.mega-highlight {
        margin: 0;
    }
}

@media (max-width: 768px) {
    .nav {
        height: 64px;
        padding: 0 16px;
    }

    .nav-container {
        justify-content: space-between;
    }

    .nav-links,
    .nav-actions,
    .mega-menu {
        display: none;
    }

    .mobile-menu-toggle {
        display: flex;
        order: 2;
        width: 44px;
        height: 44px;
        align-items: center;
        justify-content: center;
    }

    .nav-logo {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        margin: 0;
        z-index: 10;
        order: 1;
    }
}

/* Body lock when menu is open */
body.menu-open {
    overflow: hidden;
}