/* Auto-Hide Navigation System */
/* Statusleiste für große Bildschirme */
.status-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 99999;
    display: none; /* Standardmäßig ausgeblendet */
    align-items: center;
    justify-content: center;
    padding: 8px 20px;
    font-size: 0.9rem;
    color: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.status-bar.visible {
    display: flex;
}

.status-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.status-legal {
    justify-content: center;
    width: 100%;
}

.status-link {
    color: #42a5f5;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
    font-size: 0.85rem;
    white-space: nowrap;
}

.status-link:hover {
    color: #ff9800;
    text-decoration: none;
}

.status-bar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.status-bar-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.status-bar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Statusleiste nur bei ausreichender Bildschirmhöhe anzeigen */
@media (min-height: 760px) {
    .status-bar {
        display: flex;
    }
    
    /* Navigation nach unten verschieben wenn Statusleiste aktiv */
    .navbar {
        top: 40px !important;
    }
    
    .nav-trigger {
        top: 40px !important;
        height: 50px;
    }
}

/* Trigger Zone für Navigation */
.nav-trigger {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    z-index: 99998;
    background: transparent;
    pointer-events: auto;
    /* Verhindere visuelle Artefakte */
    border: none;
    box-shadow: none;
    outline: none;
}

/* Erweiterte Trigger-Zone für Touch-Geräte im Portrait-Modus */
@media (orientation: portrait) and (pointer: coarse) {
    .nav-trigger {
        height: 80px; /* Größere Touch-Zone im Portrait-Modus */
    }
}

/* Mobile-spezifische Trigger-Anpassungen */
@media (max-width: 768px) {
    .nav-trigger {
        height: 60px; /* Reduzierte Höhe für Mobile */
        z-index: 99997; /* Niedriger als navbar */
        /* Explizit transparent halten */
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
    }
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding: 10px 0; /* unified, slimmer navbar height across pages */
    z-index: 99999; /* Sehr hoher z-index um über allen Popups und Modals zu liegen */
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    
    /* Touch-optimierte Hardware-Beschleunigung */
    will-change: transform, opacity;
    -webkit-transform: translateY(0);
    -webkit-transition: -webkit-transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
    
    /* Verhindere doppelte Schatten auf mobilen Geräten */
    -webkit-box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    
    /* Desktop: Navigation immer sichtbar */
    transform: translateY(0);
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
    opacity: 1;
}

/* Enforce border-box sizing inside navbar to keep button height identical across pages */
.navbar, .navbar * {
    box-sizing: border-box;
}

/* Desktop: Navigation ist IMMER statisch sichtbar */
@media (min-width: 769px) {
    .navbar,
    .navbar.hidden,
    .navbar.visible,
    body .navbar,
    html body .navbar,
    html body .navbar.hidden,
    html body .navbar.visible {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        transform: translateY(0) !important;
        -webkit-transform: translateY(0) !important;
        opacity: 1 !important;
        display: block !important;
        visibility: visible !important;
        min-height: 56px; /* unified navbar height on desktop */
        pointer-events: auto !important;
        /* Überschreibe alle möglichen Auto-Hide Klassen und Zustände */
    }
    
    /* Verstecke Trigger-Zone komplett auf Desktop */
    .nav-trigger {
        display: none !important;
        pointer-events: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
        height: 0 !important;
    }
    
    .nav-container {
        min-height: 56px; /* vertically center content within navbar */
        align-items: center;
    }
}

/* Mobile-spezifische Navbar-Anpassungen - nur für mobile Geräte */
@media (max-width: 768px) {
    .navbar {
        /* Reduzierte Schatten für Mobile */
        box-shadow: 0 1px 10px rgba(0, 0, 0, 0.08);
        -webkit-box-shadow: 0 1px 10px rgba(0, 0, 0, 0.08);
        border-bottom: 1px solid rgba(0, 0, 0, 0.08);
        
        /* Mobile: Auto-Hide Verhalten aktivieren für alle Seiten inklusive Index */
        transform: translateY(-100%) !important;
        -webkit-transform: translateY(-100%) !important;
        opacity: 0 !important;
    }
}

