/* ============================================================
   Enow_Menu - Hamburger Menu + Navbar + Desktop Mega Menu
   Mobile/Tablet: sidebar drill-down
   Desktop (≥1024px): MediaMarkt-style mega menu
   ============================================================ */

:root {
    --navbar-bg: #333333;
    --navbar-text: #ffffff;
    --panel-bg: #ffffff;
    --accent-color: #0066cc;
    --overlay-opacity: 0.5;
    --sidebar-width: 360px;
    --menu-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --panel-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Body Scroll Lock ── */
body.enow-menu-noscroll {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* ── Luma overrides ── */
.nav-toggle {
    display: none !important;
}

@media (max-width: 767px) {
    .nav-sections,
    .nav-sections-item-title {
        display: none !important;
    }
    html.nav-open body,
    html.nav-before-open body {
        overflow: auto;
    }
    html.nav-open .page-wrapper,
    html.nav-before-open .page-wrapper {
        left: auto;
        transform: none;
    }
}

@media (min-width: 768px) {
    .nav-sections {
        display: none !important;
    }
}

/* ============================================================
   1. NAVBAR (hamburger + horizontal links, single row)
   ============================================================ */
.enow-navbar {
    background-color: var(--navbar-bg);
    color: var(--navbar-text);
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    z-index: 100;
}

.enow-navbar-inner {
    display: flex;
    align-items: stretch;
    max-width: 1280px;
    margin: 0 auto;
    min-height: 44px;
}

/* ── Hamburger button ── */
.enow-hamburger-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 20px;
    background: none;
    border: none;
    border-right: 1px solid rgba(255, 255, 255, 0.15);
    cursor: pointer;
    color: var(--navbar-text);
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: background-color 0.2s ease;
    flex-shrink: 0;
    white-space: nowrap;
}

.enow-hamburger-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.enow-hamburger-btn:focus-visible {
    outline: 2px solid #fff;
    outline-offset: -2px;
}

/* 3-line icon */
.enow-hamburger-icon {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 20px;
    height: 18px;
}

.enow-hamburger-icon span {
    display: block;
    width: 100%;
    height: 2px;
    background-color: currentColor;
    border-radius: 1px;
    transition: transform 0.3s ease, opacity 0.3s ease;
    transform-origin: center;
}

/* Animate to X */
.enow-hamburger-btn.is-active .enow-hamburger-icon span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}
.enow-hamburger-btn.is-active .enow-hamburger-icon span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}
.enow-hamburger-btn.is-active .enow-hamburger-icon span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

.enow-hamburger-label {
    white-space: nowrap;
}

/* ── Horizontal links ── */
.enow-navbar-links {
    display: flex;
    align-items: stretch;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex: 1;
    min-width: 0;
}

.enow-navbar-links::-webkit-scrollbar {
    display: none;
}

.enow-navbar-link {
    display: inline-flex;
    align-items: center;
    padding: 0 16px;
    color: var(--navbar-text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: 0.3px;
    transition: background-color 0.2s ease;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.enow-navbar-link:last-child {
    border-right: none;
}
.enow-navbar-link:visited {
    color: var(--navbar-text);
}
.enow-navbar-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--navbar-text);
    text-decoration: none;
}
.enow-navbar-link:focus-visible {
    outline: 2px solid #fff;
    outline-offset: -2px;
}

/* ============================================================
   2. OVERLAY
   ============================================================ */
.enow-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, var(--overlay-opacity));
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--menu-transition), visibility var(--menu-transition);
}

.enow-menu-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

/* ============================================================
   3. SIDEBAR PANEL (Mobile / Tablet)
   ============================================================ */
.enow-sidebar-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    max-width: 90vw;
    height: 100%;
    background-color: var(--panel-bg);
    z-index: 9999;
    transform: translateX(-100%);
    transition: transform var(--menu-transition);
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
}

.enow-sidebar-panel.is-open {
    transform: translateX(0);
}

