/* ================================================
   NAVIGATION & OFF-CANVAS MENU
   Version: 2.0 (Refactored & Optimized)
   Mobile-First Approach
   ================================================ */

/* ================================================
   1. BODY OVERFLOW CONTROL
   ================================================ */

body {
    overflow-x: hidden;
}

/* Verhindert Scrollen wenn Menu offen */
body.menu-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* ================================================
   2. MOBILE MENU BURGER BUTTON
   ================================================ */

.mobile-menu-burger {
    background: var(--color-primary);
    padding: 14px;
    width: 60px;
    height: 60px;
    right: 0;
    top: 0;
    z-index: 9999;
    cursor: pointer;
    transition: var(--transition-normal);
    font-size: 12px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
    position: fixed;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0;
}

.mobile-menu-burger:hover {
    background: #b93a26; /* Dunkleres Rot */
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
}

.mobile-menu-burger:active {
    transform: scale(0.95);
}

/* Burger Icon (falls Font Awesome o.ä. verwendet wird) */
.mobile-menu-burger i {
    color: var(--color-white);
    font-size: 24px;
    transition: var(--transition-normal);
}

/* Aktiver State - Rotation */
.mobile-menu-active {
    transform: rotate(90deg);
}

.mobile-menu-active:hover {
    transform: rotate(90deg) scale(1.05);
}

/* ================================================
   3. OFF-CANVAS MENU CONTAINER
   ================================================ */

.off-canvas {
    width: 286px;
    left: -286px;
    color: var(--color-white);
    transition: transform 0.4s ease, box-shadow 0.4s ease;
    overflow-x: hidden;
    overflow-y: auto;
    position: fixed;
    top: 0;
    bottom: 0;
    background: var(--color-primary);
    border-right: 6px solid rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
    z-index: 999;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling iOS */
}

/* Active State */
.off-canvas.active-canvas {
    transform: translate3d(286px, 0, 0);
    box-shadow: 3px 0 20px rgba(0, 0, 0, 0.3);
}

/* ================================================
   4. MOBILE LOGO
   ================================================ */

.mobil-logo {
    position: relative;
    margin-bottom: 20px;
    text-align: center;
    padding: 25px 20px 15px 20px;
    background: rgba(0, 0, 0, 0.1);
    border-bottom: 2px solid rgba(0, 0, 0, 0.1);
}

.mobil-logo a {
    color: var(--color-white);
    font-size: 2.5rem;
    margin-bottom: 10px;
    display: block;
    text-decoration: none;
    transition: var(--transition-normal);
}

.mobil-logo a:hover {
    opacity: 0.8;
}

.mobil-logo img {
    width: 90%;
    max-width: 240px;
    margin: 0 auto;
    display: block;
    height: auto;
}

/* ================================================
   5. OFF-CANVAS HEADLINES
   ================================================ */

.off-canvas h2 {
    font-size: 30px;
    padding: 20px 20px 0 20px;
    text-align: center;
    position: relative;
    color: var(--color-white);
    margin: 0;
}

.off-canvas h2 span {
    position: absolute;
    right: 20px;
    font-size: 20px;
    top: 50%;
    transform: translateY(-50%);
}

/* ================================================
   6. OFF-CANVAS NAVIGATION
   ================================================ */

.off-canvas ul {
    margin: 0 !important;
    padding: 0;
    list-style: none;
}

.off-canvas li {
    margin: 0;
    margin-top: 10px !important;
    text-align: left;
    list-style: none;
}

.off-canvas ul a,
.off-canvas .headline {
    display: block;
    padding: 8px 16px 8px 40px;
    color: var(--color-white);
    letter-spacing: 1px;
    text-decoration: none;
    font-size: 1.8rem;
    box-sizing: border-box;
    cursor: pointer;
    transition: var(--transition-normal);
    position: relative;
}

/* Hover & Active States */
.off-canvas ul a:hover,
.off-canvas ul .current-menu-item a,
.off-canvas ul .current_page_parent a,
.off-canvas ul .current-page-ancestor a {
    background-color: rgba(0, 0, 0, 0.1);
    color: var(--color-white) !important;
    padding-left: 45px;
}

