/* AELAB Product Section Tabs — pill nav */

/* Elementor parents often use overflow:hidden; bar sticks via JS (position:fixed). */
.aelab-pst-sticky-outer {
    position: relative;
    z-index: 1;
    overflow: visible;
}

.aelab-pst {
    box-sizing: border-box;
    position: relative;
    z-index: 500;
    padding-bottom: 12px;
    margin-bottom: 0;
    background-color: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.08);
}

/* Underline tab style (reference: product overview / documents row) */
.aelab-pst--tabs-underline {
    padding-bottom: 0;
    box-shadow: none;
    background-color: #fff;
}

.aelab-pst--tabs-underline.aelab-pst--is-fixed {
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.06);
}

.aelab-pst__bar {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px 20px;
    width: 100%;
    flex-wrap: wrap;
}

.aelab-pst--tabs-underline .aelab-pst__bar {
    border-bottom: 1px solid #e5e7eb;
}

.aelab-pst--tabs-underline .aelab-pst__list {
    gap: clamp(12px, 2.5vw, 32px);
    margin: 0;
    padding: 0;
    border-bottom: none;
    flex: 1 1 auto;
    min-width: 0;
    flex-wrap: wrap;
    align-items: flex-end;
}

.aelab-pst--tabs-underline .aelab-pst__tab {
    width: auto;
    min-width: 0;
    border-radius: 0;
    padding: 0;
    background: transparent !important;
    box-shadow: none;
    transition: color 0.15s ease;
}

