/**
 * 🎨 UNIFIED NAVIGATION STYLES
 * Responsive header navigation for all Ask Bob pages
 * Supports light/dark themes, mobile-first design, and accessibility
 */

/* ===================================================
   BASE NAVIGATION STYLES
   =================================================== */

.unified-nav-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1002;
    height: 70px;
    background: var(--nav-background);
    border-bottom: 1px solid var(--nav-border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.unified-nav {
    background: var(--nav-background);
    padding: 0;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    height: 60px;
}

/* ===================================================
   THEME VARIABLES
   =================================================== */

.unified-nav.light {
    --nav-background: #ffffff;
    --nav-border: #e5e7eb;
    --nav-text: #374151;
    --nav-text-hover: #111827;
    --nav-text-active: #3b82f6;
    --nav-highlight: #3b82f6;
    --nav-highlight-hover: #2563eb;
    --dropdown-background: #ffffff;
    --dropdown-border: #e5e7eb;
    --dropdown-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    --mobile-overlay: rgba(0, 0, 0, 0.5);
}

.unified-nav.dark {
    /* Ultra-dark navigation theme */
    --nav-background: rgba(0, 0, 0, 0.9);
    --nav-border: rgba(255, 255, 255, 0.08);
    --nav-text: #e0e0e8;
    --nav-text-hover: #ffffff;
    --nav-text-active: #60a5fa;
    --nav-highlight: #667eea;
    --nav-highlight-hover: #7c8ff0;
    --dropdown-background: rgba(5, 5, 10, 0.98);
    --dropdown-border: rgba(255, 255, 255, 0.1);
    --dropdown-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    --mobile-overlay: rgba(0, 0, 0, 0.9);
}

/* Enhanced Dashboard specific dark theme */
.unified-nav[data-user-type="admin"].dark {
    --nav-background: linear-gradient(135deg, #0c1426 0%, #1a2332 100%);
    --nav-border: #2563eb;
    --nav-highlight: #00d4ff;
    --nav-highlight-hover: #0ea5e9;
}

/* ===================================================
   BRANDING
   =================================================== */

.nav-brand {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.brand-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--nav-text);
    font-weight: 700;
    font-size: 18px;
    transition: all 0.2s ease;
}

.brand-link:hover {
    color: var(--nav-text-hover);
    transform: scale(1.02);
}

.brand-icon {
    width: 28px;
    height: 28px;
    margin-right: 8px;
    display: inline-block;
    object-fit: contain;
}

.brand-text {
    display: none;
}

/* ===================================================
   NAVIGATION MENU
   =================================================== */

.nav-menu-wrapper {
    display: flex;
    align-items: center;
    flex: 1;
    justify-content: center;
}

.nav-menu {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0.5rem;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    color: var(--nav-text);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-weight: 500;
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--nav-text-hover);
    background: rgba(59, 130, 246, 0.1);
}

.nav-link.highlight {
    background: var(--nav-highlight);
    color: white;
    font-weight: 600;
}

.nav-link.highlight:hover {
    background: var(--nav-highlight-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.nav-item.active .nav-link {
    color: var(--nav-text-active);
    background: rgba(59, 130, 246, 0.1);
    font-weight: 600;
}

.nav-icon {
    font-size: 16px;
    margin-right: 6px;
}

.nav-text {
    display: none;
}

.dropdown-arrow {
    margin-left: 4px;
    font-size: 10px;
    transition: transform 0.2s ease;
}

.dropdown-toggle[aria-expanded="true"] .dropdown-arrow {
    transform: rotate(180deg);
}

/* ===================================================
   DROPDOWN MENUS
   =================================================== */

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--dropdown-background);
    border: 1px solid var(--dropdown-border);
    border-radius: 8px;
    box-shadow: var(--dropdown-shadow);
    list-style: none;
    margin: 0;
    padding: 8px 0;
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1001;
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.dropdown-item {
    margin: 0;
}

.dropdown-link {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    color: var(--nav-text);
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    gap: 8px;
}

.dropdown-link:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--nav-text-hover);
}

