/**
 * Mega menu v2 — reset legacy rsmenu + layout 3 คอลัมน์ตาม mockup
 * Panel อยู่ภายใต้ .box-layout (ไม่ใช่ใน <li>) เพื่อกว้างเต็มแถบเมนู
 */

/* ── Reset legacy mega-menu rules ── */
body .full-width-header .rs-header .menu-area .box-layout > .mega-menu.mm-v2,
body .full-width-header .rs-header .menu-area .box-layout > .mega-menu.mm-v2 * {
    box-sizing: border-box;
}

body .full-width-header .rs-header .menu-area .box-layout > .mega-menu.mm-v2 {
    float: none !important;
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    min-width: 0 !important;
    background: #fff !important;
    text-align: left !important;
}

body .full-width-header .rs-header .menu-area .box-layout > .mega-menu.mm-v2 a:not(.mm-v2__cat):not(.mm-v2__card):not(.mm-v2__btn) {
    display: flex;
    height: auto !important;
    line-height: inherit !important;
    text-transform: none !important;
    padding: 0;
}

body .full-width-header .rs-header .menu-area .box-layout > .mega-menu.mm-v2 a.mm-v2__cat {
    display: flex;
    align-items: center;
    height: auto !important;
    line-height: inherit !important;
    text-transform: none !important;
    padding: 0.55rem 0.4rem 0.65rem;
}

body .full-width-header .rs-header .menu-area .box-layout > .mega-menu.mm-v2 h3 {
    float: none !important;
}

/* ── Panel shell (desktop) ── */
@media (min-width: 992px) {
    body .full-width-header .rs-header .menu-area .box-layout {
        position: relative;
        overflow: visible;
    }

    body .full-width-header .rs-header .menu-area .box-layout > .mega-menu.mm-v2 {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        width: 100%;
        z-index: 120;
        border-radius: 0 0 12px 12px;
        overflow: hidden;
        box-shadow: 0 16px 40px rgba(16, 42, 67, 0.14);
    }

    body .full-width-header .rs-header .menu-area .box-layout > .mega-menu.mm-v2.is-open {
        display: block;
    }
}

@media (max-width: 991.98px) {
    body .full-width-header .rs-header .menu-area .box-layout > .mega-menu.mm-v2 {
        display: none !important;
    }
}

/* ── Grid 3 คอลัมน์ ── */
.mm-v2__layout {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr) 280px;
    align-items: stretch;
    min-height: 530px;
}

.mm-v2__col {
    min-width: 0;
}

/* ── หัวข้อคอลัมน์ ── */
.mm-v2__title {
    position: relative;
    margin: 0 0 0.75rem;
    padding: 1.25rem 1.25rem 0.65rem;
    padding-bottom: calc(0.65rem + 6px);
    color: #102a43 !important;
}

.mm-v2__title::after {
    content: "";
    position: absolute;
    left: 1.25rem;
    bottom: 0;
    width: 42px;
    height: 3px;
    border-radius: 2px;
    background: var(--v2-header-menu-accent, #1a4a9a);
}

/* ── คอลัมน์ 1: หมวดหมู่ ── */
.mm-v2__col--cats {
    border-right: 1px solid #e6ecf3;
}

.mm-v2__cats {
    display: flex;
    flex-direction: column;
    gap: 0;
    max-height: 460px;
    overflow-y: auto;
    padding: 0.15rem 1.25rem 1rem;
    scrollbar-width: thin;
    scrollbar-color: #c5d5ea transparent;
}

.mm-v2__cat-group {
    border-bottom: 1px solid #e8edf3;
}

.mm-v2__cat-group:last-child {
    border-bottom: 0;
}

.mm-v2__cat-group.is-active {
    background: rgba(26, 74, 154, 0.03);
}

.mm-v2__cat-group-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    width: 100%;
    padding: 0.55rem 0.4rem 0.65rem;
    border: 0;
    background: transparent;
    cursor: pointer;
    font: inherit;
    text-align: left;
    color: #102a43 !important;
    text-decoration: none !important;
    border-bottom: 1px solid #e8edf3;
    transition: color 0.15s ease, background 0.15s ease;
}

.mm-v2__cat-group-head .mm-v2__cat-icon {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
}

