/**
 * ============================================================================
 * STANDALONE NAVBAR STYLES
 * ============================================================================
 *
 * Complete navbar system extracted from ttrening-optimized.css
 * Used by includes/navbar.html
 *
 * Contains:
 * - Required CSS variables
 * - Desktop navbar styles (.navbar, .navbar-container, .navbar-brand, etc.)
 * - Mobile menu styles (.mobile-menu-toggle, .navbar-menu.active)
 * - Mobile drawer styles (.mobile-drawer, .mobile-drawer-overlay)
 *
 * @version 1.0.0
 * ============================================================================
 */

/* ============================================================================
   CSS VARIABLES (Only navbar-related)
   ============================================================================ */
:root {
    /* Navbar-specific variables */
    --navbar-height: 70px;

    /* Colors used by navbar */
    --primary: #10B981;
    --primary-dark: #059669;
    --white: #FFFFFF;
    --text-light: #CBD5E1;

    /* Glassmorphism */
    --glass-white: rgba(255, 255, 255, 0.05);
    --glass-white-light: rgba(255, 255, 255, 0.05);
    --glass-white-strong: rgba(255, 255, 255, 0.15);
    --glass-backdrop: blur(20px);
    --glass-border: rgba(255, 255, 255, 0.2);

    /* Layout */
    --container-max-width: 1200px;
    --container-padding: 1rem;

    /* Spacing */
    --spacing-2: 0.5rem;
    --spacing-3: 0.75rem;
    --spacing-4: 1rem;

    /* Typography */
    --font-size-sm: 0.875rem;
    --font-size-xl: 1.25rem;
    --font-weight-medium: 500;
    --font-weight-bold: 700;

    /* Border radius */
    --radius-lg: 0.5rem;

    /* Transitions */
    --transition-base: all 0.25s ease-in-out;
    --transition-fast: all 0.15s ease-in-out;

    /* Z-index */
    --z-navbar: 1040;

    /* Shadows */
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* ============================================================================
   NAVBAR - DESKTOP & MOBILE
   ============================================================================ */

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--navbar-height);
    background: var(--glass-white);
    backdrop-filter: var(--glass-backdrop);
    border-bottom: 1px solid var(--glass-border);
    z-index: var(--z-navbar);
    transition: var(--transition-base);
}

.navbar.scrolled {
    background: var(--glass-white-strong);
    box-shadow: var(--shadow-lg);
}

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

.navbar-brand {
    display: flex;
    align-items: center;
    gap: var(--spacing-3);
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: var(--white);
    text-decoration: none;
}

.navbar-brand img {
    display: block;
    width: 32px;
    height: 32px;
}

.navbar-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: var(--spacing-2);
}

.navbar-link {
    display: flex;
    align-items: center;
    padding: var(--spacing-2) var(--spacing-4);
    color: var(--text-light);
    text-decoration: none;
    border-radius: var(--radius-lg);
    transition: var(--transition-fast);
    font-weight: var(--font-weight-medium);
    font-size: var(--font-size-sm);
}

.navbar-link:hover,
.navbar-link.active {
    color: var(--white);
    background: var(--glass-white-light);
}

.navbar-link.cta-button {
    background: var(--primary);
    color: var(--white);
    font-weight: var(--font-weight-bold);
}

.navbar-link.cta-button:hover {
    background: var(--primary-dark);
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--white);
    font-size: var(--font-size-xl);
    cursor: pointer;
    padding: var(--spacing-2);
}

/* ============================================================================
   MOBILE DRAWER STYLES
   ============================================================================ */

.mobile-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: calc(var(--z-navbar) + 9);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.mobile-drawer-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-drawer {
    position: fixed;
    top: 0;
    right: -100%;
    width: 85%;
    max-width: 360px;
    height: 100%;
    background: #1F2937;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.5);
    z-index: calc(var(--z-navbar) + 10);
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.mobile-drawer.open {
    right: 0;
}

.mobile-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(16, 185, 129, 0.05);
}

.mobile-drawer-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #FFFFFF;
    margin: 0;
}

.mobile-drawer-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 8px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
    font-size: 1.25rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.mobile-drawer-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.mobile-drawer-close:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

.mobile-drawer-nav {
    padding: 1rem 0;
}

.mobile-drawer-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    color: #CBD5E1;
    text-decoration: none;
    font-size: 0.9375rem;
    transition: var(--transition-fast);
    min-height: 56px;
}

.mobile-drawer-link:hover {
    color: #FFFFFF;
    background: rgba(16, 185, 129, 0.1);
}

.mobile-drawer-link:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: -3px;
}

.mobile-drawer-link.active {
    color: var(--primary);
    background: rgba(16, 185, 129, 0.15);
}

.mobile-drawer-link i {
    width: 24px;
    text-align: center;
    font-size: 1.125rem;
}

.mobile-drawer-cta {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    margin: 0.5rem 1rem;
    border-radius: 8px;
}

.mobile-drawer-cta:hover {
    background: rgba(16, 185, 129, 0.2);
    border-color: var(--primary);
}

.mobile-drawer-sub {
    padding-left: 3.5rem;
    font-size: 0.875rem;
    opacity: 0.9;
}

