/* ========================================
   Modern Navigation Bar - Desktop & Mobile
   ======================================== */

/* Base Navigation Styles */
.main-nav {
    background: #ffffff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: all 0.3s ease;
}

.main-nav.scrolled {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
}

/* Navigation Container */
.nav-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    position: relative;
}

/* Logo */
.nav-logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.nav-logo a {
    font-family: 'Merriweather', serif;
    font-size: 24px;
    font-weight: 900;
    color: #0B3D91;
    letter-spacing: -0.5px;
    white-space: nowrap;
    text-decoration: none;
    transition: color 0.3s ease;
}

.nav-logo a:hover {
    color: #1565C0;
}

/* Logo Image Style */
.nav-logo-img {
    height: 45px;
    width: auto;
    object-fit: contain;
    display: block;
}

@media (max-width: 768px) {
    .nav-logo-img {
        height: 36px;
    }
}

@media (max-width: 480px) {
    .nav-logo-img {
        height: 32px;
    }
}

/* Desktop Navigation Links */
.nav-links {
    display: flex;
    align-items: center;
    gap: 32px;
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
    justify-content: center;
}

.nav-link-item {
    position: relative;
}

.nav-link-item a {
    color: #333;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.3s;
    position: relative;
    padding: 8px 0;
    display: block;
    white-space: nowrap;
}

.nav-link-item a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: #D4AF37;
    transition: width 0.3s ease;
}

.nav-link-item a:hover {
    color: #0B3D91;
}

.nav-link-item a:hover::after {
    width: 100%;
}

/* Navigation Actions */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.nav-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.3s ease;
    white-space: nowrap;
    cursor: pointer;
    border: none;
    outline: none;
}

.nav-button-secondary {
    background: transparent;
    color: #333;
    border: 1px solid #e0e0e0;
}

.nav-button-secondary:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.nav-button-primary {
    background: linear-gradient(135deg, #1565C0 0%, #0B3D91 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(21, 101, 192, 0.3);
}

.nav-button-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(21, 101, 192, 0.4);
}

/* Invitation Code Display (Desktop) */
.nav-invite-code {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    background: linear-gradient(135deg, #fff8e1 0%, #ffe082 100%);
    border: 1px solid #ffd54f;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #f57c00;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-invite-code:hover {
    background: linear-gradient(135deg, #ffe082 0%, #ffd54f 100%);
    transform: scale(1.05);
}

/* Mobile Header Actions Container */
.mobile-nav-header-actions {
    display: none;
    align-items: center;
    gap: 12px;
}

/* Mobile Grab Position Button */
.mobile-grab-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #FF6B35 0%, #FF4500 100%);
    color: white;
    border-radius: 20px;
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(255, 69, 0, 0.3);
    transition: all 0.3s ease;
    white-space: nowrap;
}

.mobile-grab-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 69, 0, 0.4);
}

.mobile-grab-btn:active {
    transform: translateY(0);
}

.grab-icon {
    font-size: 16px;
    animation: pulse 2s infinite;
}

.grab-text {
    font-size: 14px;
    letter-spacing: 0.5px;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
}

