/* ========================================
   Navigation
   ======================================== */

.navbar {
    background: rgba(10, 14, 23, 0.95);
    border-bottom: 1px solid var(--border-light);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-lg);
    padding: var(--spacing-xs) var(--spacing-xs);
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.nav-brand h1 {
    font-size: 1.75rem;
    color: var(--primary-color);
    font-weight: 700;
    letter-spacing: -0.02em;
    text-shadow: 0 0 20px rgba(0, 217, 255, 0.5);
    margin: 0;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.625rem 1rem;
    border-radius: var(--radius-lg);
    transition: var(--transition);
    font-weight: 500;
    font-size: 0.95rem;
    white-space: nowrap;
    position: relative;
}

.nav-link:hover {
    background: var(--surface-elevated);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.nav-link.active {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    box-shadow: 0 0 15px rgba(0, 217, 255, 0.5),
                0 4px 12px rgba(0, 217, 255, 0.3);
}

/* User Info Desktop */
.user-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: 0.5rem 1rem;
    background: var(--surface-elevated);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    margin-left: var(--spacing-md);
}

.user-info #userName {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.95rem;
}

/* Level Badge Styles */
.user-info .cur8-badge {
    padding: 0.375rem 0.75rem;
    color: white;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.875rem;
    box-shadow: 0 0 10px rgba(179, 136, 255, 0.4);
}

.level-badge-container {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--surface);
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    background: var(--background-light);
}

.level-badge-icon {
    font-size: 24px;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
}

.level-badge-info {
    flex: 1;
    min-width: 0;
}

.level-badge-title {
    font-weight: 800;
    font-size: 14px;
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.level-badge-number {
    color: rgba(255, 255, 255, 0.95);
    font-size: 13px;
    background: rgba(0, 0, 0, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
}

.level-badge-separator {
    color: rgba(255, 255, 255, 0.6);
}

.level-badge-progress-container {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 5px;
}

.level-badge-progress-bar {
    flex: 1;
    height: 6px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.level-badge-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.7));
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
    transition: width 0.3s ease;
}

.level-badge-progress-text {
    font-size: 11px;
    font-weight: 700;
    color: #ffffff;
    min-width: 36px;
    text-align: right;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.user-info #logoutBtn,
.btn-logout {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, var(--error), #dc2626);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(255, 61, 113, 0.3);
}

.user-info #logoutBtn:hover,
.btn-logout:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 61, 113, 0.4);
}

/* Hide auth-required links by default */
.nav-link.auth-required {
    display: none;
}

/* Quest Notification Badge */
.quest-notification-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: linear-gradient(135deg, var(--secondary-color), #ff6b9d);
    color: white;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 15px rgba(255, 61, 113, 0.6),
                0 0 30px rgba(255, 61, 113, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.3);
    z-index: 10;
    animation: badge-appear 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

#questsLink {
    position: relative;
}

@keyframes badge-appear {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(0deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 15px rgba(255, 61, 113, 0.6),
                    0 0 30px rgba(255, 61, 113, 0.3);
    }
    50% {
        transform: scale(1.15);
        box-shadow: 0 0 25px rgba(255, 61, 113, 0.8),
                    0 0 50px rgba(255, 61, 113, 0.5),
                    0 0 75px rgba(255, 61, 113, 0.2);
    }
}

@keyframes glow-pulse {
    0%, 100% {
        text-shadow: 0 0 5px rgba(255, 61, 113, 0.5);
    }
    50% {
        text-shadow: 0 0 15px rgba(255, 61, 113, 0.8),
                     0 0 25px rgba(255, 61, 113, 0.5);
    }
}

.pulse-animation {
    animation: pulse 2s ease-in-out infinite;
}

#questsLink:has(.quest-notification-badge) {
    animation: glow-pulse 2s ease-in-out infinite;
}

/* Hamburger Menu */
.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: var(--spacing-sm);
    z-index: 1001;
    position: relative;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: var(--transition);
}

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

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

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

/* Mobile Navigation */
@media (max-width: 768px) {
    .navbar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
        z-index: 1000;
    }
    
    /* Add padding to main content to account for fixed header */
    main {
        padding-top: calc(60px + var(--spacing-xl));
    }
    
    .nav-toggle {
        display: flex;
    }
    
    .navbar .container {
        flex-wrap: nowrap;
    }
    
    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        height: 100vh;
        width: 280px;
        flex-direction: column;
        align-items: stretch;
        background: rgba(26, 26, 26, 0.98);
        backdrop-filter: blur(20px);
        padding: 80px var(--spacing-lg) var(--spacing-lg);
        gap: 0;
        transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.5);
        border-left: 1px solid var(--border);
        overflow-y: auto;
        z-index: 999;
    }
    
    .nav-menu.active {
        right: 0;
    }
    
    .nav-link {
        text-align: left;
        padding: var(--spacing-md);
        margin-bottom: var(--spacing-xs);
        border-radius: var(--radius-md);
    }
    
    /* Quest notification badge adjustments for mobile */\n    .quest-notification-badge {
        top: 50%;
        right: 10px;
        transform: translateY(-50%);
    }
    
    .user-info {
        flex-direction: column;
        align-items: stretch;
        gap: var(--spacing-sm);
        padding: var(--spacing-md);
        background: var(--surface);
        border-radius: var(--radius-md);
        margin-bottom: var(--spacing-md);
    }
    
    .user-info #userName {
        font-weight: 600;
        color: var(--text-primary);
    }
    
    .user-info .cur8-badge {
        padding: var(--spacing-xs) var(--spacing-sm);
        background: var(--primary-color);
        border-radius: var(--radius-sm);
        text-align: center;
    }
    
    .user-info #logoutBtn {
        width: 100%;
        padding: var(--spacing-sm);
        background: var(--error);
        border: none;
        border-radius: var(--radius-md);
        color: white;
        cursor: pointer;
        transition: var(--transition);
    }
    
    .user-info #logoutBtn:hover {
        background: #dc2626;
    }
}

@media (max-width: 480px) {
    .nav-brand h1 {
        font-size: 1.2rem;
    }
    
    .nav-menu {
        width: 100%;
        right: -100%;
    }
    
    .nav-menu.active {
        right: 0;
    }
}