.dropdown-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.dropdown-text .nav-text {
    font-weight: 500;
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-badge {
    font-size: 10px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    animation: pulse 2s infinite;
}

.nav-description {
    font-size: 11px;
    color: var(--nav-text);
    opacity: 0.7;
    line-height: 1.2;
    font-weight: 400;
    margin-top: 1px;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ===================================================
   USER INFO
   =================================================== */

.nav-user {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

/* Smart login slot: Login link when anonymous */
.nav-auth-login:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.user-dropdown {
    position: relative;
}

.user-button {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    background: none;
    border: 1px solid var(--nav-border);
    border-radius: 6px;
    color: var(--nav-text);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.user-button:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--nav-highlight);
    color: var(--nav-text-hover);
}

.user-icon {
    font-size: 16px;
    margin-right: 6px;
}

.user-name {
    font-weight: 500;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu {
    right: 0;
    left: auto;
    transform: translateX(0);
}

.user-menu.show {
    transform: translateX(0);
}

/* ===================================================
   MOBILE MENU
   =================================================== */

.mobile-menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.mobile-menu-toggle:hover {
    background: rgba(59, 130, 246, 0.1);
}

.hamburger-line {
    width: 20px;
    height: 2px;
    background: var(--nav-text);
    margin: 2px 0;
    transition: all 0.3s ease;
    border-radius: 1px;
}

.mobile-menu-toggle.open .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.open .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.open .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

.mobile-nav-drawer {
    position: fixed;
    top: 60px;
    right: -100%;
    width: 280px;
    height: calc(100vh - 60px);
    background: var(--dropdown-background);
    border-left: 1px solid var(--dropdown-border);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    overflow-y: auto;
    z-index: 1004; /* Above marketing header dropdowns */
}

.mobile-nav-drawer.open {
    right: 0;
}

.mobile-nav-content {
    padding: 20px;
}

.mobile-menu .nav-item {
    margin-bottom: 8px;
}

.mobile-menu .nav-link {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 16px;
}

.mobile-dropdown-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--nav-text);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.mobile-dropdown-header:hover {
    background: rgba(59, 130, 246, 0.1);
}

.mobile-dropdown-header.open {
    color: var(--nav-text-active);
}

.mobile-dropdown-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-dropdown-content.open {
    max-height: 300px;
}

.mobile-dropdown-content .dropdown-link {
    padding: 10px 16px 10px 40px;
    font-size: 14px;
    gap: 8px;
}

.mobile-dropdown-content .nav-description {
    font-size: 10px;
}

.mobile-user-info {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--nav-border);
}

.mobile-user-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 8px;
    margin-bottom: 12px;
}

.mobile-user-header .user-name {
    font-weight: 600;
    margin-left: 8px;
    flex: 1;
}

.mobile-user-header .user-type {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--nav-text-active);
    font-weight: 600;
}

.mobile-user-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mobile-user-link {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    color: var(--nav-text);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
}

.mobile-user-link:hover {
    background: rgba(59, 130, 246, 0.1);
}

/* ===================================================
   RESPONSIVE BREAKPOINTS
   =================================================== */

/* Mobile First - Default styles above are for mobile */

/* Tablet (768px and up) */
@media (min-width: 768px) {
    .nav-container {
        padding: 0 2rem;
        height: 64px;
    }
    
    .brand-text {
        display: inline;
    }
    
    .nav-text {
        display: inline;
    }
    
    .nav-menu {
        gap: 1rem;
    }
    
    .mobile-menu-toggle {
        display: none;
    }
    
    .desktop-menu {
        display: flex;
    }
    
    .mobile-nav-drawer {
        display: none;
    }
}

/* Desktop (1024px and up) */
@media (min-width: 1024px) {
    .nav-container {
        height: 68px;
    }
    
    .nav-menu {
        gap: 1.5rem;
    }
    
    .nav-link {
        padding: 10px 20px;
        font-size: 15px;
    }
    
    .brand-link {
        font-size: 20px;
    }
}

/* Large Desktop (1200px and up) */
@media (min-width: 1200px) {
    .nav-container {
        max-width: 1400px;
    }
    
    .nav-menu {
        gap: 2rem;
    }
}

/* ===================================================
   ACCESSIBILITY
   =================================================== */