/* Schnellere Animationen für Touch-Geräte */
@media (pointer: coarse) {
    .navbar {
        transition: transform 0.25s ease-out, opacity 0.25s ease-out;
        -webkit-transition: -webkit-transform 0.25s ease-out, opacity 0.25s ease-out;
    }
}

/* Navigation ist versteckt (Auto-Hide) */
.navbar.hidden {
    transform: translateY(-100%) !important;
    -webkit-transform: translateY(-100%) !important;
    opacity: 0 !important;
}

/* Navigation ist sichtbar (explizit) */
.navbar.visible {
    transform: translateY(0) !important;
    -webkit-transform: translateY(0) !important;
    opacity: 1 !important;
}

/* Container */
.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
}

/* Brand */
.nav-brand {
    font-size: 1.6rem;
    font-weight: 700;
    color: #1976d2;
    text-decoration: none;
    transition: all 0.3s ease;
    letter-spacing: -0.5px;
    line-height: 1; /* prevent brand from inflating navbar height */
}

.nav-brand:hover {
    color: #42a5f5;
    transform: scale(1.05);
}

/* Navigation Menu */
.nav-menu {
    display: flex;
    list-style: none;
    gap: 8px;
    margin: 0;
    padding: 0;
    align-items: center;
}

.nav-item {
    position: relative;
}

/* Navigation Links */
.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #333;
    text-decoration: none;
    font-weight: 500;
    padding: 10px 14px; /* reduced vertical padding for slimmer buttons */
    border-radius: 12px !important; /* Protect against CSS variable overrides */
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    background: transparent;
    border: 1px solid #ddd; /* Dünne graue Umrandung */
    min-height: 40px; /* Slightly slimmer than before, matches Index */
    line-height: 1.2;
}

/* Verhindere doppelte Icons in Navigation */
.nav-link::before,
.nav-link::after {
    display: none !important;
    content: none !important;
}

/* Verhindere externe Icon-Klassen in Navigation */
.nav-link .icon,
.nav-link [class*="icon"],
.nav-link [class*="fa-"] {
    display: none !important;
}

.nav-link:hover {
    background: linear-gradient(135deg, rgba(25, 118, 210, 0.25), rgba(66, 165, 245, 0.3));
    color: #1976d2;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(25, 118, 210, 0.3);
}

/* Active State */
.nav-link.active {
    background: linear-gradient(135deg, #1976d2, #42a5f5);
    color: white;
    box-shadow: 0 6px 20px rgba(25, 118, 210, 0.4);
    transform: translateY(-1px);
}

.nav-link.active:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(25, 118, 210, 0.5);
}

/* Icons und Text */
.nav-icon {
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
}

.nav-text {
    font-size: 0.95rem;
    white-space: nowrap;
}

/* User Profile Image in Navigation */
.user-profile-image {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(135deg, #1976d2, #42a5f5);
    color: white;
    font-size: 0.9rem;
}

.user-profile-image img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(25, 118, 210, 0.3);
    transition: all 0.3s ease;
}

/* Mobile optimizations for profile image */
@media (max-width: 768px) {
    .user-profile-image {
        min-width: 28px;
        height: 28px;
    }
    
    .user-profile-image img {
        width: 28px;
        height: 28px;
    }
}

/* User Display */
.nav-user {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #333;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(25, 118, 210, 0.1), rgba(66, 165, 245, 0.15));
    border-radius: 12px !important; /* Protect against CSS variable overrides */
    font-weight: 500;
    transition: all 0.3s ease;
    border: 2px solid rgba(25, 118, 210, 0.2);
    cursor: pointer;
    text-decoration: none;
}

.nav-user:hover {
    background: linear-gradient(135deg, rgba(25, 118, 210, 0.15), rgba(66, 165, 245, 0.2));
    border-color: rgba(25, 118, 210, 0.3);
    transform: translateY(-1px);
    text-decoration: none;
    color: #333;
}

.user-icon {
    font-size: 1.2em;
    background: linear-gradient(135deg, #1976d2, #42a5f5);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.user-name {
    font-weight: 600;
    color: #1976d2;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Einheitliches Styling speziell für den Profil-Button */
#nav-user-display.nav-link {
    background: white; /* konsistent mit anderen Links */
    border: 1px solid #ddd;
    padding: 8px 14px; /* reduced to match slimmer button height */
    border-radius: 12px !important;
    min-height: 40px; /* gleiche Höhe wie andere */
}

#nav-user-display.nav-link:hover {
    background: linear-gradient(135deg, rgba(25, 118, 210, 0.25), rgba(66, 165, 245, 0.3));
    color: #1976d2;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(25, 118, 210, 0.3);
}

