/* 
 * TwentyTwelve Modern Menu
 * Modern overlay navigation for mobile devices
 * Version: 3.0.1
 */

/* ============================================
   Hide old/conflicting menus
   ============================================ */

/* Verstecke altes Overlay-Menü (ohne tt- Präfix) */
.menu-overlay {
    display: none !important;
}

/* ============================================
   Base Container - Hidden on Desktop
   ============================================ */

.tt-modern-nav {
    display: none;
}

/* Show on mobile/tablet */
@media screen and (max-width: 600px) {
    /* Hide original TwentyTwelve menu */
    .site-header .main-navigation {
        display: none !important;
    }
    
    /* Show our modern navigation */
    .tt-modern-nav {
        display: block;
    }
}

/* ============================================
   Hamburger Button
   ============================================ */

.tt-menu-toggle {
    position: fixed;
    top: 25px;
    right: 22px;
    z-index: 9998;
    width: 30px;
    height: 30px;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Admin Bar Support */
body.admin-bar .tt-menu-toggle {
    top: 57px; /* 25px + 32px Admin Bar */
}

@media screen and (max-width: 782px) {
    body.admin-bar .tt-menu-toggle {
        top: 71px; /* 25px + 46px Mobile Admin Bar */
    }
}

.tt-menu-toggle:focus {
    outline: none;
}

/* Hamburger Icon */
.tt-hamburger {
    width: 24px;
    height: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.tt-hamburger-line {
    display: block;
    width: 100%;
    height: 2px;
    background: #333;
}

/* Hide hamburger when menu is open */
.tt-modern-nav.is-open .tt-menu-toggle {
    opacity: 0;
    pointer-events: none;
}

/* ============================================
   Overlay
   ============================================ */

.tt-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 9999;
}

/* Admin Bar Support - Overlay nach unten */
body.admin-bar .tt-menu-overlay {
    top: 32px;
    height: calc(100% - 32px);
}

@media screen and (max-width: 782px) {
    body.admin-bar .tt-menu-overlay {
        top: 46px;
        height: calc(100% - 46px);
    }
}

.tt-modern-nav.is-open .tt-menu-overlay {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   Menu Container
   ============================================ */

.tt-menu-container {
    position: fixed;
    top: 0;
    right: -100%;
    width: 85%;
    max-width: 400px;
    height: 100%;
    background: #fff;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
    overflow-x: hidden;
    transition: right 0.3s ease;
    z-index: 10000;
    padding: 80px 20px 40px;
}

/* Admin Bar Support - Menu Container nach unten */
body.admin-bar .tt-menu-container {
    top: 32px;
    height: calc(100% - 32px);
}

@media screen and (max-width: 782px) {
    body.admin-bar .tt-menu-container {
        top: 46px;
        height: calc(100% - 46px);
    }
}

.tt-modern-nav.is-open .tt-menu-container {
    right: 0;
}

/* ============================================
   Close Button
   ============================================ */

.tt-menu-close {
    position: absolute;
    top: 25px;
    right: 22px;
    width: 30px;
    height: 30px;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Close Button bleibt bei 25px relativ zum Container
   (Container verschiebt sich bereits nach unten bei Admin Bar) */

.tt-menu-close:focus {
    outline: none;
}

.tt-menu-close svg {
    color: #333;
}

/* ============================================
   Menu Items
   ============================================ */

.tt-menu-items {
    list-style: none;
    margin: 0;
    padding: 0;
}

.tt-menu-item {
    margin: 0;
    padding: 0;
}

.tt-menu-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 16px 20px;
    background: none;
    border: none;
    border-bottom: 1px solid #f0f0f0;
    text-align: left;
    text-decoration: none;
    color: #333;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.5;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tt-menu-link:hover {
    background: #f8f8f8;
    color: #333;
}

.tt-menu-link:focus {
    outline: 2px solid #000;
    outline-offset: -2px;
}

/* Current menu item */
.current-menu-item > .tt-menu-link {
    font-weight: 600;
    color: #333;
}

/* ============================================
   Submenu
   ============================================ */

.has-children {
    position: relative;
}

.tt-submenu-toggle {
    font-family: inherit;
}

.tt-submenu-icon {
    margin-left: 8px;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.tt-submenu-toggle[aria-expanded="true"] .tt-submenu-icon {
    transform: rotate(180deg);
}

.tt-submenu {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: #f8f8f8;
}

.tt-submenu-toggle[aria-expanded="true"] + .tt-submenu {
    max-height: 1000px; /* Large enough for most submenus */
}

.tt-submenu .tt-menu-link {
    padding-left: 40px;
    font-size: 15px;
    border-bottom-color: #e8e8e8;
}

.tt-submenu .tt-menu-item:last-child .tt-menu-link {
    border-bottom: none;
}

/* Nested submenus */
.tt-submenu .tt-submenu .tt-menu-link {
    padding-left: 60px;
    font-size: 14px;
}

/* ============================================
   Scrollbar Styling
   ============================================ */

.tt-menu-container::-webkit-scrollbar {
    width: 8px;
}

.tt-menu-container::-webkit-scrollbar-track {
    background: #f0f0f0;
}

.tt-menu-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.tt-menu-container::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* ============================================
   Body Scroll Lock (when menu is open)
   ============================================ */

body.tt-menu-open {
    overflow: hidden;
}

/* ============================================
   Responsive Adjustments
   ============================================ */

@media screen and (max-width: 400px) {
    .tt-menu-container {
        width: 90%;
    }
    
    .tt-menu-link {
        font-size: 15px;
        padding: 14px 16px;
    }
}

/* ============================================
   Dark Mode Support (Optional)
   ============================================ */

@media (prefers-color-scheme: dark) {
    /* Hamburger und Close Button - weiße Linien im Dark Mode */
    .tt-hamburger-line {
        background: #fff;
    }
    
    .tt-menu-close svg {
        color: #fff;
    }
    
    /* Menu Container */
    .tt-menu-container {
        background: #1a1a1a;
    }
    
    .tt-menu-link {
        color: #e0e0e0;
        border-bottom-color: #333;
    }
    
    .tt-menu-link:hover {
        background: #2a2a2a;
        color: #fff;
    }
    
    .current-menu-item > .tt-menu-link {
        color: #fff;
    }
    
    .tt-submenu {
        background: #2a2a2a;
    }
}

/* ============================================
   Accessibility
   ============================================ */

/* Ensure focus is visible */
*:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .tt-menu-toggle,
    .tt-hamburger-line,
    .tt-menu-overlay,
    .tt-menu-container,
    .tt-menu-link,
    .tt-submenu-icon,
    .tt-submenu {
        transition: none !important;
    }
}