/* GTS Mega Menu v0.5 */

/* =========================
   DESKTOP >= 1024px
   ========================= */
@media (min-width:1024px) {
    .menu_bar { position:relative; z-index:1000; }
    .menu_bar .container,
    .menu_bar .menu,
    .menu_bar .menu > ul,
    .menu_bar .menu > li,
    .menu_bar ul.menu > li { position:static; }

    .gts-has-mega-menu { position:static !important; }

    .gts-mega-menu {
        position:absolute;
        top:100%;
        left:50%;
        width:1200px;
        max-width:calc(100vw - 40px);
        transform:translateX(-50%) translateY(8px);
        background:#fff;
        border-top:2px solid #24783e;
        box-shadow:0 15px 35px rgba(0,0,0,.12);
        opacity:0;
        visibility:hidden;
        pointer-events:none;
        transition:opacity .2s ease, transform .2s ease, visibility .2s ease;
        z-index:9999;
    }

    .gts-has-mega-menu:hover > .gts-mega-menu,
    .gts-has-mega-menu:focus-within > .gts-mega-menu {
        opacity:1;
        visibility:visible;
        pointer-events:auto;
        transform:translateX(-50%) translateY(0);
    }

    .gts-mega-menu__inner {
        display:grid;
        grid-template-columns:220px minmax(430px,1fr) 320px;
        gap:48px;
        padding:30px 38px;
        min-height:300px;
        box-sizing:border-box;
    }

    .gts-mega-menu__column { min-width:0; }

    .gts-mega-menu__heading {
        margin:0 0 15px;
        padding:0;
        font-size:15px;
        line-height:1.2;
        font-weight:700;
        color:#111;
        text-transform:none;
    }

    .gts-mega-menu__link {
        display:block;
        margin:0;
        padding:5px 0;
        font-size:14px;
        line-height:1.35;
        font-weight:400;
        color:#171717 !important;
        text-decoration:none !important;
        background:transparent !important;
        transition:color .15s ease;
    }

    .gts-mega-menu__link:hover,
    .gts-mega-menu__link:focus { color:#24783e !important; }

    .gts-mega-menu__preview {
        width:320px;
        height:260px;
        display:flex;
        align-items:center;
        justify-content:center;
        align-self:center;
        overflow:hidden;
        box-sizing:border-box;
    }

    .gts-mega-menu__preview img {
        display:block !important;
        width:auto !important;
        height:auto !important;
        max-width:100% !important;
        max-height:100% !important;
        object-fit:contain !important;
        object-position:center !important;
        opacity:1;
        transform:scale(1);
        transition:opacity .22s ease, transform .22s ease;
    }

    .gts-mega-menu__preview img.gts-image-changing {
        opacity:0;
        transform:scale(.97);
    }

    .gts-mobile-toggle { display:none !important; }
}

/* =========================
   MOBILE / TABLET < 1024px
   ========================= */
@media (max-width:1023px) {

    /*
     * Do not position the LI itself. Many themes use absolute-positioned
     * mobile submenus and this was causing the oversized green panel.
     */
    .gts-has-mega-menu {
        position:relative !important;
        width:100% !important;
        height:auto !important;
        min-height:0 !important;
        overflow:visible !important;
    }

    /* Keep the existing top-level link looking like the rest of the theme menu. */
    .gts-has-mega-menu > a {
        display:block !important;
        width:100% !important;
        box-sizing:border-box !important;
        padding-right:58px !important;
    }

    /*
     * Our generated panel is normal document flow on mobile.
     * It is completely closed by default.
     */
    .gts-has-mega-menu > .gts-mega-menu {
        position:static !important;
        inset:auto !important;
        top:auto !important;
        right:auto !important;
        bottom:auto !important;
        left:auto !important;

        display:none !important;
        width:100% !important;
        max-width:none !important;
        height:auto !important;
        min-height:0 !important;

        margin:0 !important;
        padding:0 !important;

        transform:none !important;
        opacity:1 !important;
        visibility:visible !important;
        pointer-events:auto !important;

        border:0 !important;
        box-shadow:none !important;
        background:rgba(255,255,255,.08) !important;

        float:none !important;
        clear:both !important;
    }

    .gts-has-mega-menu.gts-mobile-open > .gts-mega-menu {
        display:block !important;
    }

    .gts-mega-menu__inner {
        display:block !important;
        width:100% !important;
        min-height:0 !important;
        height:auto !important;
        margin:0 !important;
        padding:12px 24px 18px !important;
        box-sizing:border-box !important;
        background:transparent !important;
    }

    .gts-mega-menu__column {
        display:block !important;
        width:100% !important;
        min-width:0 !important;
        margin:0 0 14px !important;
        padding:0 !important;
        float:none !important;
    }

    .gts-mega-menu__column:last-of-type {
        margin-bottom:0 !important;
    }

    .gts-mega-menu__heading {
        margin:0 0 6px !important;
        padding:0 !important;
        font-size:14px !important;
        line-height:1.3 !important;
        font-weight:700 !important;
        color:#fff !important;
        text-align:left !important;
    }

    .gts-mega-menu__link {
        display:block !important;
        width:100% !important;
        margin:0 !important;
        padding:6px 0 !important;
        background:transparent !important;
        color:#fff !important;
        font-size:14px !important;
        line-height:1.35 !important;
        font-weight:400 !important;
        text-align:left !important;
        text-decoration:none !important;
        box-sizing:border-box !important;
    }

    .gts-mega-menu__preview {
        display:none !important;
    }

    /*
     * Small dedicated accordion control aligned with the theme's existing
     * chevron area instead of the oversized square from v0.3.
     */
    .gts-mobile-toggle {
        position:absolute !important;
        top:50% !important;
        right:12px !important;
        transform:translateY(-50%) !important;

        display:flex !important;
        align-items:center !important;
        justify-content:center !important;

        width:36px !important;
        height:36px !important;
        min-width:36px !important;
        min-height:36px !important;

        margin:0 !important;
        padding:0 !important;

        border:0 !important;
        outline:0 !important;
        box-shadow:none !important;
        border-radius:0 !important;

        background:transparent !important;
        color:#fff !important;

        font-size:0 !important;
        line-height:1 !important;
        cursor:pointer !important;
        z-index:5 !important;
        appearance:none !important;
        -webkit-appearance:none !important;
    }

    /* CSS chevron so theme button styling cannot turn it into a giant + button. */
    .gts-mobile-toggle::before {
        content:"" !important;
        display:block !important;
        width:10px !important;
        height:10px !important;
        border-right:3px solid currentColor !important;
        border-bottom:3px solid currentColor !important;
        transform:rotate(45deg) translate(-2px,-2px) !important;
        transition:transform .18s ease !important;
    }

    .gts-has-mega-menu.gts-mobile-open > .gts-mobile-toggle::before {
        transform:rotate(225deg) translate(-2px,-2px) !important;
    }

    /* Never display text/content injected by button styles. */
    .gts-mobile-toggle::after {
        content:none !important;
        display:none !important;
    }
}

/* v0.5 — Nested WooCommerce subcategories */
@media (min-width:1024px) {
    .gts-mega-menu__subcategories {
        display:grid;
        grid-template-columns:repeat(2,minmax(0,1fr));
        gap:12px 22px;
        max-height:350px;
        overflow-y:auto;
    }
    .gts-mega-menu__subcategory-group { min-width:0; }
    .gts-mega-menu__group-heading {
        display:block;
        font-size:13px;
        font-weight:700;
        line-height:1.35;
        color:#171717 !important;
        text-decoration:none !important;
        margin:0 0 4px;
    }
    .gts-mega-menu__group-heading:hover { color:#24783e !important; }
}
@media (max-width:1023px) {
    .gts-mega-menu__subcategory-group { margin-bottom:12px; }
    .gts-mega-menu__group-heading {
        display:block;
        color:#fff !important;
        font-size:14px;
        font-weight:700;
        text-decoration:none !important;
        margin:8px 0 2px;
    }
    .gts-mega-menu__subcategory-group .gts-mega-menu__link { padding-left:12px !important; }
}

/* v0.5.1: category-specific subcategory panels */
.gts-mega-menu__subcategory-panel[hidden] { display:none !important; }
@media (min-width:1024px) {
  .gts-mega-menu__category-toggle { display:none !important; }
  .gts-mega-menu__subcategory-panel { max-height:350px; overflow-y:auto; }
  .gts-mega-menu__category-row { display:block; }
}
@media (max-width:1023px) {
  .gts-mega-menu__category-row { display:flex; align-items:center; gap:8px; }
  .gts-mega-menu__category-link { flex:1; min-width:0; }
  .gts-mega-menu__category-toggle { display:flex !important; align-items:center; justify-content:center; flex:0 0 32px; width:32px; height:32px; border:0 !important; background:transparent !important; color:#fff !important; cursor:pointer; }
  .gts-mega-menu__category-toggle::before { content:""; display:block; width:8px; height:8px; border-right:2px solid currentColor; border-bottom:2px solid currentColor; transform:rotate(45deg); }
  .gts-mega-menu__category-toggle[aria-expanded="true"]::before { transform:rotate(225deg); }
  .gts-mega-menu__products { padding-left:12px !important; }
  .gts-mega-menu__subcategory-panel { padding:0 0 8px; }
}

/* v0.5.2: mobile menu polish, nested categories and service links */
@media (min-width:1024px) {
    .gts-mm-mobile-thumb, .gts-mm-service-item { display:none !important; }
}
@media (max-width:1023px) {
    .gts-mega-menu__inner { padding:8px 12px 16px !important; text-align:left !important; }
    .gts-mega-menu__heading, .gts-mega-menu__products { display:none !important; }
    .gts-mega-menu__categories { margin:0 !important; }
    .gts-mega-menu__category-row { border-bottom:1px solid rgba(255,255,255,.16); gap:4px; }
    .gts-mega-menu__category-link { display:flex !important; align-items:center; gap:12px; min-height:58px; padding:7px 0 !important; }
    .gts-mm-mobile-thumb { display:block !important; width:46px !important; height:46px !important; flex:0 0 46px; border-radius:6px; object-fit:contain; background:#fff; padding:3px; box-sizing:border-box; }
    .gts-mega-menu__category-toggle { width:42px !important; height:44px !important; flex-basis:42px !important; border-radius:6px !important; background:rgba(255,255,255,.1) !important; }
    .gts-mega-menu__subcategory-panel { padding:5px 0 10px 16px !important; border-bottom:1px solid rgba(255,255,255,.16); }
    .gts-mega-menu__subcategory-panel .gts-mega-menu__link { display:flex !important; align-items:center; gap:10px; padding:6px 0 !important; }
    .gts-mm-mobile-thumb--sub { width:34px !important; height:34px !important; flex-basis:34px; }
    .gts-mm-service-item { display:block !important; width:100%; list-style:none !important; padding:18px 18px 25px !important; box-sizing:border-box; border-top:1px solid rgba(255,255,255,.2); text-align:left !important; }
    .gts-mm-mobile-service h3 { margin:0 0 12px; color:#fff; font-size:15px; font-weight:700; }
    .gts-mm-mobile-service ul { display:block !important; position:static !important; background:transparent !important; margin:0 !important; padding:0 !important; width:100% !important; box-shadow:none !important; }
    .gts-mm-mobile-service li { display:block !important; margin:0 !important; padding:0 !important; }
    .gts-mm-mobile-service a { display:block !important; color:#fff !important; text-decoration:none !important; padding:9px 0 !important; font-size:14px !important; text-align:left !important; }
    /* Header hamburger: layout only; retains theme's existing toggle handler. */
    .main-header__burger { order:-1; margin-left:0 !important; margin-right:auto !important; }
}

/* ============================================================
   v0.5.3 - Clean white mobile navigation with slide-in submenus
   Desktop menu rules above are intentionally unchanged.
   ============================================================ */
@media (min-width:1024px) {
    .gts-mm-slide { display:none !important; }
    .gts-mm-root-thumb, .gts-mm-quicklinks { display:none !important; }
}
@media (max-width:1023px) {
    .gts-mm-mobile-root, .gts-mm-mobile-root > li,
    .gts-mm-mobile-root > li > a { box-sizing:border-box !important; }
    .gts-mm-mobile-root { background:#fff !important; color:#242424 !important; text-align:left !important; }
    .gts-mm-mobile-root > li { position:relative !important; background:#fff !important; border-bottom:1px solid #e8ece8 !important; margin:0 !important; }
    .gts-mm-mobile-root > li > a { display:flex !important; align-items:center !important; gap:12px !important; min-height:60px !important; padding:10px 54px 10px 16px !important; color:#242424 !important; background:#fff !important; text-align:left !important; font-size:14px !important; font-weight:600 !important; line-height:1.35 !important; text-decoration:none !important; }
    .gts-mm-mobile-root > li > a:hover { color:#216c3c !important; background:#f4f8f5 !important; }
    .gts-mm-root-thumb { display:block !important; flex:0 0 42px; width:42px !important; height:42px !important; padding:3px; object-fit:contain; border-radius:6px; background:#f6f7f6; }
    .gts-mm-mobile-root .gts-mobile-toggle { position:absolute !important; top:50% !important; right:10px !important; transform:translateY(-50%) !important; display:flex !important; align-items:center !important; justify-content:center !important; width:40px !important; height:42px !important; background:transparent !important; color:#267341 !important; border:0 !important; box-shadow:none !important; cursor:pointer !important; z-index:6 !important; }
    .gts-mm-mobile-root .gts-mobile-toggle::before { content:'' !important; width:9px !important; height:9px !important; border-right:2px solid currentColor !important; border-bottom:2px solid currentColor !important; transform:rotate(-45deg) !important; }
    .gts-mm-mobile-root .gts-mobile-toggle::after { display:none !important; }
    .gts-mm-mobile-root .gts-has-mega-menu > .gts-mega-menu { display:none !important; }
    .gts-mm-mobile-root .gts-mm-service-item { background:#f5f7f5 !important; border-top:1px solid #e0e7e0 !important; padding:18px 16px 14px !important; }
    .gts-mm-mobile-root .gts-mm-mobile-service h3 { color:#20663b !important; text-transform:uppercase; font-size:12px !important; letter-spacing:.08em; margin:0 0 8px !important; }
    .gts-mm-mobile-root .gts-mm-mobile-service ul { display:block !important; position:static !important; background:transparent !important; box-shadow:none !important; padding:0 !important; margin:0 !important; }
    .gts-mm-mobile-root .gts-mm-mobile-service li { display:block !important; background:transparent !important; }
    .gts-mm-mobile-root .gts-mm-mobile-service a { display:block !important; padding:11px 0 !important; color:#242424 !important; font-size:13px !important; border-bottom:1px solid #e2e7e2; text-align:left !important; }
    .gts-mm-mobile-root .gts-mm-quicklinks { display:flex !important; justify-content:center; gap:12px; padding:16px !important; background:#fff !important; }
    .gts-mm-mobile-root .gts-mm-quicklinks a { display:block !important; min-height:0 !important; padding:11px 14px !important; border:1px solid #dce6de; border-radius:25px; color:#20663b !important; background:#fff !important; font-size:13px !important; }
    .gts-mm-slide[hidden] { display:none !important; }
    .gts-mm-slide { position:fixed !important; inset:0 auto 0 0 !important; width:min(400px,90vw) !important; height:100dvh !important; background:#fff !important; color:#222 !important; box-shadow:10px 0 40px rgba(0,0,0,.25); z-index:999999 !important; overflow-y:auto !important; overscroll-behavior:contain; text-align:left !important; }
    .gts-mm-slide__top { display:flex; align-items:center; gap:10px; position:sticky; top:0; z-index:2; min-height:62px; padding:10px 14px; background:#fff; border-bottom:1px solid #e5e9e5; box-sizing:border-box; }
    .gts-mm-slide__back, .gts-mm-slide__close { flex:0 0 auto; background:none !important; border:0 !important; color:#267341 !important; font-size:15px !important; padding:9px 5px !important; cursor:pointer; box-shadow:none !important; }
    .gts-mm-slide__close { margin-left:auto; color:#333 !important; font-size:25px !important; }
    .gts-mm-slide__title { font-size:14px; font-weight:700; color:#222; line-height:1.3; }
    .gts-mm-slide__view-all { display:flex !important; align-items:center; justify-content:space-between; padding:17px 18px !important; background:#edf5ef !important; color:#22683d !important; text-decoration:none !important; font-size:14px !important; font-weight:700 !important; }
    .gts-mm-slide__row { display:flex; align-items:center; min-height:65px; border-bottom:1px solid #e9ece9; }
    .gts-mm-slide__link { display:flex !important; align-items:center; flex:1; gap:12px; min-width:0; min-height:65px; padding:10px 16px !important; box-sizing:border-box; background:#fff !important; color:#222 !important; font-size:14px !important; font-weight:600 !important; text-decoration:none !important; }
    .gts-mm-slide__link img { width:45px !important; height:45px !important; flex:0 0 45px; object-fit:contain; border-radius:5px; background:#f6f7f6; }
    .gts-mm-slide__next { display:flex !important; align-items:center; justify-content:center; width:48px !important; height:60px !important; flex:0 0 48px; padding:0 !important; background:#fff !important; border:0 !important; color:#267341 !important; font-size:26px !important; cursor:pointer; box-shadow:none !important; }
    .main-header__burger { order:-1; margin-left:0 !important; margin-right:auto !important; }
}

/* v0.5.4 - Mobile grey bar: left hamburger, right account and basket */
@media (min-width:1024px) { .gts-mm-header-actions { display:none !important; } }
@media (max-width:1023px) {
    .menu_bar .main-header__burger {
        display:flex !important;
        align-items:center !important;
        justify-content:space-between !important;
        width:100% !important;
        min-height:44px;
        box-sizing:border-box;
    }
    .menu_bar .gts-mm-header-actions {
        display:flex !important;
        align-items:center;
        gap:5px;
        margin-left:auto;
    }
    .menu_bar .gts-mm-header-action {
        display:inline-flex !important;
        align-items:center;
        justify-content:center;
        width:44px;
        height:44px;
        padding:0 !important;
        color:var(--brand-main, #267341) !important;
        background:transparent !important;
        text-decoration:none !important;
        font-size:19px;
        line-height:1;
    }
    .menu_bar .gts-mm-header-action:focus-visible {
        outline:2px solid currentColor;
        outline-offset:-3px;
    }
}

/* v0.5.5: keep the mobile shortcut bar grey, independent of menu branding. */
@media (max-width:1023px) {
    .menu_bar, .menu_bar > .container { background-color:#e5e5e5 !important; }
    .menu_bar .main-header__burger { background:transparent !important; }
}