.mobile-menu-icon {
    width: 100%;
    height: 3px;
    background: #333;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle.active .mobile-menu-icon:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

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

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

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.mobile-menu-overlay.active {
    opacity: 1;
    pointer-events: auto;
    animation: fadeIn 0.3s ease;
}

/* Overlay Fade Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Mobile Menu Drawer */
.mobile-menu-drawer {
    position: fixed;
    top: 0;
    right: -100%;
    width: 85%;
    max-width: 400px;
    height: 100vh;
    height: 100dvh; /* Use dynamic viewport height */
    background: white;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    overflow-y: auto;
    display: none; /* Hidden by default */
    flex-direction: column;
    visibility: hidden; /* Prevent interaction */
    opacity: 0;
}

.mobile-menu-drawer.active {
    right: 0;
    display: flex; /* Show when active */
    visibility: visible; /* Allow interaction */
    opacity: 1;
    animation: slideInFromRight 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Mobile Menu Slide Animation */
@keyframes slideInFromRight {
    from {
        right: -100%;
        opacity: 0;
    }
    to {
        right: 0;
        opacity: 1;
    }
}

/* Mobile Menu Header */
.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e0e0e0;
}

.mobile-menu-title {
    font-family: 'Merriweather', serif;
    font-size: 20px;
    font-weight: 900;
    color: #0B3D91;
}

.mobile-menu-close {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
}

.mobile-menu-close svg {
    width: 24px;
    height: 24px;
}

/* Mobile Navigation Links */
.mobile-nav-links {
    list-style: none;
    margin: 0;
    padding: 24px 0;
    flex: 1;
}

.mobile-nav-links li {
    margin: 0;
}

.mobile-nav-links a {
    display: block;
    padding: 16px 24px;
    color: #333;
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.mobile-nav-links a:hover,
.mobile-nav-links a:active {
    background: #f5f5f5;
    color: #0B3D91;
    border-left-color: #D4AF37;
}

/* Mobile Navigation Actions */
.mobile-nav-actions {
    padding: 24px;
    padding-bottom: max(24px, env(safe-area-inset-bottom)); /* Handle safe area */
    border-top: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: auto; /* Push to bottom */
    flex-shrink: 0; /* Prevent shrinking */
}

.mobile-nav-actions .nav-button {
    width: 100%;
    text-align: center;
    padding: 14px 24px;
    font-size: 15px;
}

/* Mobile Invitation Code */
.mobile-invite-code {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 24px;
    background: linear-gradient(135deg, #fff8e1 0%, #ffe082 100%);
    border-radius: 12px;
    margin: 0 24px 16px 24px;
}

.mobile-invite-code-label {
    font-size: 12px;
    color: #f57c00;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mobile-invite-code-value {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.mobile-invite-code-text {
    font-size: 18px;
    font-weight: 700;
    color: #e65100;
    letter-spacing: 1px;
}

.mobile-invite-code-copy {
    background: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    color: #f57c00;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-invite-code-copy:hover {
    background: #f57c00;
    color: white;
}

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

/* Tablet & Mobile */
@media (max-width: 1024px) {
    .nav-links {
        gap: 24px;
    }

    .nav-link-item a {
        font-size: 14px;
    }

    .nav-actions {
        gap: 8px;
    }

    .nav-button {
        padding: 8px 16px;
        font-size: 13px;
    }
}

/* Mobile Only */
@media (max-width: 768px) {
    .nav-content {
        padding: 12px 16px;
    }

    .nav-logo a {
        font-size: 20px;
    }

    /* Hide desktop menu */
    .nav-links {
        display: none;
    }

    .nav-actions {
        display: none;
    }

    .nav-invite-code {
        display: none;
    }

    /* Show mobile header actions */
    .mobile-nav-header-actions {
        display: flex;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }

    /* Show mobile menu elements */
    .mobile-menu-overlay {
        display: block;
    }

    /* Mobile drawer shown only when active class added */
}

/* Small Mobile */
@media (max-width: 480px) {
    .nav-content {
        padding: 10px 12px;
    }

    .nav-logo a {
        font-size: 18px;
    }

    .mobile-menu-drawer.active {
        width: 90%;
    }

    .mobile-nav-links a {
        font-size: 15px;
        padding: 14px 20px;
    }
}

/* ========================================
   ACCESSIBILITY & ANIMATIONS
   ======================================== */

/* Focus States */
.nav-button:focus,
.nav-link-item a:focus,
.mobile-menu-toggle:focus,
.mobile-menu-close:focus {
    outline: 2px solid #1565C0;
    outline-offset: 2px;
}

/* Smooth Scroll */
html {
    scroll-behavior: smooth;
}

/* Reduce Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
