/* SCROLL LOCK */
body.ifl-mm-open {
    overflow: hidden;
}

/* OVERLAY (Backdrop) */
.ifl-mm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    /* Dark transparent backdrop */
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

.ifl-mm-overlay.active,
.ifl-mm-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

/* CONTAINER (The White Drawer) */
.ifl-mm-container {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: #fff;
    display: flex;
    width: auto;
    /* Shrink to content */
    max-width: 90vw;
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.1);
}

.ifl-mm-overlay.active .ifl-mm-container,
.ifl-mm-overlay.is-open .ifl-mm-container {
    transform: translateX(0);
}

/* ADMIN BAR FIX */
body.admin-bar .ifl-mm-container {
    top: 32px;
    height: calc(100% - 32px);
}

@media screen and (max-width: 782px) {
    body.admin-bar .ifl-mm-container {
        top: 46px;
        height: calc(100% - 46px);
    }
}

/* CLOSE BUTTON */
.ifl-mm-close {
    position: absolute;
    top: 20px;
    left: 20px;
    background: none;
    border: none;
    font-size: 24px;
    /* Icon size */
    cursor: pointer;
    z-index: 10;
    color: #000;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Futura', 'Helvetica', sans-serif;
    text-transform: uppercase;
    /* font-size: 12px; removed to allow icon size (24px) to take precedence, or we use separate size for text */
    letter-spacing: 1px;
}

.ifl-mm-close:hover {
    opacity: 0.7;
}

/* COLUMNS */
.ifl-mm-left,
.ifl-mm-center,
.ifl-mm-right {
    height: 100%;
    overflow-y: auto;
    border-right: 1px solid #f0f0f0;
}

/* LEFT: Navigation (Always Visible) */
.ifl-mm-left {
    width: 320px;
    /* Fixed width for main nav */
    padding-top: 80px;
    /* Space for close button */
    padding-bottom: 40px;
    background: #fff;
    flex-shrink: 0;
    z-index: 3;
}

.ifl-mm-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ifl-mm-nav-item {
    padding: 0 40px;
    margin-bottom: 25px;
}

.ifl-mm-nav-link {
    text-decoration: none;
    font-family: 'Futura', sans-serif;
    /* LV mimic */
    font-size: 16px;
    color: #1a1a1a;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: color 0.3s;
    letter-spacing: 0.5px;
}

.ifl-mm-nav-link:hover,
.ifl-mm-nav-item.active .ifl-mm-nav-link {
    color: #C8A45C;
    /* Gold Accent */
}

/* UTILITY NAV */
.ifl-mm-utility {
    margin-top: 40px;
    padding: 0 40px;
    border-top: 1px solid #f0f0f0;
    padding-top: 30px;
}

.ifl-mm-utility-list {
    list-style: none;
    padding: 0;
    margin: 0 0 30px;
}

.ifl-mm-utility-list li {
    margin-bottom: 12px;
}

.ifl-mm-utility-list a {
    text-decoration: none;
    font-size: 13px;
    color: #666;
    font-family: system-ui, -apple-system, sans-serif;
    transition: color 0.3s;
}

.ifl-mm-utility-list a:hover {
    color: #000;
}

.ifl-mm-help {
    font-size: 13px;
    color: #666;
    font-family: system-ui, -apple-system, sans-serif;
}

.ifl-mm-help span {
    display: block;
    margin-bottom: 5px;
}

.ifl-mm-phone {
    color: #000;
    text-decoration: none;
    font-weight: 500;
}

/* Arrow (hidden by default, visible on hover/active) */
.ifl-mm-arrow {
    opacity: 0;
    transform: translateX(-5px);
    transition: all 0.3s;
}

.ifl-mm-nav-item.active .ifl-mm-arrow {
    opacity: 1;
    transform: translateX(0);
}


/* SUB-PANEL CONTAINER (Center + Right) */
/* We want these to appear "next" to the left column */
.ifl-mm-center {
    width: 300px;
    background: #fafafa;
    padding-top: 80px;
    display: none;
    /* Hidden until active */
    animation: fadeInSlide 0.3s ease forwards;
    z-index: 2;
}

.ifl-mm-center.active {
    display: block;
}

.ifl-mm-right {
    width: 400px;
    /* Immersive media width */
    background: #fff;
    padding: 0;
    display: none;
    animation: fadeInSlide 0.4s ease forwards;
    z-index: 1;
    position: relative;
}

.ifl-mm-right.active {
    display: block;
}