#nav-user-display.nav-link.active {
    /* Keep profile button visually consistent with others on Profile page */
    background: #fff;
    color: #1976d2; /* subtle highlight via text only */
    box-shadow: none;
    transform: none;
    border: 1px solid #ddd;
}

/* Sicherstellen, dass Profilbild/Text im Profil-Button sauber ausgerichtet sind */
#nav-user-display .user-profile-image {
    min-width: 22px;
    height: 22px; /* 22px image + 8px top + 8px bottom = 38px (+ borders) ≤ 40px total */
}

#nav-user-display .user-profile-image img {
    width: 22px;
    height: 22px;
}

#nav-user-display .user-name {
    color: #1976d2;
}

/* Mobile Toggle */
.nav-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 12px; /* Größerer Touch-Bereich */
    border-radius: 8px;
    transition: all 0.3s ease;
    gap: 4px;
    min-width: 44px; /* Touch-optimiert */
    min-height: 44px; /* Touch-optimiert */
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 99990; /* Höher als navbar aber niedriger als nav-trigger */
    /* Touch-Optimierungen */
    -webkit-tap-highlight-color: rgba(25, 118, 210, 0.3);
    touch-action: manipulation;
}

.hamburger {
    width: 20px;
    height: 3px; /* Etwas dicker für bessere Sichtbarkeit */
    background: #1976d2;
    transition: all 0.3s ease;
    border-radius: 2px;
    display: block;
}

.nav-toggle:hover {
    background: rgba(25, 118, 210, 0.1);
}

.nav-toggle:active {
    background: rgba(25, 118, 210, 0.2);
    transform: scale(0.95);
}

.nav-toggle:hover .hamburger {
    background: #42a5f5;
}

/* Mobile Navigation */
@media (max-width: 768px) {
    .navbar {
        z-index: 99999; /* Sicherstellen dass navbar über allem liegt */
        /* Reduzierte Schatten für Mobile */
        box-shadow: 0 1px 10px rgba(0, 0, 0, 0.08);
        -webkit-box-shadow: 0 1px 10px rgba(0, 0, 0, 0.08);
        border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    }
    
    .nav-container {
        padding: 0 20px;
    }
    
    .nav-brand {
        font-size: 1.4rem;
    }
    
    .nav-toggle {
        display: flex;
    }
    
    .nav-menu {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(25px);
        -webkit-backdrop-filter: blur(25px);
        border-top: none; /* Keine doppelte Linie */
        flex-direction: column;
        padding: 0;
        gap: 0;
        max-height: 0;
        overflow: hidden;
        transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
        z-index: 99990; /* Höher als navbar */
        /* Verhindere doppelte Schatten */
        -webkit-box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    }
    
    .nav-menu.active {
        max-height: 500px;
        padding: 20px 0;
    }
    
    .nav-item {
        margin: 0;
        width: 100%;
        text-align: center;
    }
    
    .nav-link {
        padding: 18px 30px;
        margin: 0;
        border-radius: 0;
        justify-content: center;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
        font-size: 1.1rem;
        /* Touch-optimierte Eigenschaften */
        -webkit-tap-highlight-color: rgba(25, 118, 210, 0.3);
        touch-action: manipulation;
    }
    
    .nav-link:hover {
        background: rgba(25, 118, 210, 0.1);
        transform: none;
        box-shadow: none;
    }
    
    .nav-icon {
        font-size: 1.4rem;
    }
    
    .nav-text {
        font-size: 1rem;
    }
    
    /* Hamburger Animation - Touch-optimiert */
    .nav-toggle.active .hamburger:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
        background: #1976d2;
    }

    .nav-toggle.active .hamburger:nth-child(2) {
        opacity: 0;
        transform: scale(0);
    }

    .nav-toggle.active .hamburger:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -6px);
        background: #1976d2;
    }
}

