/* =========================================================
   MOBILE NAV ENHANCED v1 — Loja da Barba
   Aplica navegação mobile/tablet unificada (≤991px).
   Para reverter: remova ou comente a linha deste arquivo no header.twig
   e o include de mobile_nav.twig no footer.twig.
   ========================================================= */

/* Oculta no desktop */
.mobile-bottom-bar,
#custom-mobile-overlay,
#custom-mobile-drawer {
    display: none !important;
}

/* Screen-reader only label */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 991px) {

    /* Unifica tablet + mobile: esconde hamburger legado */
    header#site-header .mobmenu {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }

    /* Desativa slide-out Bootstrap antigo */
    #menu .navbar-collapse > ul {
        display: none !important;
    }

    /* ── Bottom bar ── */
    .mobile-bottom-bar {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background-color: #FCFBF6;
        box-shadow: 0 -8px 24px rgba(30, 57, 42, 0.09);
        z-index: 99990;
        justify-content: space-between;
        align-items: stretch;
        padding: 6px 10px calc(5px + env(safe-area-inset-bottom, 0px));
        height: calc(74px + env(safe-area-inset-bottom, 0px));
        min-height: 74px;
        border-top: 1px solid #E8E2D6;
        border-radius: 16px 16px 0 0;
        overflow: visible;
    }

    .m-nav-item,
    .m-nav-btn {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        color: #62645F;
        font-size: 10.5px;
        font-weight: 500;
        flex: 1;
        min-width: 0;
        min-height: 44px;
        background: none;
        border: none;
        padding: 5px 2px 4px;
        cursor: pointer;
        font-family: "Lexend", sans-serif;
        line-height: 1.15;
        position: relative;
        -webkit-tap-highlight-color: transparent;
        transition: color 0.18s ease, transform 0.18s ease;
    }

    .m-nav-icon {
        display: block;
        width: 23px;
        height: 23px;
        color: currentColor;
        stroke: currentColor;
        stroke-width: 1.9;
        stroke-linecap: round;
        stroke-linejoin: round;
        vector-effect: non-scaling-stroke;
        transition: color 0.18s ease, transform 0.18s ease;
    }

    .m-nav-icon-wrap {
        position: relative;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 28px;
        height: 25px;
        margin-bottom: 3px;
    }

    .m-nav-label {
        display: block;
        white-space: nowrap;
    }

    .m-nav-item:focus-visible,
    .m-nav-btn:focus-visible {
        outline: 2px solid var(--ldb-gold);
        outline-offset: -2px;
        border-radius: 10px;
    }

    #mobileBottomBar .m-nav-item.active,
    #mobileBottomBar .m-nav-btn.active {
        color: var(--ldb-ink) !important;
        font-weight: 700 !important;
    }

    #mobileBottomBar .m-nav-item.active .m-nav-icon,
    #mobileBottomBar .m-nav-btn.active .m-nav-icon {
        color: var(--ldb-gold) !important;
    }

    #mobileBottomBar .m-nav-item.active::after,
    #mobileBottomBar .m-nav-btn.active::after {
        content: "";
        position: absolute;
        left: 50%;
        bottom: 0;
        width: 18px;
        height: 3px;
        border-radius: 999px;
        background: var(--ldb-gold);
        transform: translateX(-50%);
    }

    .m-nav-item:active .m-nav-icon,
    .m-nav-btn:active .m-nav-icon {
        transform: scale(0.92);
    }

    /* Carrinho elevado */
    .m-nav-cart {
        position: relative;
        padding-top: 0;
        gap: 0;
    }

    .m-nav-cart-button {
        position: relative;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 52px;
        height: 52px;
        flex: 0 0 52px;
        margin-top: -17px;
        border-radius: 16px;
        background-color: var(--ldb-ink);
        border: 3px solid #FCFBF6;
        box-shadow: 0 6px 14px rgba(30, 57, 42, 0.28);
    }

    .m-nav-cart .m-nav-icon {
        color: #ffffff !important;
        width: 23px;
        height: 23px;
    }

    .m-nav-cart .m-nav-label {
        margin-top: 2px;
        color: var(--ldb-ink);
        font-weight: 600;
    }

    .m-cart-badge {
        position: absolute;
        top: -5px;
        right: -5px;
        background-color: var(--ldb-gold);
        color: #111111;
        font-size: 11px;
        font-weight: 800;
        min-width: 19px;
        height: 19px;
        border-radius: 50%;
        display: none;
        align-items: center;
        justify-content: center;
        border: 2px solid #FCFBF6;
        padding: 0 4px;
        line-height: 1;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.22);
    }

    .m-nav-wishlist {
        position: relative;
    }

    .m-wishlist-badge {
        position: absolute;
        top: -4px;
        right: -8px;
        background-color: var(--ldb-gold);
        color: #111111;
        font-size: 11px;
        font-weight: 800;
        min-width: 19px;
        height: 19px;
        border-radius: 50%;
        display: none;
        align-items: center;
        justify-content: center;
        border: 2px solid #FFFFFF;
        padding: 0;
        line-height: 1;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.22);
        z-index: 1;
    }

    body.has-mobile-nav {
        padding-bottom: calc(89px + env(safe-area-inset-bottom, 0px)) !important;
    }

    /* ── Overlay (acima do header sticky z-index 999999) ── */
    #custom-mobile-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.45);
        z-index: 1000000;
        display: none !important;
        opacity: 0;
        transition: opacity 0.24s ease;
        backdrop-filter: blur(2px);
        -webkit-backdrop-filter: blur(2px);
    }

    #custom-mobile-overlay.active {
        display: block !important;
        opacity: 1;
    }

    /* ── Drawer V3 Premium ── */
    #custom-mobile-drawer {
        position: fixed;
        top: 0;
        left: -100%;
        width: 85vw;
        max-width: 420px;
        height: 100%;
        height: 100dvh;
        background-color: #F7F4EC;
        z-index: 1000001;
        box-shadow: 8px 0 28px rgba(0, 0, 0, 0.18);
        transition: left 0.24s cubic-bezier(0.25, 1, 0.5, 1);
        display: flex !important;
        flex-direction: column;
    }

    #custom-mobile-drawer.active {
        left: 0 !important;
    }

    .drawer-header {
        display: flex;
        align-items: center;
        gap: 10px;
        height: 56px;
        min-height: 56px;
        max-height: 56px;
        padding: 0 14px 0 16px;
        background: var(--ldb-ink, #1E392A);
        color: #ffffff;
        flex-shrink: 0;
        box-sizing: border-box;
    }

    .drawer-header-brand {
        display: flex;
        align-items: center;
        flex: 1;
        min-width: 0;
        text-decoration: none;
        color: inherit;
        overflow: hidden;
    }

    .drawer-logo {
        width: auto;
        height: 32px;
        max-height: 34px;
        max-width: 168px;
        object-fit: contain;
        flex-shrink: 0;
    }

    .drawer-logo--filtered {
        filter: brightness(0) invert(1);
    }

    .drawer-logo--native {
        filter: none;
    }

    .drawer-title {
        font-size: 14px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: #fff;
        margin: 0;
        font-family: "Lexend", sans-serif;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .drawer-close {
        background: var(--ldb-gold, #D4AF68);
        color: var(--ldb-ink, #1E392A);
        width: 36px;
        height: 36px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 15px;
        cursor: pointer;
        border: none;
        box-shadow: none;
        flex-shrink: 0;
        margin-left: 2px;
        -webkit-tap-highlight-color: transparent;
    }

    .drawer-close-icon {
        width: 19px;
        height: 19px;
        color: inherit;
        stroke: currentColor;
        stroke-width: 2;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .drawer-close:focus-visible {
        outline: 2px solid #ffffff;
        outline-offset: 2px;
    }

    .drawer-body {
        overflow-y: auto;
        overflow-x: hidden;
        flex: 1 1 auto;
        min-height: 0;
        display: block;
        background-color: #F7F4EC;
        -webkit-overflow-scrolling: touch;
        padding: 10px 12px calc(16px + env(safe-area-inset-bottom, 0px));
    }

    .drawer-categories {
        padding: 0;
        display: flex;
        flex-direction: column;
        gap: 0;
    }

    .drawer-section {
        margin: 0;
        padding: 0;
    }

    .drawer-section + .drawer-section {
        margin-top: 16px;
    }

    .drawer-section-label {
        margin: 2px 4px 8px;
        color: #9A7427;
        font-family: "Lexend", sans-serif;
        font-size: 10px;
        font-weight: 700;
        line-height: 1.2;
        letter-spacing: 0.14em;
        text-transform: uppercase;
    }

    .drawer-section-items,
    .drawer-extras {
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    .drawer-extras {
        margin-top: 12px;
    }

    /* Ícones categoria — bloco creme + traço dourado (V3) */
    .acc-icon-wrap {
        width: 36px;
        height: 36px;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        background: #EFE8D8;
        color: #B8923A;
    }

    .acc-icon-wrap .ldb-mi {
        width: 22px;
        height: 22px;
        color: inherit;
        overflow: visible;
    }

    .acc-icon-wrap .ldb-mi [stroke] {
        vector-effect: non-scaling-stroke;
    }

    .acc-item {
        background: transparent;
        border-radius: 12px;
        margin: 0;
        box-shadow: none;
        border: none;
        overflow: hidden;
    }

    .acc-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        min-height: 56px;
        padding: 10px 12px;
        color: var(--ldb-ink, #1E392A);
        font-size: 13px;
        font-weight: 700;
        cursor: pointer;
        background: #FFFdf8;
        border: 1px solid rgba(30, 57, 42, 0.06);
        border-radius: 12px;
        text-align: left;
        font-family: "Lexend", sans-serif;
        gap: 8px;
        box-shadow: 0 1px 3px rgba(30, 57, 42, 0.04);
        -webkit-tap-highlight-color: transparent;
        transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
    }

    .acc-item.active .acc-header {
        background: var(--ldb-ink, #1E392A);
        color: #ffffff;
        border-color: transparent;
        border-radius: 12px 12px 0 0;
        box-shadow: none;
    }

    .acc-header-label {
        display: flex;
        align-items: center;
        gap: 12px;
        min-width: 0;
        flex: 1;
    }

    .acc-name {
        font-size: 12.5px;
        font-weight: 700;
        color: inherit;
        line-height: 1.25;
        text-transform: uppercase;
        letter-spacing: 0.04em;
    }

    .acc-item.active .acc-icon-wrap {
        background: rgba(212, 175, 104, 0.22);
        color: #E8C97A;
    }

    .acc-arrow-wrap {
        width: 22px;
        height: 22px;
        border-radius: 0;
        background: transparent;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    .acc-header .acc-arrow {
        color: #B8923A;
        transform: rotate(90deg);
        transition: transform 0.18s ease, color 0.18s ease;
    }

    .drawer-arrow-icon,
    .drawer-long-arrow {
        display: block;
        flex-shrink: 0;
        stroke: currentColor;
        stroke-width: 1.9;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .drawer-arrow-icon {
        width: 15px;
        height: 15px;
    }

    .drawer-long-arrow {
        width: 17px;
        height: 17px;
    }

    .acc-item.active .acc-arrow {
        transform: rotate(-90deg);
        color: #E8C97A;
    }

    .acc-header:focus-visible {
        outline: 2px solid var(--ldb-gold, #D4AF68);
        outline-offset: 2px;
    }

    .acc-content {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.24s cubic-bezier(0.25, 1, 0.5, 1);
    }

    .acc-item.active .acc-content {
        max-height: 920px;
    }

    .acc-content-inner {
        padding: 4px 6px 10px;
        background: #F3EBDA;
        border-top: none;
        border-radius: 0 0 12px 12px;
    }

    .acc-child-link {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 11px 10px;
        margin: 0;
        color: #3a3a3a;
        text-decoration: none;
        font-size: 13.5px;
        font-weight: 400;
        border-radius: 0;
        font-family: "Lexend", sans-serif;
        border-bottom: 1px solid rgba(30, 57, 42, 0.08);
        transition: color 0.15s ease, background 0.15s ease;
    }

    .acc-child-link:last-of-type {
        border-bottom: none;
    }

    .acc-child-link:active {
        background: rgba(255, 255, 255, 0.35);
        color: var(--ldb-ink, #1E392A);
    }

    .acc-child-name {
        flex: 1;
        line-height: 1.35;
        text-transform: none;
        letter-spacing: 0;
        font-weight: 400;
    }

    .acc-child-arrow {
        color: #C4B89A;
        flex-shrink: 0;
    }

    .acc-see-all {
        display: flex !important;
        align-items: center;
        justify-content: flex-start;
        gap: 8px;
        margin: 6px 4px 2px;
        padding: 10px 8px !important;
        border-radius: 0 !important;
        background: transparent !important;
        color: #B8923A !important;
        font-size: 11.5px !important;
        font-weight: 700 !important;
        text-transform: uppercase !important;
        letter-spacing: 0.05em;
        text-decoration: none !important;
        font-family: "Lexend", sans-serif;
    }

    .acc-see-all .drawer-long-arrow {
        color: inherit !important;
    }

    .drawer-link-flat {
        display: flex;
        align-items: center;
        gap: 12px;
        min-height: 56px;
        padding: 10px 12px;
        margin: 0;
        color: var(--ldb-ink, #1E392A);
        text-decoration: none;
        font-size: 12.5px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        background: #FFFdf8;
        border-radius: 12px;
        border: 1px solid rgba(30, 57, 42, 0.06);
        box-shadow: 0 1px 3px rgba(30, 57, 42, 0.04);
        font-family: "Lexend", sans-serif;
    }

    .drawer-flat-arrow {
        margin-left: auto;
        color: #B8923A;
    }

    .drawer-link-highlight {
        display: flex;
        align-items: center;
        gap: 12px;
        margin: 10px 0 0;
        padding: 14px 14px;
        min-height: 54px;
        color: var(--ldb-ink, #1E392A);
        text-decoration: none;
        font-size: 14px;
        font-weight: 600;
        background: #F6F1DF;
        border: 1px solid rgba(184, 146, 58, 0.45);
        border-radius: 12px;
        font-family: "Lexend", sans-serif;
        box-shadow: none;
    }

    .drawer-highlight-icon {
        width: 34px;
        height: 34px;
        border-radius: 9px;
        background: rgba(184, 146, 58, 0.18);
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        color: #B8923A;
    }

    .drawer-highlight-icon .ldb-mi {
        width: 18px;
        height: 18px;
        color: inherit;
    }

    .drawer-highlight-text {
        flex: 1;
        line-height: 1.2;
    }

    .drawer-highlight-arrow {
        margin-left: auto;
        color: #B8923A;
    }

    .drawer-footer-actions {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0;
        background: #F3EBDA;
        padding: 14px 6px 12px;
        margin-top: 12px;
        border-top: 1px solid rgba(30, 57, 42, 0.08);
        border-radius: 12px;
    }

    .action-link {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        gap: 6px;
        padding: 6px 4px;
        color: var(--ldb-ink, #1E392A);
        text-decoration: none;
        font-size: 10px;
        font-weight: 500;
        font-family: "Lexend", sans-serif;
        text-align: center;
        line-height: 1.25;
        border-right: 1px solid rgba(30, 57, 42, 0.08);
        -webkit-tap-highlight-color: transparent;
    }

    .action-link:last-child {
        border-right: none;
    }

    .drawer-action-icon-wrap {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 34px;
        height: 34px;
        flex: 0 0 34px;
        border-radius: 10px;
        background: #FFFDF8;
        border: 1px solid rgba(184, 146, 58, 0.24);
        color: var(--ldb-ink, #1E392A);
    }

    .drawer-action-icon {
        display: block;
        width: 20px;
        height: 20px;
        stroke: currentColor;
        stroke-width: 1.8;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .action-link span {
        max-width: 100%;
    }

    #custom-mobile-drawer.is-swiping {
        will-change: transform;
    }

    #custom-mobile-overlay.is-swiping {
        will-change: opacity;
    }

    /* Telas baixas: compactação extra */
    @media (max-height: 700px) {
        .drawer-header { height: 52px; min-height: 52px; max-height: 52px; }
        .drawer-logo { height: 28px; max-height: 30px; }
        .acc-header { min-height: 50px; padding: 8px 10px; }
        .acc-icon-wrap { width: 32px; height: 32px; }
        .acc-icon-wrap .ldb-mi { width: 18px; height: 18px; }
        .acc-child-link { padding: 9px 8px; }
        .action-link { font-size: 9px; }
    }
}

/* Tablet */
@media (min-width: 768px) and (max-width: 991px) {
    body.has-mobile-nav {
        padding-bottom: 84px !important;
    }
}
