/**
 * Unified Navbar Component
 * Provides consistent navigation across all pages with authentication state management
 */

/* ========================================
   NAVBAR CONTAINER
   ======================================== */

.unified-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(220, 20, 60, 0.2);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 4rem;
    max-height: 4rem;
}

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

.navbar-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: opacity 0.2s;
    gap: 0.75rem;
    height: 2.5rem;
    max-height: 2.5rem;
    overflow: visible;
    position: relative;
    width: auto;
    background-color: #000000;
    padding: 0.5rem 1rem;
    border-radius: 4px;
}

.navbar-logo:hover {
    opacity: 0.8;
}

.logo-image {
    height: 2.5rem !important;
    width: auto !important;
    max-width: 15rem !important;
    object-fit: contain;
    object-position: center;
    display: block;
    max-height: 2.5rem;
    background-color: #000000;
    mix-blend-mode: normal;
}

.logo-text {
    font-family: 'UniformExtraCondensed', sans-serif;
    font-size: 1.4rem;
    font-weight: normal;
    color: #DC143C;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ========================================
   NAVIGATION LINKS
   ======================================== */

.navbar-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.public-links,
.auth-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-link {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s;
    font-weight: 500;
}

.nav-link:hover {
    color: #DC143C;
}

.nav-link.admin-only {
    color: rgba(255, 200, 100, 0.9);
}

.nav-link.admin-only:hover {
    color: #FFD700;
}

/* ========================================
   USER SECTION
   ======================================== */

.navbar-user-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* User Info Display (authenticated) */
#navbar-user-info {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 0.75rem 1.25rem;
}

#navbar-user-info:hover {
    background: rgba(220, 20, 60, 0.1);
    border-color: rgba(220, 20, 60, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 20, 60, 0.2);
}

.user-plan-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-name {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
}

.user-plan-badge {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05));
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.9);
}

.user-credits-badge {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2), rgba(118, 75, 162, 0.15));
    border: 1px solid rgba(102, 126, 234, 0.4);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

/* Clerk User Button Container */
#navbar-clerk-button {
    display: flex;
    align-items: center;
}

/* ========================================
   AUTH BUTTONS (unauthenticated)
   ======================================== */

.navbar-auth-buttons {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.nav-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-family: 'CartographMono', monospace;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    display: inline-block;
    cursor: pointer;
}

.nav-btn-primary {
    background: #DC143C;
    color: #fff;
    border: none;
    box-shadow: 0 4px 15px rgba(220, 20, 60, 0.3);
}

.nav-btn-primary:hover {
    background: #E8303C;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(220, 20, 60, 0.5);
}

.nav-btn-secondary {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.9);
}

.nav-btn-secondary:hover {
    border-color: #DC143C;
    color: #DC143C;
}

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

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

.mobile-menu-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background: rgba(255, 255, 255, 0.9);
    transition: all 0.3s ease;
    border-radius: 3px;
}

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

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

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

/* ========================================
   MOBILE RESPONSIVE STYLES
   ======================================== */

@media (max-width: 768px) {
    .nav-container {
        padding: 2.5rem;
        max-height: 3.75rem;
    }
    
    .navbar-logo {
        height: 2.25rem;
        max-height: 2.25rem;
    }

    .logo-text {
        font-size: 1.2rem;
    }

    .logo-image {
        height: 2.25rem !important;
        max-width: 14rem !important;
        width: auto !important;
    }

    /* Mobile navigation links */
    .navbar-links {
        position: fixed;
        top: 3.75rem;
        left: 0;
        right: 0;
        flex-direction: column;
        background: rgba(0, 0, 0, 0.98);
        backdrop-filter: blur(20px);
        border-bottom: 1px solid rgba(220, 20, 60, 0.3);
        padding: 2rem;
        gap: 0;
        transform: translateY(-100%);
        opacity: 0;
        pointer-events: none;
        transition: all 0.3s ease;
    }

    .navbar-links.mobile-open {
        transform: translateY(0);
        opacity: 1;
        pointer-events: all;
    }

    .public-links,
    .auth-links {
        flex-direction: column;
        width: 100%;
        gap: 0;
    }

    .nav-link {
        width: 100%;
        padding: 1rem 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        text-align: center;
        font-size: 1.1rem;
    }

    .nav-link:last-child {
        border-bottom: none;
    }

    /* Show mobile menu toggle */
    .mobile-menu-toggle {
        display: flex;
        order: 3;
    }

    /* User section adjustments */
    .navbar-user-section {
        gap: 0.5rem;
        order: 2;
    }

    /* Hide detailed user info on mobile */
    #navbar-user-info {
        display: none !important;
    }

    /* Make auth buttons vertical on mobile menu */
    .navbar-auth-buttons {
        flex-direction: column;
        width: 100%;
        gap: 1rem;
        margin-top: 1.5rem;
    }

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

    /* Clerk button stays visible */
    #navbar-clerk-button {
        display: flex;
    }

    /* Logo order */
    .navbar-logo {
        order: 1;
    }
}

@media (max-width: 480px) {
    .nav-container {
        padding: 2.5rem;
        max-height: 3.5rem;
    }
    
    .navbar-logo {
        height: 2rem;
        max-height: 2rem;
    }

    .logo-image {
        height: 2rem !important;
        max-width: 12rem !important;
        width: auto !important;
    }

    .nav-btn {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.hidden {
    display: none !important;
}

.visible {
    display: flex !important;
}

/* Adjust page content to account for fixed navbar */
body {
    padding-top: 4rem;
}

@media (max-width: 768px) {
    body {
        padding-top: 3.75rem;
    }
}
