/**
 * مگامنو محصولات HPB — طراحی تمیز و مینیمال
 */

.hpb-pmm {
    --hpb-pmm-width: 100%;
    --hpb-pmm-min-h: 300px;
    --hpb-pmm-radius: 12px;
    --hpb-pmm-tab-accent: #1d4ed8;
    --hpb-pmm-tab-muted: #6b7280;
    --hpb-pmm-link: #374151;
    --hpb-pmm-link-hover: #1d4ed8;
    --hpb-pmm-border: #e5e7eb;
    --hpb-pmm-surface: #f9fafb;
    --hpb-pmm-shadow: 0 8px 32px rgba(15, 23, 42, 0.08);
    width: var(--hpb-pmm-width);
    max-width: 100%;
    box-sizing: border-box;
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--hpb-pmm-link);
}

.hpb-pmm *,
.hpb-pmm *::before,
.hpb-pmm *::after {
    box-sizing: border-box;
}

.hpb-pmm__inner {
    display: flex;
    flex-direction: row-reverse;
    align-items: stretch;
    min-height: var(--hpb-pmm-min-h);
    border: 1px solid var(--hpb-pmm-border);
    border-radius: var(--hpb-pmm-radius);
    overflow: hidden;
    background: #fff;
    box-shadow: var(--hpb-pmm-shadow);
}

.hpb-pmm--layout-tabs-top .hpb-pmm__inner {
    flex-direction: column;
}

/* ——— تب‌ها ——— */
.hpb-pmm__tabs {
    flex: 0 0 200px;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 8px 0;
    background: var(--hpb-pmm-surface);
    border-inline-start: 1px solid var(--hpb-pmm-border);
}

.hpb-pmm--layout-tabs-top .hpb-pmm__tabs {
    flex: 0 0 auto;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 0;
    padding: 0 16px;
    border-inline-start: 0;
    border-bottom: 1px solid var(--hpb-pmm-border);
    overflow-x: auto;
    scrollbar-width: none;
}

.hpb-pmm--layout-tabs-top .hpb-pmm__tabs::-webkit-scrollbar {
    display: none;
}

.hpb-pmm__tab {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    margin: 0;
    padding: 11px 18px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--hpb-pmm-tab-muted);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    text-align: start;
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.hpb-pmm--layout-tabs-top .hpb-pmm__tab {
    width: auto;
    flex: 0 0 auto;
    padding: 14px 16px;
}

.hpb-pmm__tab::after {
    content: "";
    position: absolute;
    inset-inline: 18px;
    bottom: 0;
    height: 2px;
    border-radius: 0;
    background: var(--hpb-pmm-tab-accent);
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.18s ease;
}

.hpb-pmm--layout-tabs-top .hpb-pmm__tab::after {
    inset-inline: 12px;
    bottom: 0;
}

.hpb-pmm--layout-tabs-side .hpb-pmm__tab::after {
    inset-inline: auto;
    inset-inline-end: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    height: auto;
    transform: scaleY(0);
    transform-origin: center;
}

.hpb-pmm__tab:hover,
.hpb-pmm__tab:focus-visible {
    color: var(--hpb-pmm-link-hover);
    background: transparent;
    outline: none;
}

.hpb-pmm__tab.is-active {
    color: var(--hpb-pmm-tab-accent);
    background: #fff;
    font-weight: 600;
    box-shadow: none;
}

.hpb-pmm__tab.is-active::after {
    transform: scaleX(1);
}

.hpb-pmm--layout-tabs-side .hpb-pmm__tab.is-active::after {
    transform: scaleY(1);
}

.hpb-pmm--layout-tabs-top .hpb-pmm__tab.is-active {
    background: transparent;
}

/* ——— پنل‌ها ——— */
.hpb-pmm__panels {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    min-height: var(--hpb-pmm-min-h);
    background: #fff;
}

.hpb-pmm__panel {
    position: absolute;
    inset: 0;
    display: none;
    overflow: hidden;
}

.hpb-pmm__panel.is-active {
    display: block;
}

