/* Commerce navbar — มือถือ/แท็บเล็ต (<1200) = compact เหมือนมือถือ | Desktop (≥1200) = แถบเต็ม */

.commerce-head-compact {
    display: none;
    width: 100%;
    padding: 12px 14px 0;
    position: relative;
    z-index: 12;
    box-sizing: border-box;
}

.commerce-head-compact__row {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 12px;
    min-height: 44px;
    width: 100%;
    position: relative;
    z-index: 15;
}

.commerce-head-compact__brand {
    flex: 1 1 auto;
    min-width: 0;
    max-width: calc(100% - 56px);
    padding-top: 2px;
}

.commerce-head-compact__brand .navbar-brand {
    display: block;
    padding: 0;
    margin: 0;
}

.commerce-head-compact__brand .logo {
    display: block;
    max-height: 40px;
    width: auto;
    max-width: min(160px, 100%);
    object-fit: contain;
}

.commerce-head-compact__actions {
    position: relative;
    flex: 0 0 auto;
    min-width: 48px;
    width: 48px;
    height: 48px;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    overflow: visible;
    z-index: 14;
}

nav.commerce-nav-strip {
    position: absolute;
    right: 0;
    top: calc(100% + 12px);
    bottom: auto;
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
    justify-content: stretch;
    gap: 10px;
    width: min(232px, calc(100vw - 28px));
    max-width: min(232px, calc(100vw - 28px));
    padding: 14px;
    overflow: visible;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 18;
    transform: translateY(-6px);
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.95) 100%);
    border: 1px solid rgba(226, 232, 240, 0.92);
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.18);
    transition: transform 0.22s ease, opacity 0.18s ease, visibility 0.18s ease;
}

nav.commerce-nav-strip::before {
    content: "";
    position: absolute;
    top: -8px;
    right: 14px;
    width: 16px;
    height: 16px;
    border-radius: 4px;
    background: inherit;
    border-top: 1px solid rgba(226, 232, 240, 0.92);
    border-left: 1px solid rgba(226, 232, 240, 0.92);
    transform: rotate(45deg);
    box-sizing: border-box;
}

nav.commerce-nav-strip.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

nav.commerce-nav-strip > form {
    display: none !important;
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.commerce-nav-strip__btn {
    flex: 0 0 auto;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 62px;
    min-height: 72px;
    padding: 8px 6px 7px;
    gap: 6px;
    border-radius: 18px;
    color: #ef4444 !important;
    text-decoration: none;
    font-size: 1.05rem;
    line-height: 1;
    cursor: pointer;
    justify-self: center;
    background: linear-gradient(180deg, #ffffff 0%, #fef2f2 100%);
    border: 1px solid rgba(252, 165, 165, 0.45);
    box-shadow: 0 10px 18px rgba(248, 113, 113, 0.12);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}

.commerce-nav-strip__btn:hover,
.commerce-nav-strip__btn:focus {
    transform: translateY(-1px);
    border-color: rgba(248, 113, 113, 0.55);
    box-shadow: 0 14px 22px rgba(248, 113, 113, 0.18);
    text-decoration: none;
}

.commerce-nav-strip__label {
    display: block;
    width: 100%;
    max-width: 100%;
    color: #475569;
    font-size: 0.56rem;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    white-space: normal;
    word-break: break-word;
    letter-spacing: 0.01em;
}

.commerce-nav-strip__btn[data-tooltip]::before,
.commerce-nav-strip__btn[data-tooltip]::after {
    position: absolute;
    left: 50%;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.18s ease, visibility 0.18s ease, transform 0.18s ease;
    z-index: 5;
}

.commerce-nav-strip__btn[data-tooltip]::before {
    content: "";
    bottom: calc(100% + 6px);
    width: 12px;
    height: 12px;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 4px;
    border-left: 1px solid rgba(226, 232, 240, 0.92);
    border-top: 1px solid rgba(226, 232, 240, 0.92);
    transform: translateX(-50%) rotate(45deg) translateY(6px);
}

.commerce-nav-strip__btn[data-tooltip]::after {
    content: attr(data-tooltip);
    bottom: calc(100% + 14px);
    min-width: 74px;
    max-width: 132px;
    padding: 8px 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(226, 232, 240, 0.92);
    color: #0f172a;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1.25;
    text-align: center;
    white-space: normal;
    box-shadow: 0 16px 28px rgba(15, 23, 42, 0.16);
    transform: translateX(-50%) translateY(6px);
}

.commerce-nav-strip__btn[data-tooltip]:hover::before,
.commerce-nav-strip__btn[data-tooltip]:hover::after,
.commerce-nav-strip__btn[data-tooltip]:focus-visible::before,
.commerce-nav-strip__btn[data-tooltip]:focus-visible::after {
    opacity: 1;
    visibility: visible;
}

.commerce-nav-strip__btn[data-tooltip]:hover::before,
.commerce-nav-strip__btn[data-tooltip]:focus-visible::before {
    transform: translateX(-50%) rotate(45deg) translateY(0);
}

.commerce-nav-strip__btn[data-tooltip]:hover::after,
.commerce-nav-strip__btn[data-tooltip]:focus-visible::after {
    transform: translateX(-50%) translateY(0);
}

nav.navbar .commerce-nav-strip__btn i,
.commerce-nav-strip__btn i {
    color: #ef4444 !important;
    -webkit-text-fill-color: #ef4444 !important;
    font-size: 1.12rem;
}

.commerce-nav-strip__btn--line i {
    color: #22c55e !important;
    -webkit-text-fill-color: #22c55e !important;
}

.commerce-nav-strip__badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 16px;
    border: 2px solid #fff;
}

.commerce-nav-burger {
    position: relative;
    z-index: 3;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 245, 243, 0.96) 100%);
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.14);
}