.mobile-drawer-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0.5rem 1rem;
}

.navbar-link-secondary {
    color: var(--text-light);
    opacity: 0.7;
}

.navbar-link-secondary:hover {
    opacity: 1;
}

/* ============================================================================
   APP BOTTOM NAVIGATION (Mobile Only - for app/* pages)
   ============================================================================ */

.app-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(17, 24, 39, 0.98);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    z-index: 1040;
    padding: 0.5rem 0;
    justify-content: space-around;
    align-items: center;
}

.app-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.5rem;
    min-height: 60px;
    flex: 1;
    color: #CBD5E1;
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.app-nav-item i {
    font-size: 1.25rem;
}

.app-nav-label {
    font-size: 0.75rem;
    font-weight: 500;
}

.app-nav-item:hover,
.app-nav-item.active {
    color: #10B981;
    background: rgba(16, 185, 129, 0.1);
}

.app-nav-item:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

/* ============================================================================
   RESPONSIVE BREAKPOINTS
   ============================================================================ */

/* Desktop styles */
@media (min-width: 769px) {
    .navbar-menu {
        display: flex !important;
        position: static !important;
        background: transparent !important;
        backdrop-filter: none !important;
        border: none !important;
        flex-direction: row !important;
        padding: 0 !important;
        box-shadow: none !important;
    }

    .mobile-menu-toggle {
        display: none !important;
    }
}

/* Mobile styles */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }

    .navbar-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(17, 24, 39, 0.95);
        backdrop-filter: blur(20px);
        border-top: 1px solid rgba(255, 255, 255, 0.3);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        flex-direction: column;
        padding: var(--spacing-4);
        gap: var(--spacing-2);
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    }

    .navbar-menu.active {
        display: flex;
    }

    .navbar-link {
        padding: var(--spacing-4) var(--spacing-4);
        border-radius: var(--radius-lg);
        width: 100%;
        justify-content: flex-start;
        color: rgba(255, 255, 255, 0.9);
        font-weight: var(--font-weight-medium);
        transition: all 0.2s ease;
        border: 1px solid transparent;
    }

    .navbar-link:hover,
    .navbar-link.active {
        background: rgba(16, 185, 129, 0.15);
        border-color: rgba(16, 185, 129, 0.3);
        color: rgba(255, 255, 255, 1);
        transform: translateX(4px);
    }

    .navbar-link.active {
        background: rgba(16, 185, 129, 0.2);
        border-color: var(--primary);
        color: var(--white);
    }

    .mobile-drawer {
        width: 90%;
    }

    /* Show app bottom nav on mobile */
    .app-bottom-nav {
        display: flex;
    }

    /* Hide desktop app navbar on mobile (we only want bottom bar) */
    .app-navbar {
        display: none;
    }

    /* Add padding to app pages to prevent content hiding behind bottom nav */
    body.app-page {
        padding-bottom: 80px;
    }
}

@media (max-width: 480px) {
    .mobile-drawer {
        width: 95%;
    }
}

/* ============================================================================
   NAVBAR DROPDOWN MENUS (Desktop Only)
   ============================================================================ */

.navbar-dropdown {
    position: relative;
}

.navbar-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: var(--spacing-2) var(--spacing-4);
    color: var(--text-light);
    text-decoration: none;
    border-radius: var(--radius-lg);
    transition: var(--transition-fast);
    font-weight: var(--font-weight-medium);
    font-size: var(--font-size-sm);
    background: transparent;
    border: none;
    cursor: pointer;
    white-space: nowrap;
}

.navbar-dropdown-toggle:hover {
    color: var(--white);
    background: var(--glass-white-light);
}

.navbar-dropdown-toggle .fa-chevron-down {
    font-size: 0.75rem;
    transition: transform 0.2s ease;
}

.navbar-dropdown.open .navbar-dropdown-toggle .fa-chevron-down {
    transform: rotate(180deg);
}

.navbar-dropdown-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    min-width: 220px;
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 0.5rem 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1050;
}

.navbar-dropdown.open .navbar-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.navbar-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-light);
    text-decoration: none;
    font-size: var(--font-size-sm);
    transition: var(--transition-fast);
    white-space: nowrap;
}

.navbar-dropdown-item:hover {
    color: var(--white);
    background: var(--glass-white-light);
}

.navbar-dropdown-item i {
    width: 16px;
    text-align: center;
    color: var(--primary);
}

.navbar-dropdown-divider {
    height: 1px;
    margin: 0.5rem 0;
    background: var(--glass-border);
}

/* Hide dropdowns on mobile - use mobile drawer instead */
@media (max-width: 768px) {
    .navbar-dropdown {
        display: none;
    }
}

/* ============================================================================
   ACCESSIBILITY
   ============================================================================ */

/* Focus states */
.navbar-link:focus-visible,
.navbar-dropdown-toggle:focus-visible,
.mobile-menu-toggle:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .mobile-drawer,
    .mobile-drawer-overlay {
        transition: none;
    }
}

/* Print styles */
@media print {
    .navbar,
    .mobile-drawer,
    .mobile-drawer-overlay {
        display: none !important;
    }
}