.mm-v2__cat-group-head:hover,
.mm-v2__cat-group-head.is-active {
    color: var(--v2-header-menu-accent, #1a4a9a) !important;
}

.mm-v2__cat-group-label {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.mm-v2__cat-group-th {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: 0.01em;
    color: inherit !important;
}

.mm-v2__cat-group-en {
    font-size: 12px;
    font-weight: 500;
    line-height: 1.3;
    color: #5b6b8c !important;
}

.mm-v2__cat-group-meta {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: #8fa3bf;
    font-size: 13px;
}

.mm-v2__cat-group-chevron {
    transition: transform 0.15s ease, color 0.15s ease;
}

.mm-v2__cat-group.is-expanded .mm-v2__cat-group-chevron {
    transform: rotate(180deg);
    color: var(--v2-header-menu-accent, #1a4a9a);
}

.mm-v2__cat-group-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: rgba(26, 74, 154, 0.08);
    color: var(--v2-header-menu-accent, #1a4a9a);
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
}

.mm-v2__cat-children {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0 0 0.35rem 0.15rem;
}

.mm-v2__cat-children[hidden] {
    display: none !important;
}

.mm-v2__cat--child {
    padding: 0.45rem 0.35rem 0.5rem 0.55rem !important;
    border-bottom: 0 !important;
    border-radius: 6px;
}

.mm-v2__cat--child .mm-v2__cat-icon {
    flex-basis: 44px;
    width: 44px;
    height: 44px;
}

.mm-v2__cat--child .mm-v2__cat-th {
    font-size: 14px;
    font-weight: 600;
}

.mm-v2__cat--child .mm-v2__cat-en {
    font-size: 12px;
}

.mm-v2__cat--child + .mm-v2__cat--child {
    margin-top: 0.1rem;
}

.mm-v2__cat {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    width: 100%;
    padding: 0.55rem 0.4rem 0.65rem;
    color: #102a43 !important;
    text-decoration: none !important;
    border-bottom: 1px solid #e8edf3;
    transition: background 0.15s ease, color 0.15s ease;
}

.mm-v2__cats .mm-v2__cat:last-child {
    border-bottom: 0;
}

.mm-v2__cat:hover,
.mm-v2__cat.is-active {
    background: rgba(26, 74, 154, 0.05);
}

.mm-v2__cat:hover .mm-v2__cat-chevron,
.mm-v2__cat.is-active .mm-v2__cat-chevron {
    color: var(--v2-header-menu-accent, #1a4a9a);
}

.mm-v2__cat-icon {
    flex: 0 0 60px;
    width: 60px;
    height: 60px;
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
    border: 1px solid #e3eaf2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.mm-v2__cat-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
}

.mm-v2__cat-icon .fa {
    font-size: 22px;
    color: var(--v2-header-menu-accent, #1a4a9a);
}

.mm-v2__cat-label {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.mm-v2__cat-th {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
    color: #102a43 !important;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mm-v2__cat-en {
    font-size: 13px;
    font-weight: 400;
    line-height: 1.35;
    color: #5b6b8c !important;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mm-v2__cat-chevron {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    margin-left: 0.35rem;
    color: #8fa3bf;
    font-size: 18px;
    line-height: 1;
    transition: color 0.15s ease, transform 0.15s ease;
}

.mm-v2__cat:hover .mm-v2__cat-chevron {
    transform: translateX(2px);
}


/* ── คอลัมน์ 2: สินค้าแนะนำ ── */
.mm-v2__col--products {
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e6ecf3;
    padding-bottom: 0.65rem;
    background: #fff;
}

.mm-v2__products-grid {
    flex: 0 0 auto;
    min-height: 0;
    padding: 0 1.25rem;
}

.mm-v2__cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
    align-items: stretch;
}

.mm-v2__card {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.65rem;
    min-height: 0;
    padding: 0.35rem 0.45rem 0.35rem 0.4rem;
    overflow: hidden;
    background: #fff;
    border: 1px solid #e8edf3;
    border-radius: 6px;
    text-decoration: none !important;
    color: inherit;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.mm-v2__card:hover {
    border-color: #b8cbe2;
    background: #f8fafc;
}

.mm-v2__card-media {
    flex: 0 0 84px;
    width: 84px;
    height: 84px;
    line-height: 0;
    border-radius: 0;
    background: #f4f7fa;
    overflow: hidden;
}

.mm-v2__card-media img {
    display: block;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    object-fit: cover;
    object-position: center;
    transform: scale(1.12);
    transition: transform 0.2s ease;
}

.mm-v2__card:hover .mm-v2__card-media img {
    transform: scale(1.18);
}

.mm-v2__card-body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.15rem;
    flex: 1 1 auto;
    min-width: 0;
    padding: 0;
    overflow: hidden;
}

.mm-v2__card-th,
.mm-v2__card-en,
.mm-v2__card-spec {
    display: block;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mm-v2__card-th {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    color: #102a43 !important;
    transition: color 0.15s ease;
}

.mm-v2__card:hover .mm-v2__card-th {
    color: var(--v2-header-menu-accent, #1a4a9a) !important;
}

.mm-v2__card-en {
    margin: 0;
    font-size: 11px;
    font-weight: 400;
    line-height: 1.35;
    color: #64748b !important;
}

.mm-v2__card-spec {
    margin: 0.1rem 0 0;
    font-size: 10px;
    font-weight: 500;
    line-height: 1.3;
    color: #94a3b8 !important;
    letter-spacing: 0.02em;
}

.mm-v2__card-chevron {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    margin-right: 0.15rem;
    color: #a8b8cc;
    font-size: 15px;
    line-height: 1;
    transition: color 0.15s ease, transform 0.15s ease;
}

.mm-v2__card:hover .mm-v2__card-chevron {
    color: var(--v2-header-menu-accent, #1a4a9a);
    transform: translateX(2px);
}


.mm-v2__banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-shrink: 0;
    margin: 0.75rem 1.25rem 0;
    padding: 0.7rem 1rem;
    border-radius: 8px;
    background: #e8f1fb;
}

.mm-v2__banner-msg {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}

.mm-v2__banner-icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(26, 74, 154, 0.12);
    color: var(--v2-header-menu-accent, #1a4a9a);
}

.mm-v2__banner-text {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.mm-v2__banner-title {
    color: #102a43 !important;
}

.mm-v2__banner-sub {
    color: #334155 !important;
}

.mm-v2__banner-link {
    flex: 0 0 auto;
    white-space: nowrap;
    color: var(--v2-header-menu-accent, #1a4a9a) !important;
    text-decoration: none !important;
}

.mm-v2__banner-link:hover {
    text-decoration: underline !important;
}

/* ── คอลัมน์ 3: โปรโมชัน ── */
.mm-v2__col--promo {
    position: relative;
    overflow: hidden;
    background-color: #e8edf3;
}

.mm-v2__promo-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top right;
    pointer-events: none;
    user-select: none;
}

.mm-v2__promo-overlay {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 100%;
    padding: 2rem 1rem 1rem;
    background: linear-gradient(
        95deg,
        rgba(240, 244, 249, 0.96) 0%,
        rgba(240, 244, 249, 0.9) 34%,
        rgba(240, 244, 249, 0.45) 46%,
        transparent 54%
    );
}

.mm-v2__promo-head {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    margin: 0 0 0.7rem;
    color: var(--v2-header-menu-accent, #1a4a9a) !important;
}

.mm-v2__promo-head-line {
    display: block;
    font-weight: 500;
    line-height: 1.35;
}

.mm-v2__promo-head-line--lg {
    font-size: 23px;
}

.mm-v2__promo-head-line--sm {
    font-size: 18px;
}

.mm-v2__promo-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.4rem;
}

.mm-v2__promo-list li {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: #334155;
}

.mm-v2__promo-list .fa {
    color: var(--v2-header-menu-accent, #1a4a9a);
}

.mm-v2__promo-actions {
    display: grid;
    gap: 0.75rem;
    margin-top: auto;
    padding-top: 1rem;
}

.mm-v2__btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    min-height: 58px;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    text-decoration: none !important;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.mm-v2__btn-icon {
    flex: 0 0 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    font-size: 20px;
    line-height: 1;
}

.mm-v2__btn-label {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
}

.mm-v2__btn-label small {
    display: block;
    margin-top: 0.15rem;
    font-size: 11px;
    font-weight: 400;
    line-height: 1.25;
    opacity: 0.9;
}

.mm-v2__btn--catalog {
    background: var(--v2-header-menu-accent, #1a4a9a) !important;
    border: 1px solid var(--v2-header-menu-accent, #1a4a9a) !important;
    color: #fff !important;
    box-shadow: 0 4px 14px rgba(26, 74, 154, 0.22);
}

.mm-v2__btn--catalog .mm-v2__btn-icon {
    color: #fff;
}

.mm-v2__btn--catalog:hover {
    background: #164080 !important;
    border-color: #164080 !important;
    box-shadow: 0 6px 18px rgba(26, 74, 154, 0.28);
    transform: translateY(-1px);
    color: #fff !important;
}

.mm-v2__btn--catalog.is-disabled {
    pointer-events: none;
    cursor: default;
    opacity: 0.55;
    box-shadow: none;
}

.mm-v2__btn--catalog.is-disabled:hover {
    transform: none;
    background: var(--v2-header-menu-accent, #1a4a9a) !important;
    border-color: var(--v2-header-menu-accent, #1a4a9a) !important;
    box-shadow: none;
}

.mm-v2__btn--quote {
    background: #fff !important;
    border: 1px solid #c5d5ea !important;
    color: var(--v2-header-menu-accent, #1a4a9a) !important;
    box-shadow: 0 2px 8px rgba(16, 42, 67, 0.05);
}

.mm-v2__btn--quote .mm-v2__btn-icon {
    color: var(--v2-header-menu-accent, #1a4a9a);
    background: rgba(26, 74, 154, 0.08);
    border-radius: 8px;
}

.mm-v2__btn--quote:hover {
    border-color: var(--v2-header-menu-accent, #1a4a9a) !important;
    box-shadow: 0 4px 12px rgba(16, 42, 67, 0.08);
    transform: translateY(-1px);
}

.mm-v2__empty {
    margin: 0;
    padding: 0 1.25rem;
    color: #6b7c93;
}

@media (max-width: 1199.98px) and (min-width: 992px) {
    .mm-v2__layout {
        grid-template-columns: 260px minmax(0, 1fr) 240px;
    }
}

@media (max-width: 991.98px) {
    .mm-v2__layout {
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .mm-v2__col--cats,
    .mm-v2__col--products {
        border-right: 0;
        border-bottom: 1px solid #e6ecf3;
    }

    .mm-v2__cards {
        grid-template-columns: 1fr;
    }

    .mm-v2__banner {
        flex-direction: column;
        align-items: flex-start;
    }
}