.commerce-nav-burger i {
    color: #ef4444 !important;
    -webkit-text-fill-color: #ef4444 !important;
}

.commerce-head-compact__search {
    width: 100%;
    padding: 12px 0 14px;
    position: relative;
    z-index: 1;
}

/* ---- Navbar only: ไม่ใช้ .head-dt/.head-mo (กันไม่ให้ซ่อนเนื้อหา index) ---- */
nav[data-theme-role="navbar"] .commerce-head-dt {
    display: none;
}

@media (max-width: 1199.98px) {
    nav[data-theme-role="navbar"] .commerce-head-dt {
        display: none !important;
    }

    nav[data-theme-role="navbar"] .commerce-head-compact {
        display: block !important;
    }

    nav[data-theme-role="navbar"] .commerce-nav-strip__btn[data-tooltip]::before,
    nav[data-theme-role="navbar"] .commerce-nav-strip__btn[data-tooltip]::after {
        display: none !important;
        content: none !important;
    }

    nav[data-theme-role="navbar"] form.commerce-search-form,
    nav[data-theme-role="navbar"] form.input-group.search-top-mo {
        width: 100% !important;
        max-width: 100%;
        height: 48px !important;
        display: flex !important;
        flex-wrap: nowrap;
        margin: 0;
        border-radius: 16px;
        overflow: hidden;
        background: #fff !important;
        border: 1px solid rgba(255, 255, 255, 0.62);
        box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
    }

    nav[data-theme-role="navbar"] .commerce-search-form__input {
        flex: 1 1 auto;
        min-width: 0;
        height: 48px !important;
        border: none !important;
        border-radius: 0 !important;
        font-size: 0.98rem;
        padding-left: 16px;
    }

    nav[data-theme-role="navbar"] .commerce-search-form__camera,
    nav[data-theme-role="navbar"] .btn-search-img {
        flex: 0 0 48px;
        position: static !important;
        margin: 0 !important;
        top: auto !important;
        height: 48px !important;
        border-left: 1px solid #e8edf3;
        border-radius: 0;
    }

    nav[data-theme-role="navbar"] .commerce-search-form__submit,
    nav[data-theme-role="navbar"] .btn-search-top {
        flex: 0 0 auto;
        min-width: 74px;
        height: 48px !important;
        position: static !important;
        border-radius: 0;
        font-weight: 700;
    }
}

@media (min-width: 1200px) {
    nav[data-theme-role="navbar"] .commerce-head-compact {
        display: none !important;
    }

    nav[data-theme-role="navbar"] .commerce-head-dt {
        display: flex !important;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: space-between;
        gap: 12px 20px;
        width: 100%;
        max-width: 100%;
        padding: 10px 24px 14px;
        box-sizing: border-box;
        float: none;
    }

    nav[data-theme-role="navbar"] .commerce-head-dt > [class*="col-"] {
        float: none !important;
        margin: 0 !important;
        padding: 0;
        width: auto;
    }

    nav[data-theme-role="navbar"] .commerce-head-dt__brand {
        flex: 0 0 auto;
        max-width: 200px;
    }

    nav[data-theme-role="navbar"] .commerce-head-dt__brand .logo {
        max-height: 48px;
    }

    nav[data-theme-role="navbar"] .commerce-head-dt__search {
        flex: 1 1 320px;
        min-width: 0;
        display: flex;
        justify-content: center;
    }

    nav[data-theme-role="navbar"] .commerce-head-dt__nav {
        flex: 0 0 auto;
        display: flex !important;
        flex-wrap: nowrap;
        align-items: center;
        gap: 8px;
    }

    nav[data-theme-role="navbar"] .commerce-nav-dt-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 42px;
        height: 42px;
        border: 1px solid rgba(255, 255, 255, 0.45);
        border-radius: 11px;
        background: rgba(255, 255, 255, 0.22);
        text-decoration: none;
        flex-shrink: 0;
    }

    nav[data-theme-role="navbar"] .commerce-nav-dt-btn i {
        font-size: 1.2rem !important;
        color: #fff !important;
        -webkit-text-fill-color: #fff !important;
    }

    nav[data-theme-role="navbar"] form.commerce-search-form,
    nav[data-theme-role="navbar"] form.input-group.search-top {
        width: 100% !important;
        max-width: 580px;
        height: 44px !important;
        display: flex !important;
        flex-wrap: nowrap;
        margin: 0 auto;
        border-radius: 10px;
        overflow: hidden;
        background: #fff !important;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    }

    nav[data-theme-role="navbar"] .commerce-search-form__input {
        flex: 1 1 auto;
        min-width: 0;
        height: 44px !important;
        border: none !important;
        border-radius: 0 !important;
    }

    nav[data-theme-role="navbar"] .commerce-search-form__camera,
    nav[data-theme-role="navbar"] .btn-search-img {
        flex: 0 0 44px;
        position: static !important;
        margin: 0 !important;
        top: auto !important;
        height: 44px !important;
        border-left: 1px solid #e8edf3;
        border-radius: 0;
    }

    nav[data-theme-role="navbar"] .commerce-search-form__submit,
    nav[data-theme-role="navbar"] .btn-search-top {
        flex: 0 0 auto;
        min-width: 76px;
        height: 44px !important;
        position: static !important;
        border-radius: 0;
    }
}

@media (max-width: 480px) {
    .commerce-nav-strip__btn {
        width: 55px;
        min-height: 55px;
    }

    nav.commerce-nav-strip,
    nav.commerce-nav-strip.is-open {
        width: min(218px, calc(100vw - 24px));
        max-width: min(218px, calc(100vw - 24px));
    }
}