.aelab-pst--tabs-underline .aelab-pst__inner {
    position: relative;
    display: inline-block;
    padding: 14px 6px 11px;
    margin-bottom: -1px;
    border-radius: 0;
    font-size: 0.9375rem;
    font-weight: 500;
    letter-spacing: -0.02em;
    line-height: 1.3;
    color: var(--aelab-pst-tab-inactive-text, #94a3b8) !important;
    background: transparent !important;
}

.aelab-pst--tabs-underline .aelab-pst__tab.is-active .aelab-pst__inner {
    font-weight: 700;
    color: var(--aelab-pst-tab-active-text, #0f172a) !important;
}

.aelab-pst--tabs-underline .aelab-pst__tab.is-active .aelab-pst__inner::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background-color: var(--aelab-pst-tab-indicator, #ea580c);
    border-radius: 2px 2px 0 0;
    z-index: 1;
}

.aelab-pst.aelab-pst--is-fixed {
    position: fixed !important;
    top: var(--aelab-pst-sticky-top, 88px);
    left: var(--aelab-pst-fixed-left, 0px);
    width: var(--aelab-pst-fixed-width, 100%) !important;
    max-width: 100vw;
    box-sizing: border-box;
    z-index: 100002;
    margin: 0;
}

.aelab-pst *,
.aelab-pst *::before,
.aelab-pst *::after {
    box-sizing: border-box;
}

.aelab-pst__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    justify-content: flex-start;
    gap: 10px;
}

@media (max-width: 767px) {
    .aelab-pst__list {
        justify-content: center;
        align-items: center;
    }

    .aelab-pst--tabs-underline .aelab-pst__bar {
        flex-wrap: nowrap;
        align-items: flex-end;
        overflow-y: hidden;
    }

    .aelab-pst--tabs-underline .aelab-pst__list {
        justify-content: flex-start;
        align-items: flex-end;
        flex-wrap: nowrap;
        overflow-x: auto;
        /* بدون این، در Chrome/Firefox محور Y به auto می‌رود و نوار اسکرول عمودی روی ردیف تب می‌افتد */
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        gap: 20px;
        scrollbar-width: thin;
        overscroll-behavior-x: contain;
    }

    .aelab-pst__item {
        flex: 0 1 auto;
        max-width: 100%;
    }

    .aelab-pst--tabs-underline .aelab-pst__item {
        flex: 0 0 auto;
        max-width: none;
    }

    .aelab-pst__tab {
        width: auto;
        min-width: 0;
    }
}

.aelab-pst__item {
    margin: 0;
    padding: 0;
}

.aelab-pst__tab {
    display: block;
    width: 100%;
    cursor: pointer;
    border: none;
    border-radius: 999px;
    padding: 4px;
    font: inherit;
    line-height: 1.25;
    text-align: center;
    transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    background-color: #e5e7eb;
    color: inherit;
}

.aelab-pst--tabs-underline .aelab-pst__tab {
    text-align: start;
}

.aelab-pst__tab:focus-visible {
    outline: 2px solid #111;
    outline-offset: 2px;
}

.aelab-pst__inner {
    display: block;
    padding: 10px 18px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: normal;
}

.aelab-pst__tab:not(.is-active) .aelab-pst__inner {
    background: transparent;
    color: #4b5563;
}

.aelab-pst__tab.is-active .aelab-pst__inner {
    background: #111;
    color: #fff;
}

.aelab-pst__text {
    display: inline-block;
}

.aelab-pst__editor-hint {
    margin: 0 0 8px;
    font-size: 12px;
    color: #64748b;
    line-height: 1.4;
}

/* Meta-driven sections: all visible; tabs scroll only */
.aelab-pst-panels-wrap {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: transparent;
    border: none;
    overflow: visible;
}

/* Linked-page panels should not hide other panels anymore. */

.aelab-pst-panel {
    display: block;
    margin: 0;
    padding: 0;
    border-radius: 16px;
    background: #fff;
    border: 1px solid #e5e7eb;
    overflow: hidden;
    scroll-margin-top: var(--aelab-pst-panel-scroll-margin, 96px);
}

.aelab-pst-panel-inner {
    padding: 20px 22px;
    overflow-x: auto;
    line-height: 1.5;
}

.aelab-pst-panel__title {
    margin: 0 0 16px;
    padding: 0 0 12px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: -0.02em;
    color: #0f172a;
}

.aelab-pst-panel-inner > :first-child {
    margin-top: 0;
}

.aelab-pst-panel-inner > :last-child {
    margin-bottom: 0;
}

.aelab-pst-panel-placeholder {
    margin: 0;
    color: #64748b;
    font-size: 0.9rem;
}

/* YouTube links pasted into tab HTML → responsive embed */
.aelab-pst-youtube {
    position: relative;
    width: 100%;
    max-width: 960px;
    margin: 12px 0;
    aspect-ratio: 16 / 9;
    height: auto;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
}

/* wp_oembed_get() wraps iframe in figure / .wp-block-embed__wrapper — those must fill the 16:9 box */
.aelab-pst-youtube > figure,
.aelab-pst-youtube > .wp-block-embed,
.aelab-pst-youtube .wp-block-embed__wrapper,
.aelab-pst-youtube .embed-youtube {
    position: absolute;
    inset: 0;
    margin: 0 !important;
    padding: 0 !important;
    width: 100%;
    height: 100%;
    max-width: none;
}

/* Core block embed uses ::before padding for ratio; we already set aspect-ratio on .aelab-pst-youtube — disable inner hack */
.aelab-pst-youtube .wp-block-embed__wrapper::before,
.aelab-pst-youtube .wp-has-aspect-ratio .wp-block-embed__wrapper::before {
    content: none !important;
    display: none !important;
    padding-top: 0 !important;
}

.aelab-pst-youtube iframe,
.aelab-pst-youtube__iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    max-width: none;
    border: 0;
}

