/* CSS Variables for dynamic theming */
:root {
    /* Default theme colors */
    --navbar-primary: #6366f1;
    --navbar-secondary: #8b5cf6;
    --navbar-text: #1f2937;
    --navbar-text-light: #6b7280;
    --navbar-bg: #ffffff;
    --navbar-border: rgba(0, 0, 0, 0.1);
    --navbar-hover-bg: rgba(99, 102, 241, 0.1);
    /* New variables for link styling */
    --navbar-link-bg: #1f2937;
    --navbar-link-text: #ffffff;
    --navbar-link-hover-bg: #374151;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --navbar-text: #f9fafb;
        --navbar-text-light: #d1d5db;
        --navbar-bg: #111827;
        --navbar-border: rgba(255, 255, 255, 0.1);
        --navbar-hover-bg: rgba(99, 102, 241, 0.2);
        /* Dark mode link styling - inverted */
        --navbar-link-bg: #f9fafb;
        --navbar-link-text: #1f2937;
        --navbar-link-hover-bg: #e5e7eb;
    }
}

/* Theme color overrides - USING SPECIFIC SELECTORS */
.navbar.navbar-animation-theme {
    --navbar-primary: #f59e0b !important;
    --navbar-secondary: #d97706 !important;
}

.navbar.navbar-comics-theme {
    --navbar-primary: #dc2626 !important;
    --navbar-secondary: #b91c1c !important;
}

.navbar.navbar-tv-theme {
    --navbar-primary: #0891b2 !important;
    --navbar-secondary: #0e7490 !important;
}

.navbar.navbar-webseries-theme {
    --navbar-primary: #10b981 !important;
    --navbar-secondary: #059669 !important;
}

.navbar.navbar-games-theme {
    --navbar-primary: #7c3aed !important;
    --navbar-secondary: #5b21b6 !important;
}

.navbar.navbar-vertical-theme {
    --navbar-primary: #8b5cf6 !important;
    --navbar-secondary: #7c3aed !important;
}

.navbar.navbar-credits-theme {
    --navbar-primary: #a16207 !important;
    --navbar-secondary: #92400e !important;
}

.navbar.navbar-screenplays-theme {
    --navbar-primary: #ec4899 !important;
    --navbar-secondary: #db2777 !important;
}

.navbar.navbar-novels-theme {
    --navbar-primary: #22c55e !important;
    --navbar-secondary: #16a34a !important;
}

.navbar.navbar-exhibits-theme {
    --navbar-primary: #06b6d4 !important;
    --navbar-secondary: #0891b2 !important;
}

.navbar.navbar-press-theme {
    --navbar-primary: #6366f1 !important;
    --navbar-secondary: #4f46e5 !important;
}

.navbar.navbar-contact-theme {
    --navbar-primary: #14b8a6 !important;
    --navbar-secondary: #0f766e !important;
}

/* Navbar base styles */
.navbar {
    background: var(--navbar-bg);
    border-bottom: 1px solid var(--navbar-border);
    transition: all 0.3s ease;
    position: relative;
    z-index: 1000;
}

.navbar-container {
    width: 100%;
    margin: 0 auto;
    padding: 1.5rem 1rem 1rem;
}

/* Brand section - centered */
.navbar-brand {
    text-align: center;
    margin-bottom: 0;
}