/* Active Indicator */
.off-canvas ul .current-menu-item a::before {
    content: "» ";
    position: absolute;
    left: 20px;
    font-weight: bold;
}

/* Touch-friendly spacing */
.off-canvas ul a {
    min-height: 44px; /* Apple touch target size */
    display: flex;
    align-items: center;
}

/* ================================================
   7. SUBMENU (DROPDOWN)
   ================================================ */

.sub-menu {
    display: none;
    position: absolute;
    width: 280px;
    background: #ffca16;
    margin: 0;
    left: 0;
    top: 36px;
    padding: 10px 0;
    list-style: none;
    text-align: left;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border-radius: 0 0 4px 4px;
}

/* Show on hover (Desktop) */
@media (min-width: 741px) {
    nav li:hover > .sub-menu {
        display: block;
    }
}

nav .sub-menu li {
    float: none;
    display: block;
    font-size: 85%;
    padding: 0;
    margin: 0 !important;
}

nav .sub-menu li a {
    font-weight: 400;
    color: var(--color-white) !important;
    border-top: 1px solid transparent;
    border-bottom: 1px solid transparent;
    padding: 8px 16px;
    font-size: 1.3rem;
}

nav .sub-menu li:hover a {
    color: var(--color-text-dark) !important;
    background-color: rgba(0, 0, 0, 0.04) !important;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

nav .sub-menu .current_page_item a {
    color: var(--color-text-dark) !important;
    background-color: rgba(0, 0, 0, 0.05);
    font-weight: 600;
}

/* ================================================
   8. MOBILE CONTACT INFO
   ================================================ */

.off-canvas .mobil-contact {
    padding: 30px 40px;
    text-align: left;
    line-height: 1.6;
    font-size: 14px;
    background: rgba(0, 0, 0, 0.1);
    margin-top: 20px;
    border-top: 2px solid rgba(0, 0, 0, 0.1);
}

.off-canvas .mobil-contact,
.off-canvas .mobil-contact a {
    font-size: 14px !important;
    color: var(--color-white);
}

.off-canvas .mobil-contact a {
    padding: 0 !important;
    display: inline !important;
    text-decoration: underline;
    font-weight: 600;
}

.off-canvas .mobil-contact a:hover {
    text-decoration: none;
    opacity: 0.8;
}

.off-canvas .mobil-contact p {
    margin: 8px 0;
    color: var(--color-white);
}

/* ================================================
   9. PAGE OVERLAY WHEN MENU ACTIVE
   ================================================ */

.page {
    transition: transform 0.4s ease, opacity 0.4s ease;
}

.page.active-canvas {
    transform: translate3d(286px, 0, 0);
    opacity: 0.3;
    pointer-events: none;
}

/* Overlay Click Area */
.page.active-canvas::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    pointer-events: auto;
}

/* ================================================
   10. FIXED POSITIONING HELPER
   ================================================ */

.fixed {
    position: fixed;
}

/* ================================================
   11. RESPONSIVE ADJUSTMENTS
   ================================================ */

/* Tablet & Desktop (Menu sollte auf Desktop nicht sichtbar sein) */
@media (min-width: 741px) {
    .mobile-menu-burger,
    .off-canvas {
        display: none !important;
    }
    
    .page.active-canvas {
        transform: none !important;
        opacity: 1 !important;
    }
}

/* Small Mobile Optimization */
@media (max-width: 360px) {
    .off-canvas {
        width: 260px;
        left: -260px;
    }
    
    .off-canvas.active-canvas,
    .page.active-canvas {
        transform: translate3d(260px, 0, 0);
    }
    
    .mobil-logo img {
        width: 85%;
    }
    
    .off-canvas ul a,
    .off-canvas .headline {
        font-size: 1.6rem;
        padding: 6px 12px 6px 35px;
    }
    
    .off-canvas .mobil-contact {
        padding: 20px 25px;
        font-size: 13px !important;
    }
}

