/* =============================================
   UNIFIED PILL NAVBAR - WorldBrain Mexico
   Glassmorphism + Dynamic Contrast + Responsive
   ============================================= */

/* =============================================
   BASE - Pill Container
   ============================================= */

.nav-pill {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 100px;
    background: rgba(10, 10, 30, 0.72);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: calc(100% - 32px);
}

/* Scrolled state - more solid */
.nav-pill.scrolled {
    background: rgba(10, 10, 30, 0.88);
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.06) inset;
    top: 12px;
}

/* =============================================
   LIGHT MODE - Inverted Contrast
   ============================================= */

html.light-mode .nav-pill {
    background: rgba(255, 255, 255, 0.78);
    border-color: rgba(0, 0, 0, 0.06);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.08),
        0 0 0 1px rgba(0, 0, 0, 0.03) inset;
}

html.light-mode .nav-pill.scrolled {
    background: rgba(255, 255, 255, 0.92);
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.12),
        0 0 0 1px rgba(0, 0, 0, 0.05) inset;
}

html.light-mode .nav-pill-logo {
    color: #1e1b4b;
}

html.light-mode .nav-pill-link {
    color: #475569;
}

html.light-mode .nav-pill-link:hover,
html.light-mode .nav-pill-link:focus-visible {
    color: #1e1b4b;
    background: rgba(0, 0, 0, 0.04);
}

html.light-mode .nav-pill-cta {
    background: #4f46e5;
    color: white;
}

html.light-mode .nav-pill-cta:hover {
    background: #4338ca;
}

html.light-mode .nav-pill-hamburger span {
    background: #1e1b4b;
}

html.light-mode .nav-pill-theme {
    color: #475569;
    border-color: rgba(0, 0, 0, 0.08);
}

html.light-mode .nav-pill-theme:hover {
    background: rgba(0, 0, 0, 0.05);
}

html.light-mode .nav-dropdown-menu {
    background: rgba(255, 255, 255, 0.96);
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12);
}

html.light-mode .nav-dropdown-menu .dropdown-group-title {
    color: #6366f1;
}

html.light-mode .nav-dropdown-menu a {
    color: #475569;
}

html.light-mode .nav-dropdown-menu a:hover {
    color: #1e1b4b;
    background: rgba(99, 102, 241, 0.06);
}

html.light-mode .nav-mobile-panel {
    background: rgba(255, 255, 255, 0.95);
}

html.light-mode .nav-mobile-panel .nav-pill-link {
    color: #334155;
    border-bottom-color: rgba(0, 0, 0, 0.06);
}

html.light-mode .nav-mobile-panel .nav-pill-link:hover {
    color: #1e1b4b;
    background: rgba(99, 102, 241, 0.05);
}

html.light-mode .nav-mobile-panel .mobile-dropdown-content a {
    color: #475569;
}

html.light-mode .nav-mobile-panel .mobile-dropdown-content a:hover {
    color: #4f46e5;
}

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

.nav-pill-logo {
    font-family: 'Outfit', 'Space Grotesk', sans-serif;
    font-weight: 800;
    font-size: 1.15rem;
    color: #f8fafc;
    text-decoration: none;
    letter-spacing: -0.02em;
    white-space: nowrap;
    padding: 4px 8px 4px 4px;
    transition: opacity 0.2s ease;
}

.nav-pill-logo:hover {
    opacity: 0.85;
}

.nav-pill-logo span {
    background: linear-gradient(135deg, #6366f1, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* =============================================
   NAV LINKS (Desktop)
   ============================================= */

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

.nav-pill-link {
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    color: #cbd5e1;
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 100px;
    transition: all 0.2s ease;
    white-space: nowrap;
    cursor: pointer;
    background: none;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.nav-pill-link:hover,
.nav-pill-link:focus-visible {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
}

.nav-pill-link:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

.nav-pill-link i {
    font-size: 0.65rem;
    transition: transform 0.2s ease;
}

.nav-dropdown.open .nav-pill-link i {
    transform: rotate(180deg);
}

/* =============================================
   CTA BUTTON
   ============================================= */

.nav-pill-cta {
    font-family: 'Inter', sans-serif;
    font-size: 0.84rem;
    font-weight: 600;
    color: #ffffff;
    text-decoration: none;
    padding: 9px 18px;
    border-radius: 100px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    transition: all 0.25s ease;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.nav-pill-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
}

.nav-pill-cta:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 3px;
}

/* =============================================
   THEME TOGGLE
   ============================================= */

.nav-pill-theme {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    color: #94a3b8;
    padding: 0;
    flex-shrink: 0;
}

.nav-pill-theme:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.nav-pill-theme:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

.nav-pill-theme .icon-sun {
    display: none;
}

html.light-mode .nav-pill-theme .icon-moon {
    display: none;
}

html.light-mode .nav-pill-theme .icon-sun {
    display: inline;
}

/* =============================================
   HAMBURGER (Mobile only)
   ============================================= */

.nav-pill-hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 8px;
    background: none;
    border: none;
    border-radius: 8px;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.nav-pill-hamburger:hover {
    background: rgba(255, 255, 255, 0.08);
}

.nav-pill-hamburger:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

.nav-pill-hamburger span {
    width: 20px;
    height: 2px;
    background: #e2e8f0;
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}

.nav-pill-hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(4px, 4px);
}

.nav-pill-hamburger.active span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.nav-pill-hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* =============================================
   DROPDOWN MENU (Desktop)
   ============================================= */

.nav-dropdown {
    position: relative;
}

.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 16px);
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    min-width: 480px;
    padding: 24px;
    background: rgba(15, 12, 40, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    z-index: 100;
}

