/* Enhanced Navigation System CSS for Nerdi Gras */

/* Skip Link for Accessibility */
.skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: #6366f1;
    color: white;
    padding: 0.5rem 1rem;
    text-decoration: none;
    border-radius: 0 0 0.375rem 0;
    z-index: 100;
    transition: all 0.3s ease;
}

.skip-link:focus {
    top: 1rem;
    left: 1rem;
}

/* Mobile Menu Button */
.mobile-menu-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0.5rem;
    border: none;
    background: transparent;
    color: white;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-menu-button:hover {
    background-color: rgba(124, 58, 237, 0.5);
}

.mobile-menu-button:focus {
    outline: 2px solid #fbbf24;
    outline-offset: 2px;
}

.mobile-menu-button svg {
    transition: transform 0.2s ease;
}

.mobile-menu-button[aria-expanded="true"] svg {
    transform: rotate(90deg);
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    background: transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(100%);
}

.mobile-menu-overlay:not(.translate-x-full) {
    transform: translateX(0);
}

.mobile-menu-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay:not(.translate-x-full) .mobile-menu-backdrop {
    opacity: 1;
}

.mobile-menu-panel {
    position: relative;
    width: 20rem;
    max-width: calc(100vw - 2rem);
    height: 100vh;
    background: linear-gradient(to bottom, #581c87, #6b21a8);
    box-shadow: -10px 0 25px rgba(0, 0, 0, 0.3);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
}

.mobile-menu-overlay:not(.translate-x-full) .mobile-menu-panel {
    transform: translateX(0);
}

/* Mobile Menu Header */
.mobile-menu-panel .mobile-menu-close {
    background: transparent;
    border: none;
    color: white;
    padding: 0.5rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.mobile-menu-panel .mobile-menu-close:hover {
    background-color: rgba(124, 58, 237, 0.5);
}

/* Mobile Navigation Items */
.mobile-nav-item {
    position: relative;
    display: block;
    padding: 1rem 1.5rem;
    font-size: 1.125rem;
    color: white;
    text-decoration: none;
    border-bottom: 1px solid rgba(124, 58, 237, 0.3);
    transition: all 0.2s ease;
    background: transparent;
}

.mobile-nav-item:hover {
    background-color: rgba(124, 58, 237, 0.3);
    padding-left: 2rem;
}

.mobile-nav-item:focus {
    outline: 2px solid #fbbf24;
    outline-offset: -2px;
    background-color: rgba(124, 58, 237, 0.3);
}

.mobile-nav-item.active,
.mobile-nav-item.current-page {
    background-color: rgba(124, 58, 237, 0.4);
    border-left: 4px solid #fbbf24;
    font-weight: 600;
}

.mobile-nav-item.active::before,
.mobile-nav-item.current-page::before {
    content: "→";
    position: absolute;
    left: 0.75rem;
    color: #fbbf24;
    font-weight: bold;
}

/* Mobile Auth Section */
.mobile-auth-section {
    background: rgba(88, 28, 135, 0.6);
}

.mobile-auth-section .text-white {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(124, 58, 237, 0.3);
}

/* Breadcrumb Navigation */
#breadcrumb-nav {
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    padding: 0.75rem 0;
}

#breadcrumb-nav nav {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    line-height: 1.25rem;
}

#breadcrumb-nav a {
    color: #7c3aed;
    text-decoration: none;
    transition: color 0.2s ease;
}

#breadcrumb-nav a:hover {
    color: #5b21b6;
    text-decoration: underline;
}

#breadcrumb-nav a:focus {
    outline: 2px solid #7c3aed;
    outline-offset: 2px;
    border-radius: 0.125rem;
}

#breadcrumb-nav span[aria-current="page"] {
    color: #4b5563;
    font-weight: 500;
}

#breadcrumb-nav svg {
    flex-shrink: 0;
    color: #9ca3af;
    margin: 0 0.5rem;
}

/* Desktop Navigation Enhancements */
nav a.active,
nav a.current-page {
    position: relative;
    color: #fbbf24;
    font-weight: 600;
}

nav a.active::after,
nav a.current-page::after {
    content: "";
    position: absolute;
    bottom: -0.5rem;
    left: 0;
    right: 0;
    height: 2px;
    background: #fbbf24;
    border-radius: 1px;
}

/* Enhanced Dropdowns */
nav [role="menu"] {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    border: 1px solid #e5e7eb;
    overflow: hidden;
}

nav [role="menuitem"] {
    transition: all 0.2s ease;
}

nav [role="menuitem"]:hover {
    background-color: #f3f4f6;
    color: #7c3aed;
}

nav [role="menuitem"]:focus {
    background-color: #7c3aed;
    color: white;
    outline: none;
}

/* Loading States */
.nav-loading {
    opacity: 0.6;
    pointer-events: none;
}

.nav-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1rem;
    height: 1rem;
    margin: -0.5rem 0 0 -0.5rem;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Notification Badge */
.notification-badge {
    position: absolute;
    top: -0.25rem;
    right: -0.25rem;
    background: #ef4444;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    min-width: 1.25rem;
    height: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s infinite;
}

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

/* Focus Management */
.focus-trap {
    position: fixed;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

/* Responsive Design */
@media (max-width: 767px) {
    /* Hide desktop navigation items on mobile */
    nav.hidden {
        display: none !important;
    }
    
    /* Ensure mobile menu button is visible */
    .mobile-menu-button {
        display: flex !important;
    }
    
    /* Adjust mobile menu panel size for small screens */
    .mobile-menu-panel {
        width: calc(100vw - 3rem);
        max-width: 20rem;
    }
    
    /* Stack mobile auth buttons */
    .mobile-auth-section .block {
        margin-bottom: 0.5rem;
    }
}

@media (min-width: 768px) {
    /* Hide mobile elements on desktop */
    .mobile-menu-button,
    .mobile-menu-overlay {
        display: none !important;
    }
    
    /* Show desktop navigation */
    nav:not(.mobile-nav) {
        display: flex !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .mobile-menu-panel {
        background: #000;
        border: 2px solid #fff;
    }
    
    .mobile-nav-item {
        border-bottom: 2px solid #fff;
    }
    
    .mobile-nav-item:hover,
    .mobile-nav-item:focus {
        background: #fff;
        color: #000;
    }
    
    #breadcrumb-nav {
        background: #fff;
        border-bottom: 2px solid #000;
    }
    
    #breadcrumb-nav a {
        color: #00f;
        font-weight: bold;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .mobile-menu-overlay,
    .mobile-menu-panel,
    .mobile-menu-backdrop,
    .mobile-nav-item,
    .notification-badge {
        transition: none;
        animation: none;
    }
    
    .mobile-menu-button svg {
        transition: none;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    #breadcrumb-nav {
        background: #1f2937;
        border-bottom-color: #374151;
    }
    
    #breadcrumb-nav span[aria-current="page"] {
        color: #d1d5db;
    }
    
    nav [role="menu"] {
        background: #1f2937;
        border-color: #374151;
    }
    
    nav [role="menuitem"]:hover {
        background-color: #374151;
    }
    
    nav [role="menuitem"]:focus {
        background-color: #7c3aed;
    }
}

/* Print Styles */
@media print {
    .mobile-menu-button,
    .mobile-menu-overlay,
    .skip-link,
    .notification-badge {
        display: none !important;
    }
    
    nav a::after {
        display: none;
    }
    
    #breadcrumb-nav {
        background: transparent;
        border: none;
        font-size: 0.75rem;
    }
}