/* ============================================
   STANDALONE MOBILE PANEL (all breakpoints)
   ============================================ */

#customMobilePanel {
    position: fixed;
    inset: 0;
    z-index: 10000;
    visibility: hidden;
    pointer-events: none;
}

#customMobilePanel.is-open {
    visibility: visible;
    pointer-events: auto;
}

.custom-mobile-panel-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
}

#customMobilePanel.is-open .custom-mobile-panel-backdrop {
    opacity: 1;
}

.custom-mobile-panel-drawer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

#customMobilePanel.is-open .custom-mobile-panel-drawer {
    transform: translateX(0);
}

body.custom-mobile-panel-open {
    overflow: hidden;
}

/* ============================================
   CUSTOM MOBILE MENU WITH DRILL DOWN - MOBILE ONLY
   ============================================ */

@media only screen and (max-width: 1024px) {

    /* Hide default WoodMart mobile menu */
    .mobile-nav .mobile-pages-menu {
        display: none !important;
    }

    /* Force mobile nav to be full screen */
    .mobile-nav {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100vh !important;
        height: 100dvh !important;
        max-width: 100% !important;
        z-index: 9999 !important;
        overflow: hidden !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .mobile-nav.wd-opened {
        transform: translateX(0);
    }

    /* Custom Mobile Nav Container */
    .custom-mobile-nav {
        background-color: #ffffff;
        width: 100%;
        height: 100vh;
        height: 100dvh;
        overflow: hidden;
        position: relative;
        display: flex;
        flex-direction: column;
    }

    /* ── Header ── */
    .custom-mobile-header {
        display: flex;
        justify-content: flex-end;
        align-items: center;
        padding: 18px 14px;
        border-bottom: none;          /* no divider line */
        flex-shrink: 0;
        background: #ffffff;
        position: relative;
        z-index: 10;
    }

    /* Back Button — invisible at root, slides in for submenus */
    .custom-back-btn {
        display: flex;
        align-items: center;
        gap: 8px;
        background: none;
        border: none;
        font-size: 13px;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: #000000;
        cursor: pointer;
        padding: 5px 0;
        transition: opacity 0.25s ease;
        opacity: 0;
        pointer-events: none;
        position: absolute;
        left: 20px;
    }

    .custom-back-btn.active {
        opacity: 1;
        pointer-events: all;
    }

    .custom-back-btn:hover {
        opacity: 0.5;
    }

    .custom-back-btn svg {
        flex-shrink: 0;
    }

    /* Close Button */
    .custom-close-btn {
        background: none !important;
        border: none;
        font-size: 20px !important;
        line-height: 1;
        color: #000000;
        cursor: pointer;
        padding: 0px !important;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: opacity 0.2s ease;
        margin: 0;
        width: auto;
        height: auto;
    }

    .custom-close-btn:hover {
        opacity: 0.5;
    }

    /* ── Menu Container ── */
    .custom-menu-container {
        flex: 1;
        overflow: hidden;
        position: relative;
    }

    .custom-menu-level {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        overflow-y: auto;
        overflow-x: hidden;
        padding: 10px 14px 12px;
        background: #ffffff;
        transform: translateX(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        opacity: 0;
        box-sizing: border-box;
    }

    .custom-menu-level.active {
        transform: translateX(0);
        opacity: 1;
    }

    .custom-menu-level.slide-out-left {
        transform: translateX(-30%);
        opacity: 0;
    }

    .custom-menu-level.slide-in-right {
        transform: translateX(100%);
        opacity: 0;
    }

    /* ── Main Nav Items ── */
    .custom-mobile-menu {
        list-style: none;
        margin: 0;
        padding: 0;
    }

    .custom-mobile-menu li {
        margin: 0;
        padding: 0;
        border: none;
        opacity: 0;
        animation: fadeInUp 0.35s ease forwards;
    }

    .custom-mobile-menu li:nth-child(1) { animation-delay: 0.04s; }
    .custom-mobile-menu li:nth-child(2) { animation-delay: 0.08s; }
    .custom-mobile-menu li:nth-child(3) { animation-delay: 0.12s; }
    .custom-mobile-menu li:nth-child(4) { animation-delay: 0.16s; }
    .custom-mobile-menu li:nth-child(5) { animation-delay: 0.20s; }
    .custom-mobile-menu li:nth-child(6) { animation-delay: 0.24s; }
    .custom-mobile-menu li:nth-child(7) { animation-delay: 0.28s; }

    @keyframes fadeInUp {
        from { opacity: 0; transform: translateY(14px); }
        to   { opacity: 1; transform: translateY(0); }
    }

    .custom-mobile-menu li a {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 1px 0;
        text-decoration: none;
        color: #000000;
        font-size: 14px;
        font-weight: 200 !important;
        letter-spacing: 0.12em;
        text-transform: uppercase;
        font-family: inherit;
        transition: opacity 0.2s ease;
        border: none;
        background: none;
    }

    .custom-mobile-menu li a:hover {
        opacity: 0.5;
    }

    .menu-item-text {
        flex: 1;
    }

    /* Arrow icon */
    .menu-arrow {
        display: flex;
        align-items: center;
        flex-shrink: 0;
        margin-left: 12px;
        transition: transform 0.2s ease;
    }

    .menu-arrow svg {
        width: 18px;
        height: 18px;
        display: block;
        fill: none;
    }

    .custom-mobile-menu li a:hover .menu-arrow {
        transform: translateX(2px);
    }

    /* Hide submenu data blocks */
    .submenu-data {
        display: none !important;
    }

    /* ── Divider ── */
    .custom-menu-divider {
        height: 1px;
        background-color: #e8e8e8;
        margin: 20px 0 24px;
        opacity: 0;
        animation: fadeIn 0.3s ease forwards 0.35s;
    }

    @keyframes fadeIn {
        from { opacity: 0; }
        to   { opacity: 1; }
    }

    /* ── Social Links ── */
    .custom-social-menu {
        list-style: none;
        margin: 0;
        padding: 0;
    }

    .custom-social-menu li {
        margin: 0;
        padding: 0;
        border: none;
    }

    .custom-social-menu li a {
        display: flex;
        align-items: center;
        gap: 14px;
        padding: 4px 0;
        text-decoration: none;
        color: #000000;
        font-size: 10px;
        font-weight: 400;
        letter-spacing: 0.12em;
        font-family: inherit;
        transition: opacity 0.2s ease;
        text-transform: uppercase;
        border: none;
        background: none;
    }

    .custom-social-menu li a:hover {
        opacity: 0.5;
    }

    .custom-social-menu li a svg {
        flex-shrink: 0;
    }

    /* ── Body scroll lock ── */
    body.wd-mobile-nav-opened {
        overflow: hidden !important;
        position: fixed !important;
        width: 100% !important;
    }

    .wd-backdrop {
        background-color: rgba(0, 0, 0, 0.5) !important;
        z-index: 9998 !important;
        transition: opacity 0.3s ease;
    }
}

/* Desktop — hide custom mobile menu */
@media only screen and (min-width: 1025px) {
    .custom-mobile-nav {
        display: none !important;
    }

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