.nav-dropdown-menu::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: 8px;
}

.nav-dropdown.open .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.nav-dropdown-menu .dropdown-group-title {
    font-family: 'Outfit', sans-serif;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #6366f1;
    font-weight: 700;
    padding: 4px 12px 8px;
    display: block;
}

.nav-dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    font-family: 'Inter', sans-serif;
    font-size: 0.84rem;
    color: #cbd5e1;
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.15s ease;
}

.nav-dropdown-menu a:hover {
    color: #ffffff;
    background: rgba(99, 102, 241, 0.12);
}

.nav-dropdown-menu a:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

.nav-dropdown-menu a i {
    width: 20px;
    text-align: center;
    color: #6366f1;
    font-size: 0.8rem;
}

/* =============================================
   MOBILE PANEL
   ============================================= */

.nav-mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

.nav-mobile-panel {
    position: fixed;
    top: 0;
    right: -100%;
    width: 85%;
    max-width: 360px;
    height: 100vh;
    background: rgba(12, 10, 30, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 10000;
    padding: 80px 24px 32px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    border-left: 1px solid rgba(255, 255, 255, 0.06);
}

.nav-mobile-panel.active {
    right: 0;
}

.nav-mobile-panel .nav-pill-link {
    font-size: 1.05rem;
    padding: 14px 16px;
    border-radius: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    width: 100%;
    justify-content: space-between;
}

.nav-mobile-panel .nav-pill-link:hover {
    background: rgba(255, 255, 255, 0.05);
}

.nav-mobile-panel .nav-pill-cta {
    margin-top: 16px;
    padding: 16px 24px;
    text-align: center;
    font-size: 1rem;
    display: block;
    width: 100%;
}

/* Mobile dropdown accordion */
.mobile-dropdown-content {
    display: none;
    padding: 8px 0 8px 16px;
    flex-direction: column;
    gap: 2px;
}

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

.mobile-dropdown-content a {
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    color: #94a3b8;
    text-decoration: none;
    padding: 10px 14px;
    border-radius: 8px;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.mobile-dropdown-content a:hover {
    color: #e2e8f0;
    background: rgba(99, 102, 241, 0.08);
}

.mobile-dropdown-content a i {
    color: #6366f1;
    width: 18px;
    text-align: center;
    font-size: 0.8rem;
}

.mobile-dropdown-content .dropdown-group-title {
    font-family: 'Outfit', sans-serif;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #6366f1;
    font-weight: 700;
    padding: 12px 14px 4px;
}

/* =============================================
   RESPONSIVE - TABLET (768px - 1024px)
   ============================================= */

@media (max-width: 1024px) {
    .nav-pill {
        padding: 8px 16px;
        gap: 4px;
    }

    .nav-pill-link {
        font-size: 0.82rem;
        padding: 7px 10px;
    }

    .nav-pill-cta {
        font-size: 0.8rem;
        padding: 8px 14px;
    }

    .nav-pill-logo {
        font-size: 1.05rem;
    }

    .nav-dropdown-menu {
        min-width: 420px;
        padding: 20px;
    }
}

/* =============================================
   RESPONSIVE - MOBILE (<768px)
   ============================================= */

@media (max-width: 768px) {
    .nav-pill {
        top: 12px;
        padding: 10px 16px;
        width: calc(100% - 24px);
        max-width: none;
        justify-content: space-between;
    }

    .nav-pill.scrolled {
        top: 8px;
    }

    .nav-pill-links {
        display: none;
    }

    .nav-pill-hamburger {
        display: flex;
    }

    .nav-pill-logo {
        font-size: 1.1rem;
    }
}

/* =============================================
   RESPONSIVE - SMALL MOBILE (<480px)
   ============================================= */

@media (max-width: 480px) {
    .nav-pill {
        top: 8px;
        padding: 8px 14px;
        width: calc(100% - 16px);
    }

    .nav-pill-logo {
        font-size: 1rem;
    }

    .nav-pill-theme {
        width: 30px;
        height: 30px;
        font-size: 0.75rem;
    }

    .nav-mobile-panel {
        width: 90%;
        max-width: none;
        padding: 72px 20px 24px;
    }
}

/* =============================================
   ACCESSIBILITY
   ============================================= */

@media (prefers-reduced-motion: reduce) {
    .nav-pill,
    .nav-pill-link,
    .nav-pill-cta,
    .nav-dropdown-menu,
    .nav-mobile-panel,
    .nav-mobile-overlay,
    .nav-pill-hamburger span {
        transition: none;
    }
}

/* Skip to content link */
.nav-skip-link {
    position: absolute;
    top: -100%;
    left: 16px;
    padding: 8px 16px;
    background: #6366f1;
    color: white;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    z-index: 99999;
    transition: top 0.2s ease;
}

.nav-skip-link:focus {
    top: 16px;
}
