/* Thanh menu đáy toàn site + panel "Ưu đãi của tôi" (site-footer-menu.php). Kiểu thanh theo .apfm (trang danh mục) + chữ / nút giỏ như sticky trang SP. */

.sfm,
.sfm *,
.hmo,
.hmo * {
    box-sizing: border-box;
}

body.has-sfm {
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
}

/* ---------- Thanh dính đáy ---------- */

.sfm {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9200;
    width: 100%;
    background: #fff;
    box-shadow: 0 -2px 14px rgba(0, 0, 0, 0.12);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Theme cha áp `top: 0` cho mọi `nav` khi site-scrolled + admin-bar (xem product-navigation.css). */
body.site-scrolled.admin-bar #sfm-root {
    top: auto;
}

.sfm__list {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 4px;
    max-width: 640px;
    margin: 0 auto;
    padding: 5px 8px;
    list-style: none;
}

.sfm__item {
    flex: 1 1 0;
    min-width: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.sfm .sfm__link {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    width: 100%;
    height: auto;
    min-height: 52px;
    margin: 0;
    padding: 5px 4px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    box-shadow: none;
    color: #3a3a3a;
    /* Cùng kiểu chữ nút sticky trang SP (.pcn-mobile: Oswald in hoa). */
    font-family: "Oswald", sans-serif;
    font-size: 11px;
    font-weight: var(--default-button-font-weight, 500);
    line-height: 1.2;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.sfm .sfm__link:hover,
.sfm .sfm__link:focus-visible {
    background: #f1f5f3;
    color: #087a5a;
    text-decoration: none;
    outline: none;
}

.sfm .sfm__link.is-current {
    color: var(--default-color-dark-blue, #0047ba);
}

.sfm .sfm__link.is-current::before {
    content: "";
    position: absolute;
    top: -5px;
    left: 30%;
    right: 30%;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: var(--default-color-dark-blue, #0047ba);
}

/* "Nhận ưu đãi" nổi bật nhẹ — điểm đến chính của thanh. */
.sfm__item--offers .sfm__link .sfm__icon {
    color: #c27c00;
}

/* Giỏ hàng chính giữa: ô vuông nổi như nút giỏ ở cụm sticky trang SP (.pcn-mobile__cart). */
.sfm__item--cart {
    flex: 0 0 56px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sfm .sfm__link.sfm__cart {
    width: 48px;
    min-height: 0;
    height: 48px;
    margin-top: -16px;
    padding: 0;
    border: 3px solid #fff;
    border-radius: 8px;
    background: var(--default-color-light-blue, #b0dded);
    box-shadow: 0 4px 12px rgba(0, 71, 186, 0.22);
    color: var(--default-color-dark-blue, #0047ba);
}

.sfm .sfm__link.sfm__cart:hover,
.sfm .sfm__link.sfm__cart:focus-visible {
    background: var(--default-color-dark-blue, #0047ba);
    color: #fff;
}

.sfm__cart .hithean-cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border: 2px solid #fff;
    border-radius: 10px;
    background: #e53935;
    color: #fff;
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
}

.sfm__cart .hithean-cart-count[hidden] {
    display: none;
}

/* Vòng quay đã nằm trong popup "Nhận ưu đãi" (thẻ Quay ngay) — như trang SP, bỏ nút nổi để không chồng lên thanh. */
body.has-sfm.sfm-wheel-in-offers #thean-lw-root .thean-lw-trigger {
    display: none !important;
}

/* Popup "Ưu đãi tiêu biểu": khung .hithean-offers-dialog ở offer-card.css; chỉ thêm dòng tải + nút xem toàn bộ. */
.sfm-offers__loading {
    padding: 20px 0;
    list-style: none;
    font-size: 13px;
    text-align: center;
    opacity: 0.7;
}

.hithean-offers-dialog .hithean-offer-card__action.sfm-offers__all {
    margin: 0 !important;
}

.sfm__icon {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
    width: 22px;
    height: 22px;
}

.sfm__icon svg {
    width: 100%;
    height: 100%;
}

/* 5 mục trên mobile hẹp: nhãn dài ("Ưu đãi của tôi") xuống tối đa 2 dòng thay vì bị cắt. */
.sfm__label {
    display: -webkit-box;
    max-width: 100%;
    overflow: hidden;
    white-space: normal;
    text-align: center;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.sfm__badge {
    position: absolute;
    top: -6px;
    right: -10px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border: 2px solid #fff;
    border-radius: 9px;
    background: #e53935;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 14px;
    text-align: center;
}

.sfm__badge[hidden] {
    display: none;
}

@media (min-width: 768px) {
    .sfm .sfm__link {
        flex-direction: row;
        gap: 8px;
        min-height: 44px;
        font-size: 13px;
        letter-spacing: 0.5px;
    }

    .sfm .sfm__link.sfm__cart {
        height: 44px;
        margin-top: 0;
    }

    .sfm .sfm__link.is-current::before {
        top: -6px;
    }
}

/* ---------- Panel "Ưu đãi của tôi" (dialog; cùng kiểu popup ưu đãi trang sản phẩm) ---------- */

html.hmo-open {
    overflow: hidden;
}

.hmo {
    --ho-ink: var(--default-color-brown, #3b2222);
    --ho-green: #214f3c;
    --ho-cream: var(--default-color-beige, #f7f6f2);
    width: min(520px, calc(100vw - 32px));
    max-height: calc(100dvh - 64px);
    padding: 0;
    border: 0;
    border-radius: 20px;
    background: #fff;
    color: var(--ho-ink);
    box-shadow: 0 20px 60px #3b222233;
    font-size: 14px;
    line-height: 1.55;
    text-align: left;
}

.hmo[open] {
    display: flex;
    flex-direction: column;
}

.hmo::backdrop {
    background: #3b222299;
}

.hmo__head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 20px 24px;
    border-bottom: 1px solid #3b22221c;
}

.hmo__head h3 {
    margin: 0;
    padding: 0;
    color: inherit;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.035em;
    text-transform: none;
}

.hmo__head p {
    margin: 4px 0 0;
    font-size: 13px;
    opacity: 0.7;
}

.hmo .hmo__close {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 1px solid #3b22223a;
    border-radius: 0;
    background: #fff;
    box-shadow: none;
    color: var(--ho-ink);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.hmo__body {
    display: grid;
    gap: 14px;
    padding: 16px;
    overflow-y: auto;
    background: var(--ho-cream);
}

.hmo__status {
    margin: 0;
    font-size: 13px;
    color: var(--ho-green);
}

.hmo__status:empty {
    display: none;
}

.hmo__status.is-error {
    color: #b3261e;
}

.hmo__loading {
    padding: 24px 0;
    text-align: center;
    opacity: 0.7;
}

.hmo__loading[hidden],
.hmo__list[hidden],
.hmo__empty[hidden],
.hmo__auth[hidden],
.hmo__contacts[hidden] {
    display: none;
}

.hmo__empty {
    padding: 18px;
    border: 1px dashed #3b222233;
    border-radius: 16px;
    background: #fff;
    text-align: center;
}

.hmo__empty p {
    margin: 4px 0 0;
    font-size: 13px;
    opacity: 0.75;
}

/* Liên hệ đã tra (chip, bấm × để quên). */
.hmo__contacts {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.hmo__contacts > span {
    opacity: 0.7;
}

.hmo .hmo__chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: auto;
    min-height: 0;
    margin: 0;
    padding: 4px 6px 4px 10px;
    border: 1px solid #3b22222a;
    border-radius: 99px;
    background: #fff;
    box-shadow: none;
    color: var(--ho-ink);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: 0;
    text-transform: none;
    cursor: pointer;
}

.hmo__chip i {
    display: inline-grid;
    place-items: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #3b222214;
    font-style: normal;
}

.hmo__auth {
    display: grid;
    gap: 12px;
    padding: 18px;
    border: 1px solid #3b222210;
    border-radius: 16px;
    background: #fff;
}

.hmo__auth h4 {
    margin: 0;
    color: inherit;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
    text-transform: none;
    letter-spacing: 0;
}

.hmo__login {
    display: grid;
    gap: 8px;
}

.hmo__zalo:empty {
    display: none;
}

.hmo__zalo a,
.hmo__zalo button {
    width: 100%;
}

.hmo .hmo__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: auto;
    min-height: 44px;
    margin: 0;
    padding: 10px 16px;
    border: 2px solid var(--default-color-dark-blue, #0047ba);
    border-radius: 8px;
    background: #fff;
    box-shadow: none;
    color: var(--default-color-dark-blue, #0047ba);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: 0;
    text-align: center;
    text-decoration: none;
    text-transform: none;
    cursor: pointer;
}

.hmo .hmo__btn--primary {
    background: var(--default-color-dark-blue, #0047ba);
    color: #fff;
}

.hmo .hmo__btn:hover {
    background: var(--default-color-light-blue, #b0dded);
    border-color: var(--default-color-light-blue, #b0dded);
    color: var(--default-color-dark-blue, #0047ba);
}

.hmo .hmo__btn:disabled {
    opacity: 0.6;
    cursor: default;
}

.hmo__or {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 12px;
    opacity: 0.65;
}

.hmo__or::before,
.hmo__or::after {
    content: "";
    flex: 1 1 auto;
    height: 1px;
    background: #3b222233;
}

.hmo__lookup {
    display: flex;
    gap: 8px;
    margin: 0;
}

.hmo .hmo__lookup input {
    flex: 1 1 auto;
    min-width: 0;
    height: 44px;
    min-height: 44px;
    margin: 0;
    padding: 0 12px;
    border: 1px solid #3b22223a;
    border-radius: 8px;
    background: #fff;
    box-shadow: none;
    font-size: 15px;
}

/* Nút "Kiểm tra" cao đúng bằng ô nhập, chữ 1 dòng (theme cha ép line-height / padding cho button). */
.hmo .hmo__lookup .hmo__btn {
    flex: 0 0 auto;
    height: 44px;
    min-height: 44px;
    padding: 0 18px;
    border-width: 1px;
    line-height: 1;
    white-space: nowrap;
}

.hmo .hmo__lookup input:focus {
    border-color: var(--default-color-dark-blue, #0047ba);
    outline: none;
}

.hmo__hint {
    margin: 0;
    font-size: 12px;
    opacity: 0.65;
}

.hmo__foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    padding: 14px 24px 18px;
    border-top: 1px solid #3b22221c;
    font-size: 13px;
}

.hmo__foot:empty {
    display: none;
}

.hmo__foot a,
.hmo .hmo__link {
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
    color: var(--default-color-dark-blue, #0047ba);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0;
    text-decoration: none;
    text-transform: none;
    cursor: pointer;
    min-height: 0;
    height: auto;
    line-height: 1.4;
}

/* Thông báo nhanh (sao chép / áp mã). */
.hmo-toast {
    position: fixed;
    left: 50%;
    bottom: calc(80px + env(safe-area-inset-bottom, 0px));
    z-index: 2147483000;
    max-width: calc(100vw - 32px);
    padding: 10px 16px;
    border-radius: 10px;
    background: #1f2a24;
    color: #fff;
    font-size: 13px;
    line-height: 1.4;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    transform: translateX(-50%);
}

@media (max-width: 767px) {
    .hmo {
        width: 100vw;
        max-width: 100vw;
        max-height: calc(100dvh - 24px);
        margin: auto auto 0;
        border-radius: 20px 20px 0 0;
    }

    .hmo__head {
        padding: 16px 18px;
    }

    .hmo__body {
        padding: 12px;
    }

    .hmo__foot {
        padding: 12px 18px calc(14px + env(safe-area-inset-bottom, 0px));
    }
}

@media (prefers-reduced-motion: reduce) {
    .sfm .sfm__link {
        transition: none !important;
    }
}