@keyframes fadeInSlide {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* CENTER CONTENT */
.ifl-mm-panel {
    display: none;
    /* Hide all panels by default */
    padding: 0 30px;
}

.ifl-mm-panel.active {
    display: block;
}

.ifl-mm-cat-item {
    display: block;
    text-decoration: none;
    color: #444;
    padding: 12px 0;
    font-size: 14px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    transition: all 0.2s;
}

.ifl-mm-cat-item:hover {
    color: #000;
    padding-left: 5px;
}

.ifl-mm-global-link {
    margin-top: 30px;
}

.ifl-mm-global-link .button-text {
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-decoration: none;
    color: #000;
    border-bottom: 1px solid #000;
    padding-bottom: 3px;
}

/* RIGHT MEDIA */
.ifl-mm-media-panel {
    width: 100%;
    height: 100%;
    position: relative;
    display: none;
}

.ifl-mm-media-panel.active {
    display: block;
}

.ifl-mm-hero-media,
.ifl-mm-dynamic-media {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.ifl-mm-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 10000;
}

.ifl-mm-close:hover {
    color: #c8a45c;
}

/* Mobile Header (Hidden on Desktop) */
.ifl-mm-mobile-header {
    display: none;
    /* Style for Mobile */
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 0;
    background: #fff;
    order: 1 !important;
    /* Force to top */
    width: 100%;
}

.ifl-mm-back-btn {
    background: none;
    border: none;
    font-size: 14px;
    /* Minimalist */
    font-weight: 500;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    padding: 10px 0;
    /* Increase touch target */
    font-family: 'Futura', sans-serif;
    color: #000;
    letter-spacing: 1px;
    min-height: 44px;
    /* Minimum touch target size */
}

.ifl-mm-back-btn:hover {
    color: #C8A45C !important;
}

.ifl-mm-back-btn .dashicons {
    font-size: 18px;
    line-height: 1;
    width: 18px;
    height: 18px;
}

/* Responsive Mobile */
@media (max-width: 1024px) {
    /* Overlay Adjustment to show Main Header? 
       User said "avec le logo". If we want to show the site header, we push this down.
       Assuming site header is ~60px. Let's try full screen first but clean.
    */

    .ifl-mm-container {
        max-width: 100vw;
        width: 100vw;
        flex-direction: column;
    }

    /* OVERLAY SHIFT: Reveal Site Header */
    /* Assuming Header is ~70px. We move the overlay down. */
    /* OVERLAY SHIFT: Reveal Site Header */
    /* Assuming Header is ~110px now based on X button pos (102px). We move the overlay down. */
    .ifl-mm-overlay {
        top: 110px !important;
        height: calc(100vh - 110px) !important;
        /* Ensure it sits below header if header is sticky */
        z-index: 99990;
    }

    /* Close Button - Hide on Mobile (Use Main Header Toggle instead) */
    .ifl-mm-close {
        display: none !important;
    }

    /* Adjust padding to ensure first item isn't too high now that X is gone, or just keep it clean */
    .ifl-mm-left {
        width: 100%;
        border-right: none;
        display: block;
        padding-top: 20px;
        /* Reduced to 20px since we gained 70px from overlay top */
        padding-bottom: 50px;
        background: #fff;
    }

    .ifl-mm-nav-link {
        color: #000 !important;
        /* Force visibility */
        font-size: 16px;
    }

    .ifl-mm-nav-link:hover,
    .ifl-mm-nav-item.active .ifl-mm-nav-link {
        color: #C8A45C !important;
    }

    /* Force Arrows Visible on Mobile */
    .ifl-mm-arrow {
        opacity: 1 !important;
        transform: none !important;
        font-size: 16px;
        color: #000;
        display: block;
    }

    /* Hide Center/Right by default on Mobile without using !important if possible, 
       but we need to override the desktop 'display:block' from active state. */
    .ifl-mm-right,
    .ifl-mm-center {
        display: none;
    }

    /* Reinforce hidden if they have .active class from JS but we are in Level 1 mobile view */
    .ifl-mm-container:not(.is-level-2-open) .ifl-mm-right.active,
    .ifl-mm-container:not(.is-level-2-open) .ifl-mm-center.active {
        display: none !important;
    }

    /* ACTIVE LEVEL 2 STATE */
    .ifl-mm-container.is-level-2-open {
        overflow-y: auto;
        display: block;
        /* Reset flex */
        position: relative;
    }

    /* Hide Navigator */
    .ifl-mm-container.is-level-2-open .ifl-mm-left {
        display: none !important;
    }

    /* CENTER PANEL (Content Wrapper) */
    .ifl-mm-container.is-level-2-open .ifl-mm-center {
        display: block !important;
        width: 100%;
        padding-top: 380px;
        /* Increased from 300px to clear image (120+250=370) */
        /* Space for Header (50) + Image (250) */
        overflow: visible;
        background: #fff;
        position: relative;
        z-index: 5;
        /* Base Content */
    }

    .ifl-mm-container.is-level-2-open .ifl-mm-panel.active {
        display: block;
    }

    /* 1. HEADER (Absolute Top) */
    .ifl-mm-container.is-level-2-open .ifl-mm-mobile-header {
        display: block;
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: auto;
        /* Allow growth */
        padding-top: 60px;
        /* Increased to 60px for safer distance from X */
        padding-bottom: 15px;
        z-index: 100 !important;
        /* Topmost */
        background: #fff;
        border-bottom: 1px solid #eee;
    }

    /* 2. MEDIA IMAGE (Absolute Below Header) */
    .ifl-mm-container.is-level-2-open .ifl-mm-right {
        display: block !important;
        position: absolute;
        top: 120px;
        /* Adjusted to measured header height */
        left: 0;
        width: 100%;
        height: 250px;
        z-index: 50;
        background: #f5f5f5;
        overflow: hidden;
    }

    /* CRITICAL FIX: Only show the ACTIVE media panel */
    .ifl-mm-container.is-level-2-open .ifl-mm-right .ifl-mm-media-panel {
        display: none;
    }

    .ifl-mm-container.is-level-2-open .ifl-mm-right .ifl-mm-media-panel.active {
        display: block !important;
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }

    /* 3. LINKS (Natural Flow below padding) */
    .ifl-mm-container.is-level-2-open .ifl-mm-catalogues-grid {
        padding: 30px 20px;
        background: #fff;
        min-height: 200px;
        position: relative;
        z-index: 10;
    }

    /* 4. GLOBAL LINK */
    .ifl-mm-container.is-level-2-open .ifl-mm-global-link {
        padding: 0 20px 40px;
    }
}