/* Focus indicators */
.nav-link:focus,
.dropdown-link:focus,
.user-button:focus,
.mobile-menu-toggle:focus {
    outline: 2px solid var(--nav-highlight);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .unified-nav {
        --nav-border: currentColor;
    }
    
    .nav-link,
    .dropdown-link {
        border: 1px solid transparent;
    }
    
    .nav-link:hover,
    .dropdown-link:hover {
        border-color: currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .nav-link,
    .dropdown-menu,
    .mobile-nav-drawer,
    .hamburger-line,
    .dropdown-arrow {
        transition: none;
    }
}

/* ===================================================
   MOBILE-SPECIFIC OVERRIDES
   =================================================== */

@media (max-width: 767px) {
    .desktop-menu {
        display: none;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .nav-menu-wrapper {
        justify-content: flex-end;
    }
    
    .nav-user .user-name {
        display: none;
    }
    
    .user-button {
        padding: 6px;
        border: none;
    }
    
    /* Prevent scroll when mobile menu is open */
    body.mobile-nav-open {
        overflow: hidden;
    }
    
    /* Mobile overlay */
    body.mobile-nav-open::before {
        content: '';
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--mobile-overlay);
        z-index: 998;
    }
}

/* ===================================================
   SPECIAL PAGE INTEGRATIONS
   =================================================== */

/* Enhanced Dashboard specific styles */
.unified-nav[data-user-type="admin"] {
    background: linear-gradient(135deg, #0c1426 0%, #1a2332 100%);
    border-bottom: 1px solid #2563eb;
}

.unified-nav[data-user-type="admin"] .nav-link.highlight {
    background: linear-gradient(135deg, #00d4ff 0%, #0ea5e9 100%);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
}

/* UnityXpressions specific styles */
.unified-nav[data-user-type="unityxpressions"] .nav-link.highlight {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

/* Print styles */
@media print {
    .unified-nav-container,
    .mobile-nav-drawer {
        display: none;
    }
}

/* ===================================================
   UNIFIED FOOTER STYLES
   =================================================== */

.unified-footer {
    background: var(--bg-secondary, #121a2a);
    border-top: 1px solid var(--border-default, rgba(255, 255, 255, 0.1));
    padding: 60px 0 30px;
    color: var(--text-primary, #f3f4f6);
}

.unified-footer .footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.unified-footer .footer-grid {
    display: grid;
    grid-template-columns: 2fr repeat(4, 1fr);
    gap: 40px;
    margin-bottom: 40px;
}

.unified-footer .footer-brand {
    padding-right: 40px;
}

.unified-footer .footer-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-primary, #ffffff);
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 16px;
}

.unified-footer .footer-logo .logo-icon {
    width: 30px;
    height: 30px;
    display: inline-block;
    object-fit: contain;
}

.unified-footer .footer-tagline {
    color: var(--text-muted, rgba(255, 255, 255, 0.6));
    font-size: 14px;
    line-height: 1.7;
    margin: 0;
}

.unified-footer .footer-column h4 {
    color: var(--text-primary, #ffffff);
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 20px 0;
}

.unified-footer .footer-column ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.unified-footer .footer-column li {
    margin-bottom: 12px;
}

.unified-footer .footer-column a {
    color: var(--text-muted, rgba(255, 255, 255, 0.7));
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s ease;
}

.unified-footer .footer-column a:hover {
    color: var(--brand-primary, #667eea);
}

.unified-footer .footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 30px;
    border-top: 1px solid var(--border-default, rgba(255, 255, 255, 0.1));
    font-size: 13px;
    color: var(--text-muted, rgba(255, 255, 255, 0.5));
}

.unified-footer .footer-bottom-links {
    display: flex;
    gap: 20px;
}

.unified-footer .footer-bottom-links a {
    color: var(--text-muted, rgba(255, 255, 255, 0.5));
    text-decoration: none;
    transition: color 0.2s ease;
}

.unified-footer .footer-bottom-links a:hover {
    color: var(--brand-primary, #667eea);
}

/* ===================================================
   ASK BOB BRAND ICON (shared B logo classes)
   =================================================== */

.askbob-icon {
    display: inline-block;
    object-fit: contain;
    vertical-align: -0.2em;
}

.askbob-icon--xs { width: 16px; height: 16px; }
.askbob-icon--sm { width: 1em; height: 1em; }
.askbob-icon--md { width: 1.2em; height: 1.2em; }
.askbob-icon--lg { width: 24px; height: 24px; }
.askbob-icon--xl { width: 32px; height: 32px; }
.askbob-icon--2xl { width: 48px; height: 48px; }

.askbob-icon + * {
    margin-left: 0.25em;
}

/* Footer Responsive */
@media (max-width: 900px) {
    .unified-footer .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .unified-footer .footer-brand {
        grid-column: 1 / -1;
        padding-right: 0;
    }
}

@media (max-width: 600px) {
    .unified-footer .footer-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .unified-footer .footer-bottom {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
}