/* Portrait Touch-Geräte - Spezielle Optimierungen */
@media (orientation: portrait) and (pointer: coarse) {
    .navbar {
        /* Verstärkte Sichtbarkeit für Touch-Auslösung */
        box-shadow: 0 4px 25px rgba(0, 0, 0, 0.15);
    }
    
    .nav-trigger {
        /* Größere Touch-Zone für Portrait-Modus */
        height: 80px;
    }
    
    .nav-link {
        /* Größere Touch-Targets */
        min-height: 48px;
        padding: 16px 20px;
        -webkit-tap-highlight-color: rgba(25, 118, 210, 0.2);
        touch-action: manipulation;
    }
    
    .nav-toggle {
        /* Größerer Toggle-Button für Touch */
        min-width: 44px;
        min-height: 44px;
        -webkit-tap-highlight-color: rgba(25, 118, 210, 0.2);
    }
}

/* Landscape Touch-Geräte */
@media (orientation: landscape) and (pointer: coarse) {
    .nav-trigger {
        height: 60px; /* Reduzierte Höhe im Landscape */
    }
}

/* Tablet angepasst */
@media (min-width: 769px) and (max-width: 1024px) {
    .nav-container {
        padding: 0 25px;
    }
    
    .nav-menu {
        gap: 6px;
    }
    
    .nav-link {
        padding: 10px 14px;
    }
    
    .nav-text {
        font-size: 0.9rem;
    }
    
    /* Dropdown Mobile Adjustments */
    .dropdown-menu {
        position: static;
        transform: none;
        box-shadow: none;
        border: 1px solid rgba(0, 0, 0, 0.15);
        border-radius: 8px;
        margin-top: 5px;
        background: white !important;
    }
    
    .dropdown.active .dropdown-menu {
        display: block;
    }
}

/* ==========================================
   DROPDOWN NAVIGATION STYLES
   ========================================== */

/* Dropdown Container */
.dropdown {
    position: relative;
}

/* Dropdown Toggle */
.dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    position: relative;
}

.dropdown-arrow {
    font-size: 0.8em;
    transition: transform 0.3s ease;
    color: rgba(0, 0, 0, 0.6);
}

.dropdown.active .dropdown-arrow {
    transform: rotate(180deg);
}

/* Dropdown Menu */
.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: white !important;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 12px !important; /* Protect against CSS variable overrides */
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    padding: 8px 0;
    min-width: 200px;
    z-index: 99985;
    
    /* Initial versteckt */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

/* Stärkere Regel für alle Dropdown-Menüs - verhindert Überschreibung */
.navbar .dropdown-menu,
.nav-menu .dropdown-menu,
.dropdown .dropdown-menu {
    background: white !important;
    backdrop-filter: none !important;
}

/* Dropdown Menu aktiv */
.dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Dropdown Links */
.dropdown-menu li {
    list-style: none;
    margin: 0;
}

.dropdown-link {
    display: block;
    padding: 12px 20px;
    color: #333;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    border-radius: 8px;
    margin: 2px 8px;
    background: white !important; /* Sicherstellen dass Dropdown-Links weißen Hintergrund haben */
}

.dropdown-link:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white;
    transform: translateX(4px);
}

/* Dropdown Link aktiv */
.dropdown-link.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white;
}

/* Dropdown Hover Effect für Parent */
.dropdown:hover .dropdown-toggle {
    color: #667eea;
}

/* Animation für Dropdown Arrow */
.dropdown-toggle:hover .dropdown-arrow {
    color: #667eea;
}

/* PWA Icon in Navigation */
.pwa-icon-item {
    padding: 0 !important;
    margin: 0 !important;
}

/* Verstecke PWA-Icon wenn App im Standalone-Modus läuft */
@media (display-mode: standalone) {
    .pwa-icon-item {
        display: none !important;
    }
}

.pwa-icon-img {
    width: 32px !important;
    height: 32px !important;
    border-radius: 6px;
    transition: all 0.3s ease;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    display: block !important;
    object-fit: cover;
}

.pwa-icon-item .nav-link {
    padding: 6px 8px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.pwa-icon-item .nav-link:hover .pwa-icon-img {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

/* Mobile Anpassungen */
@media (max-width: 768px) {
    .pwa-icon-img {
        width: 28px !important;
        height: 28px !important;
    }
}
