/* ═══════════════════════════════════════════════════════════
   ULTRA PREMIUM NAVIGATION — CURVED PILL DESIGN
   Always-on pill/curve nav with smooth scroll shrink
   ═══════════════════════════════════════════════════════════ */

/* ── Base nav: pill shape from the very first load ── */
.main-nav {
    position: fixed;
    top: 42px;          /* sits below the 42px top social bar */
    left: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 1px solid rgba(0, 0, 0, 0.07);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    z-index: 9999;
    margin-top: 10px;
    overflow: hidden;
    transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                right 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                border-radius 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                margin-top 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Scrolled state: tighter, more elevated pill ── */
.main-nav.scrolled {
    background: rgba(255, 255, 255, 0.99);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.13);
    left: 20px;
    right: 20px;
    border-radius: 24px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    margin-top: 8px;
    overflow: hidden;
}

/* ── Nav container ── */
.nav-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 48px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 80px;
    transition: height 0.3s ease, padding 0.3s ease;
}

.main-nav.scrolled .nav-container {
    height: 68px;
    padding: 0 40px;
}

/* ── Logo ── */
.nav-logo {
    z-index: 10001;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.nav-logo:hover {
    transform: scale(1.04);
}

.nav-logo img {
    height: 58px;
    width: auto;
    transition: height 0.3s ease;
}

.main-nav.scrolled .nav-logo img {
    height: 50px;
}

/* ── Desktop nav links ── */
.nav-links {
    display: flex;
    list-style: none;
    gap: 4px;
    margin: 0;
    padding: 0;
    align-items: center;
}

.nav-links > li {
    position: relative;
}

.nav-links > li > a {
    font-size: 14px;
    font-weight: 500;
    color: #1F2937;
    letter-spacing: 0.2px;
    padding: 8px 14px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    position: relative;
    border-radius: 10px;
    transition: color 0.25s ease, background 0.25s ease;
    text-decoration: none;
    white-space: nowrap;
}

.nav-links > li > a:hover,
.nav-links > li > a.active {
    color: #3A7BD5;
    background: rgba(58, 123, 213, 0.07);
}

/* Underline accent */
.nav-links > li > a::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 14px;
    right: 14px;
    height: 2px;
    background: #3A7BD5;
    border-radius: 2px;
    transform: scaleX(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-links > li > a:hover::after,
.nav-links > li > a.active::after {
    transform: scaleX(1);
}

/* ── Chevron icon ── */
.nav-links li.has-dropdown > a .fa-chevron-down {
    font-size: 9px;
    margin-left: 2px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.55;
}

.nav-links li.has-dropdown:hover > a .fa-chevron-down {
    transform: rotate(180deg);
    opacity: 1;
}

/* ═══════════════════════════════════════════════════════════
   MEGA DROPDOWN — aligned to pill nav bottom edge
   ═══════════════════════════════════════════════════════════ */

.dropdown-menu {
    position: fixed;
    /* top is set dynamically by JS to nav bottom edge */
    left: 16px;
    right: 16px;
    width: auto;
    background: #0f1117;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.28s cubic-bezier(0.4, 0, 0.2, 1),
                visibility 0.28s;
    z-index: 9998;
    border-radius: 0 0 20px 20px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-top: none;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
    padding: 0;
    list-style: none;
    overflow: hidden;
}

.nav-links li.has-dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* ── Dropdown inner grid ── */
.dropdown-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 64px 44px;
    display: grid;
    gap: 14px;
}

.dropdown-inner.cols-2 { grid-template-columns: repeat(2, 1fr); }
.dropdown-inner.cols-3 { grid-template-columns: repeat(3, 1fr); }

/* ── Dropdown items ── */
.dropdown-menu li {
    list-style: none;
}

.dropdown-menu li a {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 20px 22px;
    border-radius: 12px;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: background 0.22s ease, border-color 0.22s ease, transform 0.22s ease;
    height: 100%;
}

.dropdown-menu li a:hover {
    background: rgba(58, 123, 213, 0.13);
    border-color: rgba(58, 123, 213, 0.32);
    transform: translateY(-2px);
}

/* Item title */
.dd-title {
    font-size: 15px;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: 0.1px;
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dd-title i {
    font-size: 14px;
    color: #3A7BD5;
    flex-shrink: 0;
}

/* Item description */
.dd-desc {
    font-size: 13px;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.45);
    line-height: 1.55;
}

/* Arrow */
.dd-arrow {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.2);
    margin-top: 6px;
    transition: color 0.22s ease, transform 0.22s ease;
    display: inline-block;
}

