/**
 * Menu điện thoại toàn màn hình (v5.1.51).
 * Nền #faf8f4, chữ #181c23, Poppins in hoa giãn chữ, mũi tên vàng mảnh,
 * khối Currency / Area unit (assets/js/mobile-menu.js chèn vào), cờ ngôn ngữ 1 hàng.
 * Mọi selector bắt đầu bằng #mobilewrapper_links để thắng CSS theme + style inline.
 */

/* ---- Toàn màn hình ---- */
#mobilewrapper_links {
    width: 100% !important;
    animation: huongMmIn .18s ease-out;
}
/* iPhone (Safari thanh địa chỉ nổi ở đáy): 100% / 100vh dừng phía trên thanh công cụ → hở đáy.
   Dùng chiều cao viewport lớn nhất (lvh) để menu phủ cả phần sau thanh công cụ. */
@supports (height: 100lvh) {
    #mobilewrapper_links {
        height: 100lvh !important;
        min-height: 100lvh !important;
        max-height: none !important;
        bottom: auto !important;
    }
}
html.huong-mm-open,
html.huong-mm-open body {
    background-color: #faf8f4;
}
/* Safari iOS 26 không cho lớp fixed phủ xuống dưới thanh địa chỉ nổi → phần trang phía sau lộ ra ở đáy.
   Khi menu mở: ẩn trang và các nút nổi (yêu thích, lên đầu trang, so sánh...) → đáy chỉ còn nền kem. */
html.huong-mm-open body > *:not(.slideout-menu) {
    opacity: 0;
}
@keyframes huongMmIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}
/* Slideout đẩy trang sang phải 256px khi mở menu → giữ trang đứng yên phía sau. */
html.huong-mm-open #all_wrapper {
    transform: none !important;
}
html.huong-mm-open,
html.huong-mm-open body {
    overflow: hidden;
}
#mobilewrapper_links .snap-drawer {
    width: 100%;
    box-sizing: border-box;
    /* Chừa chỗ cho thanh công cụ Safari + vùng an toàn đáy để mục cuối cuộn lên được */
    padding: 0 32px calc(96px + env(safe-area-inset-bottom, 0px));
    background: #faf8f4;
    color: #181c23;
    font-family: 'Poppins', sans-serif;
}

/* ---- Nút đóng: X mảnh ---- */
#mobilewrapper_links .mobilemenu-close {
    top: 14px;
    right: 18px;
    width: 44px;
    height: 44px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
#mobilewrapper_links .mobilemenu-close i {
    display: none;
}
#mobilewrapper_links .mobilemenu-close::before {
    content: "";
    width: 20px;
    height: 20px;
    background: #181c23;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M2 2L18 18M18 2L2 18' stroke='%23000' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M2 2L18 18M18 2L2 18' stroke='%23000' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ---- Danh sách menu ---- */
#mobilewrapper_links .mobilex-menu {
    margin-top: 80px;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}
#mobilewrapper_links .mobilex-menu li {
    font-weight: 400;
    border-bottom: 0;
}
#mobilewrapper_links .mobilex-menu > li {
    flex: 0 0 100%;
    border-bottom: 1px solid #e8e1d7;
}
#mobilewrapper_links .mobilex-menu li a,
#mobilewrapper_links .mobilex-menu li:hover a,
#mobilewrapper_links .mobilex-menu li a:not([href]) {
    background: transparent;
    color: #181c23;
}
#mobilewrapper_links .mobilex-menu > li > a {
    min-height: 64px;
    padding: 18px 40px 18px 8px;
    box-sizing: border-box;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.4;
    text-transform: uppercase;
    letter-spacing: .18em;
    transition: none;
}

/* Menu con cấp 2, cấp 3 */
#mobilewrapper_links .mobilex-menu .sub-menu {
    padding: 0 0 14px 8px;
}
#mobilewrapper_links .mobilex-menu .sub-menu li,
#mobilewrapper_links .mobilex-menu .sub-menu ul li,
#mobilewrapper_links .mobilex-menu .sub-menu ul li:hover {
    padding-left: 0;
    border-bottom: 0;
}
#mobilewrapper_links .mobilex-menu .sub-menu a,
#mobilewrapper_links .mobilex-menu .sub-menu a:not([href]),
#mobilewrapper_links .mobilex-menu .sub-menu ul li:hover > a {
    min-height: 44px;
    padding: 10px 36px 10px 0 !important;
    box-sizing: border-box;
    font-size: 14px;
    font-weight: 400;
    line-height: 20px;
    text-transform: none;
    letter-spacing: 0;
    color: #4a4f57;
    transition: none;
}
#mobilewrapper_links .mobilex-menu .sub-menu .sub-menu {
    margin: 0 0 6px 2px;
    padding: 0 0 0 16px;
    border-left: 1px solid #e8e1d7;
}
#mobilewrapper_links .mobilex-menu .sub-menu .sub-menu a {
    min-height: 40px;
    font-size: 13px;
}