.hpb-pmm__panel-bg,
.hpb-pmm__panel-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.hpb-pmm__panel-bg--image {
    background-repeat: no-repeat;
    background-size: 240px;
    background-position: left 32px bottom 64px;
    opacity: 0.35;
}

.hpb-pmm__panel-overlay {
    background: linear-gradient(105deg, rgba(255, 255, 255, 0.92) 55%, rgba(249, 250, 251, 0.88) 100%);
}

.hpb-pmm__panel-content {
    position: relative;
    z-index: 1;
    height: 100%;
    padding: 20px 24px 24px;
    overflow: auto;
}

.hpb-pmm__grid {
    display: grid;
    gap: 16px 32px;
    align-items: start;
}

.hpb-pmm__grid--cols-1 { grid-template-columns: 1fr; }
.hpb-pmm__grid--cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.hpb-pmm__grid--cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.hpb-pmm__grid--cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.hpb-pmm__grid--cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.hpb-pmm__grid--cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.hpb-pmm__grid--cols-7 { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.hpb-pmm__grid--cols-8 { grid-template-columns: repeat(8, minmax(0, 1fr)); }

.hpb-pmm__grid--cols-5,
.hpb-pmm__grid--cols-6,
.hpb-pmm__grid--cols-7,
.hpb-pmm__grid--cols-8 {
    gap: 12px 20px;
}

.hpb-pmm__col-title {
    margin: 0 0 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--hpb-pmm-border);
    font-size: 12px;
    font-weight: 700;
    color: #111827;
    letter-spacing: 0.01em;
}

.hpb-pmm__links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.hpb-pmm__link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 4px;
    border-radius: 0;
    color: var(--hpb-pmm-link);
    text-decoration: none;
    font-weight: 400;
    font-size: 13px;
    transition: color 0.15s ease, padding-inline-start 0.15s ease;
}

.hpb-pmm__link:hover,
.hpb-pmm__link:focus-visible {
    color: var(--hpb-pmm-link-hover);
    background: transparent;
    outline: none;
    padding-inline-start: 8px;
}

.hpb-pmm__link-icon {
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--hpb-pmm-border);
}

.hpb-pmm__link-icon img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hpb-pmm__link-icon .hpb-pmm__icon-visual {
    display: block;
    line-height: 1;
    font-size: 14px;
}

.hpb-pmm__link-label {
    flex: 1 1 auto;
    min-width: 0;
}

.hpb-pmm__grid--cols-5 .hpb-pmm__link,
.hpb-pmm__grid--cols-6 .hpb-pmm__link,
.hpb-pmm__grid--cols-7 .hpb-pmm__link,
.hpb-pmm__grid--cols-8 .hpb-pmm__link {
    padding: 5px 2px;
    font-size: 12.5px;
}

/* داخل مگادراپ‌داون هدر */
.hpb-header-builder .the_mega_block .hpb-pmm,
.ns_home_menu .the_mega_block .hpb-pmm {
    margin-inline: 0;
    width: 100%;
}

.hpb-header-builder .ns_home_menu .the_mega_block:not(:empty):has(.hpb-pmm) {
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

@media (max-width: 767px) {
    .hpb-pmm__inner {
        flex-direction: column;
    }

    .hpb-pmm__tabs {
        flex: 0 0 auto;
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        border-inline-start: 0;
        border-bottom: 1px solid var(--hpb-pmm-border);
        padding: 0 8px;
    }

    .hpb-pmm__tab {
        width: auto;
        white-space: nowrap;
    }

    .hpb-pmm__grid--cols-2,
    .hpb-pmm__grid--cols-3,
    .hpb-pmm__grid--cols-4,
    .hpb-pmm__grid--cols-5,
    .hpb-pmm__grid--cols-6,
    .hpb-pmm__grid--cols-7,
    .hpb-pmm__grid--cols-8 {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 768px) and (max-width: 1100px) {
    .hpb-pmm__grid--cols-5,
    .hpb-pmm__grid--cols-6,
    .hpb-pmm__grid--cols-7,
    .hpb-pmm__grid--cols-8 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