.dropdown-menu li a:hover .dd-arrow {
    color: #3A7BD5;
    transform: translateX(4px);
}

/* External badge */
.dd-ext {
    font-size: 10px;
    padding: 2px 7px;
    background: rgba(58, 123, 213, 0.15);
    border: 1px solid rgba(58, 123, 213, 0.25);
    border-radius: 20px;
    color: #3A7BD5;
    font-weight: 500;
    letter-spacing: 0.3px;
    margin-left: 4px;
}

/* Footer divider inside dropdown */
.dropdown-footer {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 64px 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dropdown-footer-line {
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.07);
}

.dropdown-footer-label {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.2);
    letter-spacing: 1.8px;
    text-transform: uppercase;
    white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════
   RIGHT SIDE — Demo button & hamburger
   ═══════════════════════════════════════════════════════════ */

.nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.nav-search-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: transparent;
    color: #1F2937;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.25s ease;
}

.nav-search-btn:hover {
    background: rgba(58, 123, 213, 0.08);
    border-color: rgba(58, 123, 213, 0.3);
    color: #3A7BD5;
}

.nav-demo-btn {
    padding: 10px 24px;
    background: linear-gradient(135deg, #3A7BD5 0%, #2563EB 100%);
    color: #FFFFFF;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    transition: all 0.25s ease;
    box-shadow: 0 3px 12px rgba(58, 123, 213, 0.28);
    white-space: nowrap;
}

.nav-demo-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(58, 123, 213, 0.4);
    background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
    color: #FFFFFF;
}

/* ── Hamburger toggle ── */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 32px;
    height: 22px;
    cursor: pointer;
    z-index: 10001;
    position: relative;
    background: transparent;
    border: none;
    padding: 0;
}

.nav-toggle-inner {
    width: 28px;
    height: 20px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.nav-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background: #1F2937;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    transform-origin: center;
    border-radius: 2px;
}

.nav-toggle.active span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
    background: #fff;
}

.nav-toggle.active span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.nav-toggle.active span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
    background: #fff;
}

/* ═══════════════════════════════════════════════════════════
   FULL-SCREEN MOBILE OVERLAY MENU
   ═══════════════════════════════════════════════════════════ */

.nav-overlay-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: linear-gradient(135deg, #0a1628 0%, #1a365d 100%);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
}

.nav-overlay-menu.active {
    opacity: 1;
    visibility: visible;
}

/* Close button */
.overlay-close-btn {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10002;
}

.overlay-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.6);
    transform: rotate(90deg);
}

.overlay-close-btn span {
    position: relative;
    width: 20px;
    height: 20px;
}

.overlay-close-btn span::before,
.overlay-close-btn span::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    background: #fff;
}

.overlay-close-btn span::before { transform: rotate(45deg); }
.overlay-close-btn span::after  { transform: rotate(-45deg); }

/* Overlay content */
.overlay-menu-content {
    text-align: center;
    padding: 40px;
    max-width: 600px;
    width: 100%;
}

.overlay-menu-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.overlay-menu-links li {
    margin: 0;
    overflow: hidden;
}

.overlay-menu-links li a {
    display: block;
    font-size: 30px;
    font-weight: 300;
    color: #ffffff;
    padding: 14px 0;
    text-decoration: none;
    transition: all 0.3s ease;
    transform: translateY(100%);
    opacity: 0;
    letter-spacing: 0.5px;
}

.nav-overlay-menu.active .overlay-menu-links li a {
    transform: translateY(0);
    opacity: 1;
}