/* Landscape Mobile */
@media (max-width: 740px) and (orientation: landscape) {
    .off-canvas {
        width: 260px;
        left: -260px;
    }
    
    .off-canvas.active-canvas,
    .page.active-canvas {
        transform: translate3d(260px, 0, 0);
    }
    
    .mobil-logo {
        padding: 15px 20px 10px 20px;
    }
    
    .mobil-logo img {
        width: 70%;
    }
}

/* ================================================
   12. ACCESSIBILITY IMPROVEMENTS
   ================================================ */

/* Focus States */
.mobile-menu-burger:focus {
    outline: 2px solid var(--color-white);
    outline-offset: -4px;
}

.off-canvas a:focus {
    outline: 2px solid var(--color-white);
    outline-offset: -2px;
    background: rgba(0, 0, 0, 0.15);
}

/* Skip to Content Link */
.skip-to-menu {
    position: absolute;
    top: -100px;
    left: 0;
    background: var(--color-primary);
    color: var(--color-white);
    padding: 8px 16px;
    text-decoration: none;
    z-index: 10000;
}

.skip-to-menu:focus {
    top: 0;
}

/* Screen Reader Text for Menu State */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ================================================
   13. ANIMATIONS & TRANSITIONS
   ================================================ */

/* Smooth scroll for menu */
.off-canvas {
    scroll-behavior: smooth;
}

/* Menu items fade in */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.off-canvas.active-canvas li {
    animation: slideInLeft 0.3s ease forwards;
}

.off-canvas.active-canvas li:nth-child(1) { animation-delay: 0.05s; }
.off-canvas.active-canvas li:nth-child(2) { animation-delay: 0.1s; }
.off-canvas.active-canvas li:nth-child(3) { animation-delay: 0.15s; }
.off-canvas.active-canvas li:nth-child(4) { animation-delay: 0.2s; }
.off-canvas.active-canvas li:nth-child(5) { animation-delay: 0.25s; }
.off-canvas.active-canvas li:nth-child(6) { animation-delay: 0.3s; }

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .off-canvas,
    .page,
    .mobile-menu-burger,
    .off-canvas li {
        animation: none !important;
        transition: none !important;
    }
}

/* ================================================
   14. BROWSER COMPATIBILITY FIXES
   ================================================ */

/* Safari iOS Fix */
@supports (-webkit-overflow-scrolling: touch) {
    .off-canvas {
        -webkit-overflow-scrolling: touch;
    }
}

/* Edge/IE Fix */
@supports (-ms-ime-align: auto) {
    .off-canvas.active-canvas,
    .page.active-canvas {
        -ms-transform: translate(286px, 0);
    }
}

/* Firefox smooth scrolling */
@-moz-document url-prefix() {
    .off-canvas {
        scrollbar-width: thin;
        scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
    }
}

/* ================================================
   15. CUSTOM SCROLLBAR (WEBKIT)
   ================================================ */

.off-canvas::-webkit-scrollbar {
    width: 8px;
}

.off-canvas::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.off-canvas::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.off-canvas::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* ================================================
   16. PERFORMANCE OPTIMIZATIONS
   ================================================ */

/* Hardware Acceleration */
.off-canvas,
.page,
.mobile-menu-burger {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    will-change: transform;
}

/* Containment für bessere Performance */
.off-canvas {
    contain: layout style paint;
}

/* ================================================
   17. DARK MODE SUPPORT (Optional)
   ================================================ */

@media (prefers-color-scheme: dark) {
    .off-canvas {
        background: #1a1a1a;
        border-right-color: rgba(255, 255, 255, 0.1);
    }
    
    .mobil-logo {
        background: rgba(255, 255, 255, 0.05);
        border-bottom-color: rgba(255, 255, 255, 0.1);
    }
    
    .sub-menu {
        background: #2a2a2a;
    }
}

/* ================================================
   18. PRINT STYLES
   ================================================ */

@media print {
    .mobile-menu-burger,
    .off-canvas {
        display: none !important;
    }
    
    .page.active-canvas {
        transform: none !important;
        opacity: 1 !important;
    }
}

/* ================================================
   ENDE NAVIGATION & OFF-CANVAS
   ================================================ */