.navbar-title {
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    font-weight: 700;
    color: var(--navbar-text);
    text-decoration: none;
    margin-bottom: -0.25rem;
    display: block;
    background: linear-gradient(135deg, var(--navbar-primary), var(--navbar-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
    transition: all 0.3s ease;
    line-height: 1.1;
}

.navbar-subtitle {
    font-size: clamp(1.5rem, 2.5vw, 1.75rem);
    font-weight: 500;
    color: var(--navbar-text-light);
    letter-spacing: 0.02em;
    margin-top: -0.1rem;
    line-height: 1.2;
}

/* Navigation menu - RESPONSIVE WITH CSS ONLY */
.navbar-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
    list-style: none;
    overflow: visible;
    width: 100%;
    margin-top: 1rem;
    padding: 0;
}

.navbar-nav-item {
    display: flex;
    flex-shrink: 1;
    flex-grow: 0;
    flex-basis: auto;
}

.navbar-nav-link {
    display: block;
    padding: 0.5rem 0.4rem;
    background: var(--navbar-link-bg);
    color: var(--navbar-link-text);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.8rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    white-space: nowrap;
    position: relative;
    min-width: 0;
    text-align: center;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.navbar-nav-link:hover {
    background: var(--navbar-link-hover-bg);
    color: var(--navbar-link-text);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* TEXT SIZE RESPONSIVE SYSTEM - CSS ONLY */
/* Default: Show XL text, hide others */
.nav-text-xl { display: inline; }
.nav-text-lg { display: none; }
.nav-text-md { display: none; }
.nav-text-sm { display: none; }
.nav-text-es { display: none; }

/* Default: Hide ES controls */
.nav-show-es { display: none; }
.nav-hide-es { display: flex; }

/* At 1500px: Switch to LG text */
@media (max-width: 1500px) {
    .nav-text-xl { display: none; }
    .nav-text-lg { display: inline; }
    
    .navbar-nav-link {
        font-size: 0.75rem;
        padding: 0.45rem 0.35rem;
    }
    
    .navbar-nav {
        gap: 0.2rem;
    }
}

/* At 1100px: Switch to MD text */
@media (max-width: 1100px) {
    .nav-text-lg { display: none; }
    .nav-text-md { display: inline; }
    
    .navbar-nav-link {
        font-size: 0.7rem;
        padding: 0.4rem 0.3rem;
    }
    
    .navbar-nav {
        gap: 0.15rem;
    }
}

/* At 790px: Switch to SM text */
@media (max-width: 790px) {
    .nav-text-md { display: none; }
    .nav-text-sm { display: inline; }
    
    .navbar-nav-link {
        font-size: 0.65rem;
        padding: 0.35rem 0.25rem;
    }
    
    .navbar-nav {
        gap: 0.1rem;
    }
}

/* At 610px: Hide IMDB for more space */
@media (max-width: 610px) {
    .nav-imdb {
        display: none;
    }
    
    .navbar-nav-link {
        font-size: 0.6rem;
        padding: 0.3rem 0.2rem;
    }
    
    .navbar-nav {
        gap: 0.1rem;
    }
}

/* At 515px: Further adjustments */
@media (max-width: 515px) {
    .navbar-nav {
        gap: 0.1rem;
    }
    
    .navbar-nav-link {
        font-size: 0.55rem;
        padding: 0.25rem 0.15rem;
    }
}

/* At 470px: Switch to ES text and show "Other" link, hide Exhibits/Novel */
@media (max-width: 470px) {
    .nav-text-sm { display: none; }
    .nav-text-es { display: inline; }
    
    /* Hide the individual Exhibits and Novel items */
    .nav-hide-es { display: none; }
    
    /* Show the "Other" item */
    .nav-show-es { display: flex; }
    
    .navbar-nav-link {
        font-size: 0.5rem;
        padding: 0.2rem 0.1rem;
    }
    
    .navbar-nav {
        gap: 0.055rem;
    }
    
    /* Also hide IMDB at this level for extra space */
    .nav-imdb {
        display: none;
    }
}

/* Enhanced fallback that respects theme colors */
@supports not (background-clip: text) or not (-webkit-background-clip: text) {
    /* Default theme fallback */
    .navbar-title {
        color: #6366f1 !important;
        background: none !important;
        -webkit-text-fill-color: unset !important;
    }
    
    /* Theme-specific fallbacks */
    .navbar-animation-theme .navbar-title { color: #f59e0b !important; }
    .navbar-comics-theme .navbar-title { color: #dc2626 !important; }
    .navbar-tv-theme .navbar-title { color: #0891b2 !important; }
    .navbar-webseries-theme .navbar-title { color: #10b981 !important; }
    .navbar-games-theme .navbar-title { color: #7c3aed !important; }
    .navbar-vertical-theme .navbar-title { color: #8b5cf6 !important; }
    .navbar-contact-theme .navbar-title { color: #14b8a6 !important; }
    .navbar-press-theme .navbar-title { color: #6366f1 !important; }
    .navbar-credits-theme .navbar-title { color: #a16207 !important; }
    .navbar-novels-theme .navbar-title { color: #22c55e !important; }
    .navbar-screenplays-theme .navbar-title { color: #ec4899 !important; }
    .navbar-exhibits-theme .navbar-title { color: #06b6d4 !important; }
}

/* Force theme colors to apply with high specificity */
.navbar-animation-theme .navbar-title,
.navbar-comics-theme .navbar-title,
.navbar-tv-theme .navbar-title,
.navbar-webseries-theme .navbar-title,
.navbar-games-theme .navbar-title,
.navbar-vertical-theme .navbar-title,
.navbar-contact-theme .navbar-title,
.navbar-press-theme .navbar-title,
.navbar-credits-theme .navbar-title,
.navbar-exhibits-theme .navbar-title,
.navbar-novels-theme .navbar-title,
.navbar-screenplays-theme .navbar-title {
    background: linear-gradient(135deg, var(--navbar-primary), var(--navbar-secondary)) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
}

/* Fallback for gradient text with theme colors */
@supports not (background-clip: text) or not (-webkit-background-clip: text) {
    .navbar-animation-theme .navbar-title,
    .navbar-comics-theme .navbar-title,
    .navbar-tv-theme .navbar-title,
    .navbar-webseries-theme .navbar-title,
    .navbar-games-theme .navbar-title,
    .navbar-vertical-theme .navbar-title,
    .navbar-contact-theme .navbar-title,
    .navbar-press-theme .navbar-title,
    .navbar-credits-theme .navbar-title,
    .navbar-exhibits-theme .navbar-title,
    .navbar-novels-theme .navbar-title,
    .navbar-screenplays-theme .navbar-title {
        color: var(--navbar-primary) !important;
        background: none !important;
        -webkit-text-fill-color: unset !important;
    }
}

/* Enhanced active link styling with explicit theme colors */
.navbar-nav-link.active {
    background: linear-gradient(135deg, var(--navbar-primary), var(--navbar-secondary)) !important;
    color: white !important;
    border-color: var(--navbar-primary) !important;
}

/* Explicit theme-based active link colors for mobile compatibility */
.navbar-animation-theme .navbar-nav-link.active {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
    border-color: #f59e0b !important;
    color: white !important;
}

.navbar-comics-theme .navbar-nav-link.active {
    background: linear-gradient(135deg, #dc2626, #b91c1c) !important;
    border-color: #dc2626 !important;
    color: white !important;
}

.navbar-tv-theme .navbar-nav-link.active {
    background: linear-gradient(135deg, #0891b2, #0e7490) !important;
    border-color: #0891b2 !important;
    color: white !important;
}

.navbar-webseries-theme .navbar-nav-link.active {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    border-color: #10b981 !important;
    color: white !important;
}

.navbar-games-theme .navbar-nav-link.active {
    background: linear-gradient(135deg, #7c3aed, #5b21b6) !important;
    border-color: #7c3aed !important;
    color: white !important;
}

.navbar-vertical-theme .navbar-nav-link.active {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed) !important;
    border-color: #8b5cf6 !important;
    color: white !important;
}

.navbar-contact-theme .navbar-nav-link.active {
    background: linear-gradient(135deg, #14b8a6, #0f766e) !important;
    border-color: #14b8a6 !important;
    color: white !important;
}

.navbar-press-theme .navbar-nav-link.active {
    background: linear-gradient(135deg, #6366f1, #4f46e5) !important;
    border-color: #6366f1 !important;
    color: white !important;
}

.navbar-credits-theme .navbar-nav-link.active {
    background: linear-gradient(135deg, #a16207, #92400e) !important;
    border-color: #a16207 !important;
    color: white !important;
}

.navbar-novels-theme .navbar-nav-link.active {
    background: linear-gradient(135deg, #22c55e, #16a34a) !important;
    border-color: #22c55e !important;
    color: white !important;
}

.navbar-screenplays-theme .navbar-nav-link.active {
    background: linear-gradient(135deg, #ec4899, #db2777) !important;
    border-color: #ec4899 !important;
    color: white !important;
}

.navbar-exhibits-theme .navbar-nav-link.active {
    background: linear-gradient(135deg, #06b6d4, #0891b2) !important;
    border-color: #06b6d4 !important;
    color: white !important;
}

/* Responsive placeholder heights - adjusted for new breakpoints */
@media (max-width: 1200px) {
    .navbar-placeholder {
        height: 170px;
    }
}

@media (max-width: 900px) {
    .navbar-placeholder {
        height: 160px;
    }
}

@media (max-width: 700px) {
    .navbar-placeholder {
        height: 150px;
    }
}

@media (max-width: 480px) {
    .navbar-placeholder {
        height: 140px;
    }
}

/* Hide placeholder when navbar loads */
.navbar-loaded .navbar-placeholder {
    display: none;
}

/* Print styles */
@media print {
    .navbar { display: none; }
    .navbar-placeholder { display: none; }
}

/* Loading state styling for better UX */
.navbar-placeholder {
    height: 180px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: navbar-loading 1.5s infinite;
    border-bottom: 1px solid #e5e7eb;
}

@keyframes navbar-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Dark mode loading animation */
@media (prefers-color-scheme: dark) {
    .navbar-placeholder {
        background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
        background-size: 200% 100%;
        border-bottom: 1px solid #4b5563;
    }
}

/* Hide loading animation once navbar loads */
.navbar-loaded .navbar-placeholder {
    display: none;
    animation: none;
}

/* Fallback navbar styling */
.navbar-fallback {
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    padding: 1rem;
    text-align: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.navbar-fallback h1 {
    margin: 0;
    color: #6366f1;
    font-size: 1.5rem;
    font-weight: 700;
}

.navbar-fallback p {
    margin: 0.5rem 0 0;
    color: #6b7280;
    font-size: 1rem;
}

.navbar-fallback a {
    color: #6366f1;
    text-decoration: none;
}

.navbar-fallback a:hover {
    text-decoration: underline;
}