.nav-overlay-menu.active .overlay-menu-links li:nth-child(1) a { transition-delay: 0.08s; }
.nav-overlay-menu.active .overlay-menu-links li:nth-child(2) a { transition-delay: 0.13s; }
.nav-overlay-menu.active .overlay-menu-links li:nth-child(3) a { transition-delay: 0.18s; }
.nav-overlay-menu.active .overlay-menu-links li:nth-child(4) a { transition-delay: 0.23s; }
.nav-overlay-menu.active .overlay-menu-links li:nth-child(5) a { transition-delay: 0.28s; }
.nav-overlay-menu.active .overlay-menu-links li:nth-child(6) a { transition-delay: 0.33s; }
.nav-overlay-menu.active .overlay-menu-links li:nth-child(7) a { transition-delay: 0.38s; }

.overlay-menu-links li a:hover {
    color: #60A5FA;
    transform: translateX(8px);
}

.overlay-menu-links li a.active {
    color: #60A5FA;
}

/* Overlay submenu */
.overlay-submenu {
    list-style: none;
    padding: 0 0 0 20px;
    margin: 8px 0 0 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 0;
}

.overlay-menu-links li.has-submenu.open .overlay-submenu {
    max-height: 300px;
    opacity: 1;
}

.overlay-submenu li a {
    font-size: 17px;
    padding: 8px 0;
    color: rgba(255, 255, 255, 0.65);
    display: block;
}

.overlay-submenu li a:hover {
    color: #60A5FA;
}

/* Submenu toggle arrow */
.overlay-menu-links li.has-submenu > a {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
}

.overlay-menu-links li.has-submenu > a .menu-text {
    flex: 1;
}

.overlay-menu-links li.has-submenu > a .submenu-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    margin-left: 10px;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.1);
}

.overlay-menu-links li.has-submenu > a .submenu-arrow:hover {
    background: rgba(255, 255, 255, 0.2);
}

.overlay-menu-links li.has-submenu > a .submenu-arrow i {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
    transition: transform 0.3s ease, color 0.3s ease;
}

.overlay-menu-links li.has-submenu.open > a .submenu-arrow {
    background: rgba(96, 165, 250, 0.2);
}

.overlay-menu-links li.has-submenu.open > a .submenu-arrow i {
    transform: rotate(180deg);
    color: #60A5FA;
}

/* Overlay contact CTA */
.overlay-contact {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.overlay-contact p {
    color: rgba(255, 255, 255, 0.5);
    font-size: 13px;
    margin-bottom: 12px;
    letter-spacing: 0.5px;
}

.overlay-contact a {
    color: #60A5FA;
    font-size: 15px;
    font-weight: 500;
    transition: color 0.3s ease;
}

.overlay-contact a:hover {
    color: #ffffff;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE — tablet & mobile
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 1024px) {
    /* Hide desktop links, show hamburger */
    .nav-links {
        display: none !important;
    }

    .nav-toggle {
        display: flex !important;
    }

    .nav-container {
        padding: 0 24px;
    }

    /* Dropdown hidden on mobile (uses overlay instead) */
    .dropdown-menu {
        display: none !important;
    }
}

@media (max-width: 768px) {
    /* Collapse pill to full-width on small screens */
    .main-nav,
    .main-nav.scrolled {
        top: 42px;
        left: 0;
        right: 0;
        border-radius: 0;
        margin-top: 0;
        border-left: none;
        border-right: none;
        border-top: none;
        overflow: visible;
    }

    .main-nav.scrolled .nav-container {
        height: 64px;
    }

    .nav-container {
        height: 68px;
        padding: 0 20px;
    }

    .nav-logo img {
        height: 48px;
    }

    .main-nav.scrolled .nav-logo img {
        height: 44px;
    }
}

@media (max-width: 480px) {
    .nav-container {
        height: 60px;
        padding: 0 16px;
    }

    .main-nav.scrolled .nav-container {
        height: 56px;
    }

    .nav-logo img {
        height: 42px;
    }
}