/* Accessories — modern card layout (meta key aelab_pst_accessories) */
.aelab-pst-accessories {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.aelab-pst-accessories__intro {
    margin: 0;
    padding: 0 0 8px;
    font-size: 0.95rem;
    line-height: 1.65;
    color: #334155;
}

.aelab-pst-accessories__intro > :first-child {
    margin-top: 0;
}

.aelab-pst-accessories__intro > :last-child {
    margin-bottom: 0;
}

.aelab-pst-accessory {
    margin: 0;
    padding: 0;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.06), 0 2px 4px -2px rgba(15, 23, 42, 0.06);
    overflow: hidden;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.aelab-pst-accessory:hover {
    border-color: #cbd5e1;
    box-shadow: 0 12px 24px -8px rgba(15, 23, 42, 0.12), 0 4px 8px -4px rgba(15, 23, 42, 0.08);
}

.aelab-pst-accessory__inner {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    padding: 22px 22px 24px;
}

.aelab-pst-accessory__inner--split {
    padding: 0;
}

@media (min-width: 768px) {
    .aelab-pst-accessory__inner--split {
        grid-template-columns: minmax(220px, 320px) 1fr;
        gap: 0;
        align-items: stretch;
    }

    .aelab-pst-accessory__inner--split .aelab-pst-accessory__media {
        border-inline-end: 1px solid #f1f5f9;
    }

    .aelab-pst-accessory__inner--split .aelab-pst-accessory__body {
        padding: 24px 26px 26px;
    }
}

.aelab-pst-accessory__media {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 20px 20px 22px;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

@media (min-width: 768px) {
    .aelab-pst-accessory__inner--split .aelab-pst-accessory__media {
        padding: 22px;
        justify-content: flex-start;
    }
}

.aelab-pst-accessory__figure {
    margin: 0;
    border-radius: 12px;
    overflow: hidden;
    background: #e2e8f0;
    aspect-ratio: 4 / 3;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
}

.aelab-pst-accessory__figure .aelab-pst-accessory__img--featured,
.aelab-pst-accessory__figure img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    vertical-align: middle;
}

.aelab-pst-accessory__body {
    min-width: 0;
}

.aelab-pst-accessory__inner:not(.aelab-pst-accessory__inner--split) .aelab-pst-accessory__body {
    padding: 0;
}

.aelab-pst-accessory__title {
    margin: 0 0 12px;
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: -0.02em;
    color: #0f172a;
}

.aelab-pst-accessory__desc {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.65;
    color: #334155;
}

.aelab-pst-accessory__desc > :first-child {
    margin-top: 0;
}

.aelab-pst-accessory__desc > :last-child {
    margin-bottom: 0;
}

.aelab-pst-accessory__gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.aelab-pst-accessory__gal-item {
    margin: 0;
    flex: 0 0 auto;
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
    border: 2px solid #fff;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.aelab-pst-accessory__gal-item.is-active {
    border-color: #0f172a;
    box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.18);
}

.aelab-pst-accessory__gal-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
}

.aelab-pst-accessory__gal-item .aelab-pst-accessory__img--gal,
.aelab-pst-accessory__gal-item img {
    display: block;
    width: 72px;
    height: 72px;
    object-fit: cover;
    vertical-align: middle;
}

@media (max-width: 767px) {
    .aelab-pst-accessory__inner--split .aelab-pst-accessory__media {
        border-bottom: 1px solid #f1f5f9;
    }

    .aelab-pst-accessory__inner--split .aelab-pst-accessory__body {
        padding: 20px 22px 22px;
    }
}

/* Back to top — same row as tabs (end side), orange */
.aelab-pst-back-to-top {
    flex: 0 0 auto;
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    align-self: flex-end;
    margin: 0 0 -1px;
    padding: 14px 2px 11px;
    border: none;
    background: transparent;
    color: #ea580c;
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0.01em;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    max-width: 0;
    overflow: hidden;
    white-space: nowrap;
    padding-inline: 0;
    transition: opacity 0.2s ease, max-width 0.35s ease, padding 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
}

.aelab-pst-back-to-top--visible {
    opacity: 1;
    visibility: visible;
    max-width: 220px;
    padding-inline: 4px;
    pointer-events: auto;
}

.elementor-editor-active .aelab-pst-back-to-top {
    opacity: 0.35;
    visibility: visible;
    max-width: 220px;
    padding-inline: 4px;
    pointer-events: none;
}

.aelab-pst-back-to-top:focus-visible {
    outline: 2px solid rgba(15, 23, 42, 0.35);
    outline-offset: 3px;
    border-radius: 4px;
}

/* WooCommerce / theme reset.css: button:hover { background-color: #c36 } — neutralize for this control */
.aelab-pst-back-to-top:hover,
.aelab-pst-back-to-top:focus,
.aelab-pst-back-to-top:active {
    background-color: transparent !important;
    background: transparent !important;
    color: #ea580c !important;
    box-shadow: none !important;
}

.aelab-pst-back-to-top__icon {
    flex-shrink: 0;
    display: block;
}

.aelab-pst-back-to-top__text {
    white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
    .aelab-pst-back-to-top {
        transition: none;
    }
}

/* موبایل: بدون «Back to top» در نوار تب‌ها */
@media (max-width: 767px) {
    .aelab-pst-back-to-top {
        display: none !important;
    }
}