/* Mũi tên: thay icon Font Awesome đậm bằng chevron mảnh màu vàng, xoay khi mở */
#mobilewrapper_links .mobilex-menu .menu-item-has-children > a::after {
    content: "";
    font-family: inherit;
    position: absolute;
    top: 50%;
    right: 4px;
    width: 18px;
    height: 18px;
    margin: -9px 0 0;
    background: #a8854f;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath d='M4 7l5 5 5-5' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath d='M4 7l5 5 5-5' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
    transition: transform .16s ease;
}
#mobilewrapper_links .mobilex-menu > li.menu-item-has-children > a::after {
    top: 32px; /* giữa hàng 64px, không nhảy khi menu con mở */
}
#mobilewrapper_links .mobilex-menu .sub-menu .menu-item-has-children > a::after {
    top: 22px;
    width: 14px;
    height: 14px;
    margin-top: -7px;
}
#mobilewrapper_links .mobilex-menu li.huong-open > a::after {
    transform: rotate(180deg);
}

/* ---- Khối Currency / Area unit ---- */
#mobilewrapper_links .mobilex-menu > li.huong-mm-prefs {
    border-bottom: 0;
    padding: 28px 0 8px;
}
.huong-mm-prefs__row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.huong-mm-prefs__btn {
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 14px;
    background: transparent;
    border: 1px solid #e8e1d7;
    border-radius: 0;
    color: #181c23;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.huong-mm-prefs__btn[aria-expanded="true"] {
    border-color: #a8854f;
}
.huong-mm-prefs__label {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.huong-mm-prefs__title {
    font-size: 10px;
    font-weight: 500;
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: .16em;
    color: #6b6458;
}
.huong-mm-prefs__value {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
}
.huong-mm-prefs__chev {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    background: #a8854f;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath d='M4 7l5 5 5-5' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath d='M4 7l5 5 5-5' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
    transition: transform .16s ease;
}
.huong-mm-prefs__btn[aria-expanded="true"] .huong-mm-prefs__chev {
    transform: rotate(180deg);
}
.huong-mm-prefs__panel {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    margin-top: 12px;
    padding: 12px;
    background: #ffffff;
    border: 1px solid #e8e1d7;
}
.huong-mm-prefs__panel[hidden] {
    display: none;
}
.huong-mm-prefs__opt {
    min-height: 40px;
    padding: 0 4px;
    background: #faf8f4;
    border: 1px solid #e8e1d7;
    border-radius: 0;
    color: #181c23;
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}
.huong-mm-prefs__opt[aria-pressed="true"] {
    background: #181c23;
    border-color: #181c23;
    color: #faf8f4;
}
/* Đang đổi tiền tệ / đơn vị: ô kia mờ đi, ô vừa chọn hiện spinner nhỏ thay cho mũi tên */
.huong-mm-prefs.is-loading {
    pointer-events: none;
}
.huong-mm-prefs.is-loading .huong-mm-prefs__btn:not(.is-busy) {
    opacity: .4;
}
.huong-mm-prefs__btn.is-busy {
    border-color: #a8854f;
}
.huong-mm-prefs__btn.is-busy .huong-mm-prefs__chev {
    width: 16px;
    height: 16px;
    background: none;
    -webkit-mask: none;
            mask: none;
    border: 1.5px solid #e8e1d7;
    border-top-color: #a8854f;
    border-radius: 50%;
    box-sizing: border-box;
    transform: none;
    animation: huongMmSpin .7s linear infinite;
}
@keyframes huongMmSpin {
    to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
    .huong-mm-prefs__btn.is-busy .huong-mm-prefs__chev {
        animation-duration: 2s;
    }
}

/* ---- Cờ ngôn ngữ (WPML) xếp 1 hàng ở giữa, vạch ngăn vàng ---- */
#mobilewrapper_links .mobilex-menu > li.wpml-ls-menu-item {
    flex: 0 0 auto;
    border-bottom: 0;
    margin-top: 20px;
}
#mobilewrapper_links .mobilex-menu > li.wpml-ls-first-item {
    margin-left: auto;
}
#mobilewrapper_links .mobilex-menu > li.wpml-ls-last-item {
    margin-right: auto;
}
#mobilewrapper_links .mobilex-menu > li.wpml-ls-menu-item + li.wpml-ls-menu-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 1px;
    height: 22px;
    margin-top: -11px;
    background: #c2a372;
}
#mobilewrapper_links .mobilex-menu > li.wpml-ls-menu-item > a {
    min-height: 44px;
    padding: 10px 20px;
    justify-content: center;
}
#mobilewrapper_links .mobilex-menu > li.wpml-ls-menu-item img {
    width: 24px;
    height: auto;
    margin: 0;
}