/* ── Sidebar Header ── */
.enow-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e8e8e8;
    min-height: 56px;
    flex-shrink: 0;
    background-color: #f9f9f9;
}

.enow-sidebar-title {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a1a;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: calc(100% - 50px);
}

.enow-sidebar-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    border-radius: 50%;
    transition: background-color 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
}

.enow-sidebar-close:hover {
    background-color: #e8e8e8;
    color: #1a1a1a;
}
.enow-sidebar-close:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* ── Sidebar Content ── */
.enow-sidebar-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

/* ============================================================
   4. PANELS (Drill-down)
   ============================================================ */
.enow-panels-wrapper {
    position: relative;
    min-height: 100%;
}

.enow-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 100%;
    transition: transform var(--panel-transition), opacity var(--panel-transition);
}

.enow-panel-active {
    transform: translateX(0);
    opacity: 1;
    position: relative;
}
.enow-panel-enter-right {
    transform: translateX(100%);
    opacity: 0;
}
.enow-panel-enter-left {
    transform: translateX(-100%);
    opacity: 0;
}
.enow-panel-exit-left {
    transform: translateX(-30%);
    opacity: 0;
    position: absolute;
}
.enow-panel-exit-right {
    transform: translateX(30%);
    opacity: 0;
    position: absolute;
}

/* ── Back Button ── */
.enow-panel-back {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background-color: #f5f5f5;
    border-bottom: 1px solid #e8e8e8;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    transition: background-color 0.2s ease;
    user-select: none;
}
.enow-panel-back:hover {
    background-color: #eaeaea;
}
.enow-panel-back svg {
    flex-shrink: 0;
    color: #666;
}

/* ── Menu Items ── */
.enow-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    font-size: 15px;
    color: #333;
    text-decoration: none;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.15s ease, padding-left 0.15s ease;
    user-select: none;
}
.enow-item:visited { color: #333; }
.enow-item:hover {
    background-color: #f8f8f8;
    padding-left: 24px;
    text-decoration: none;
    color: #333;
}
.enow-item:active { background-color: #f0f0f0; }

.enow-item-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.enow-item-arrow {
    flex-shrink: 0;
    color: #bbb;
    margin-left: 8px;
    transition: color 0.15s ease, transform 0.15s ease;
}
.enow-item-parent:hover .enow-item-arrow {
    color: var(--accent-color);
    transform: translateX(3px);
}

.enow-item-viewall {
    font-weight: 600;
    color: var(--accent-color);
    font-size: 14px;
    border-bottom: 1px solid #e8e8e8;
}
.enow-item-viewall:visited { color: var(--accent-color); }
.enow-item-viewall:hover {
    color: var(--accent-color);
    background-color: rgba(0, 102, 204, 0.05);
}

.enow-item-cms { color: #555; font-size: 14px; }
.enow-item-cms:hover { color: var(--accent-color); }

.enow-item-bar-link { color: #333; font-size: 14px; font-weight: 600; }
.enow-item-bar-link:hover { color: var(--accent-color); }

.enow-separator {
    height: 1px;
    background-color: #e0e0e0;
    margin: 8px 0;
}

/* ============================================================
   5. DESKTOP MEGA MENU (≥1024px)
   ============================================================ */
.enow-mega {
    display: none;
}

@media (min-width: 1024px) {
    /* Hide sidebar on desktop */
    .enow-sidebar-panel {
        display: none !important;
    }

    /* Mega menu container */
    .enow-mega {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 9999;
        pointer-events: none;
    }
    .enow-mega.is-open {
        display: block;
    }

    .enow-mega-inner {
        display: flex;
        position: absolute;
        /* Position below navbar — JS will set top dynamically */
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 100%;
        max-width: 1280px;
        max-height: calc(100vh - 120px);
        background: #fff;
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
        border-radius: 0 0 8px 8px;
        overflow: hidden;
        pointer-events: all;
    }

    /* ── Left panel: L1 categories ── */
    .enow-mega-left {
        width: 280px;
        min-width: 280px;
        background: #f7f7f7;
        border-right: 1px solid #e8e8e8;
        overflow-y: auto;
        padding: 8px 0;
    }

    .enow-mega-l1 {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 12px 20px;
        cursor: pointer;
        transition: background-color 0.15s ease;
        border-left: 3px solid transparent;
    }
    .enow-mega-l1:hover {
        background: #eee;
    }
    .enow-mega-l1.is-active {
        background: #fff;
        border-left-color: #f0c040;
        font-weight: 600;
    }

    .enow-mega-l1-link {
        flex: 1;
        color: #333;
        text-decoration: none;
        font-size: 14px;
        line-height: 1.4;
        /* Prevent click navigation — hover only switches panel */
        pointer-events: none;
    }
    .enow-mega-l1.is-active .enow-mega-l1-link {
        color: #111;
    }

    .enow-mega-l1-arrow {
        flex-shrink: 0;
        color: #bbb;
        margin-left: 8px;
    }
    .enow-mega-l1.is-active .enow-mega-l1-arrow {
        color: #f0c040;
    }

    /* ── Right panel: L2/L3 columns ── */
    .enow-mega-right {
        flex: 1;
        overflow-y: auto;
        padding: 24px 30px;
    }

    .enow-mega-title {
        font-size: 18px;
        font-weight: 700;
        color: #111;
        margin: 0 0 20px 0;
        padding-bottom: 12px;
        border-bottom: 2px solid #f0c040;
    }
    .enow-mega-title a {
        color: inherit;
        text-decoration: none;
    }
    .enow-mega-title a:hover {
        color: #f0c040;
        text-decoration: none;
    }

    .enow-mega-columns {
        display: flex;
        flex-wrap: wrap;
        gap: 0 40px;
    }

    .enow-mega-col {
        display: flex;
        flex-direction: column;
        min-width: 250px;
        max-width: 260px;
        margin-bottom: 24px;
    }

    .enow-mega-l2 {
        display: block;
        font-size: 14px;
        font-weight: 700;
        color: #222;
        text-decoration: none;
        padding: 6px 0;
        margin-bottom: 4px;
        border-bottom: 1px solid #eee;
    }
    .enow-mega-l2:hover {
        color: #f0c040;
        text-decoration: none;
    }

    .enow-mega-l3 {
        display: block;
        font-size: 13px;
        color: #555;
        text-decoration: none;
        padding: 4px 0 4px 8px;
        transition: color 0.15s ease;
    }
    .enow-mega-l3:hover {
        color: #f0c040;
        text-decoration: none;
    }

    .enow-mega-empty {
        color: #999;
        font-size: 14px;
        padding: 20px;
    }

    /* L1 link clickable when active (to navigate to category page) */
    .enow-mega-l1.is-active .enow-mega-l1-link {
        pointer-events: all;
    }
}

/* ============================================================
   6. RESPONSIVE (mobile)
   ============================================================ */
@media (max-width: 480px) {
    .enow-sidebar-panel {
        max-width: 100vw;
        width: 100vw;
    }
    .enow-hamburger-label { display: none; }
    .enow-hamburger-btn { padding: 0 14px; }
    .enow-navbar-link { padding: 0 12px; font-size: 12px; }
    .enow-item { padding: 16px; font-size: 16px; }
    .enow-panel-back { padding: 16px; }
}

@media (min-width: 481px) and (max-width: 768px) {
    .enow-sidebar-panel {
        max-width: 80vw;
    }
}

/* ============================================================
   7. PRINT
   ============================================================ */
@media print {
    .enow-hamburger-btn,
    .enow-sidebar-panel,
    .enow-menu-overlay,
    .enow-navbar,
    .enow-mega {
        display: none !important;
    }
}

/* ============================================================
   8. REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .enow-sidebar-panel,
    .enow-menu-overlay,
    .enow-panel,
    .enow-hamburger-icon span,
    .enow-item,
    .enow-item-arrow {
        transition-duration: 0.01ms !important;
    }
}
