/* =====================================================================
   Custom Gallery Modal (CGM) — استایل مستقل و قابل استفاده مجدد
   یک پاپ‌آپ گالری تمام‌صفحه با دو تب «تصاویر» و «ویدئو»، بدون وابستگی
   به هیچ کتابخونه‌ی شخص ثالثی (PhotoSwipe / fancybox و ...).

   نحوه استفاده:
   1) این فایل رو لینک کن:      <link rel="stylesheet" href="custom-gallery-modal2.css">
   2) custom-gallery-modal.js رو هم لینک کن (بعد از jQuery).
   3) مارک‌آپ HTML مودال (بخش #customGalleryModal) رو از پروژه‌ی اصلی کپی کن.
   4) CGM.open($product, 'images' | 'video') رو صدا بزن.

   نکته: کلاس‌های .video-popup-inner / .video-popup-file / .video-popup-embed
   برای نمایش محتوای ویدئو (تگ <video> یا آیفریم Embed) داخل تب ویدئو هستن.
   ===================================================================== */

.video-popup-inner {
    border-radius: 20px;
    box-shadow: none;
    padding: 5px;
}

.video-popup-inner.video-popup-file video {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    border: 0;
    border-radius: 13px;
}

.video-popup-inner.video-popup-embed .iframe-wrapper {
    position: relative;
    width: 100%;
}

.video-popup-inner.video-popup-embed .iframe-wrapper iframe {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* ===== پاپ‌آپ گالری ===== */

.cgm-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;

    direction: rtl;
    opacity: 0;
    transition: opacity .28s ease;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: opacity .25s ease, visibility .25s;
}

    .cgm-overlay.open {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .cgm-overlay.show {
        opacity: 1;
    }

    .cgm-overlay.show .cgm-box {
        transform: scale(1);
    }

.cgm-box {
    position: relative;
    width: 100%;
    height: 100%;
    transform: scale(.96);
    transition: transform .28s ease;
    display: flex;
    flex-direction: column;
}

.cgm-header {
    position: relative;
    flex: 0 0 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
}

.cgm-tabs {
    display: flex;
    gap: 6px;
    background: rgba(255,255,255,0.08);
    border-radius: 30px;
    padding: 4px;
}

    .cgm-tabs .cgm-tab {
        border: 0;
        background: transparent;
        color: #fff;
        font-family: inherit;
        font-size: 14px;
        padding: 7px 20px;
        border-radius: 30px;
        cursor: pointer;
        transition: background .25s, color .25s;
        opacity: .75;
    }

        .cgm-tabs .cgm-tab.active {
            background: #b094cc;
            opacity: 1;
        }

.cgm-counter {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #ddd;
    font-size: 13px;
}

.cgm-close {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .2s;
}

    .cgm-close:hover {
        background: rgba(255,255,255,0.2);
    }

.cgm-body {
    flex: 1 1 auto;
    position: relative;
    min-height: 0;
}

.cgm-panel {
    display: none;
    position: absolute;
    inset: 0;
    align-items: center;
    justify-content: center;
}

    .cgm-panel.active {
        display: flex;
    }

.cgm-panel-images {
    padding: 0;
}

.cgm-image-wrap {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: pan-y;
}

    .cgm-image-wrap img {
        max-width: 100%;
        max-height: 82vh;
        border-radius: 12px;
        -webkit-user-drag: none;
        user-select: none;
        transition: opacity .22s ease, transform .22s ease;
        opacity: 1;
        transform: translateX(0) scale(1);
    }

        .cgm-image-wrap img.cgm-out-next {
            opacity: 0;
            transform: translateX(-26px) scale(.97);
        }

        .cgm-image-wrap img.cgm-out-prev {
            opacity: 0;
            transform: translateX(26px) scale(.97);
        }

        .cgm-image-wrap img.cgm-in-next {
            transition: none;
            opacity: 0;
            transform: translateX(26px) scale(.97);
        }

        .cgm-image-wrap img.cgm-in-prev {
            transition: none;
            opacity: 0;
            transform: translateX(-26px) scale(.97);
        }

.cgm-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 46px;
    height: 46px;
    border: 0;
    border-radius: 50%;
    background: rgba(0,0,0,0.4);
    color: #fff;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
    transition: background .2s;
}

    .cgm-arrow:hover {
        background: rgba(0,0,0,0.6);
    }

    .cgm-arrow.cgm-hidden {
        display: none;
    }

.cgm-arrow-prev {
    right: 14px;
}

.cgm-arrow-next {
    left: 14px;
}

.cgm-panel-video {
    padding: 20px;
}

    .cgm-panel-video .video-popup-inner.video-popup-file video {
        max-height: 82vh;
    }

    .cgm-panel-video .video-popup-inner.video-popup-embed {
        width: min(90vw, 800px);
    }

@media (max-width:767px) {
    .cgm-arrow {
        width: 36px;
        height: 36px;
        font-size: 14px;
        background: rgba(0,0,0,0.45);
    }

    .cgm-arrow-prev {
        right: 8px;
    }

    .cgm-arrow-next {
        left: 8px;
    }

    .cgm-tabs .cgm-tab {
        font-size: 13px;
        padding: 6px 16px;
    }

    .cgm-counter {
        display: none;
    }
}

@media (min-width:768px) {
    .cgm-image-wrap img {
        max-height: 93vh;
    }

    .cgm-panel-video .video-popup-inner.video-popup-file video {
        max-height: 93vh;
    }
}

/* ===== بادج قد و سایز مدل ===== */

.model-size-badge {
    display: flex;
    align-items: center;
    gap: 7px;
    background: rgba(255, 255,255, 0.7);
    color: #333;
    font-size: 12.5px;
    font-weight: 500;
    white-space: nowrap;
    padding: 8px 15px;
    border-radius: 30px;

}

    .model-size-badge i {
        font-size: 13px;
    }

.cgm-model-badge {
    position: absolute;
    bottom: 22px;
    right: 50%;
    transform: translateX(50%);
    z-index: 6;
}

@media (max-width:767px) {
    .cgm-model-badge {
        bottom: 14px;
        font-size: 11px;
        padding: 7px 12px;
    }
}



/* رنگ قیمت سفارشی */
.product-price,
.product-price .new-price,
.product-price-v2 .price-value-v2 {
    color: #1e8a5f !important;
}

/* اشاره‌گر کلیک برای بزرگنمایی تصویر محصول */
.product-image img {
    cursor: pointer;
}

.ratings-full:before {
    color: #cecbcb;
}

.post-col .post {
    padding: 1rem;
    border: 1px solid #e1d9e8;
    margin-bottom: 10px;
    border-radius: 10px;
    background-color: #ede6f4;
}

.post-list-sm .post-details {
    width: 100%;
}

.video-cell {
    position: relative;
    background: #000;
    border-radius: 15px;
}

    .video-cell img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        opacity: 0.55;
    }

.video-cell-trigger {
    position: absolute;
    inset: 0;
    display: block;
}

.video-cell .play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    border-radius: 50%;
    z-index: 2;
    filter: drop-shadow(0 0 8px rgba(255,255,255,0.6));
}

.video-cell .play-triangle {
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 11px 0 11px 19px;
    border-color: transparent transparent transparent #fff;
    transform: translateX(2px);
}

.cart-btn {
    width: 40px;
    height: 40px;
    background: #fff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 7px;
    float: left;
}

@media (max-width: 480px) {
    .post-list-sm.post-upselling .post-title {
        font-size: 1.2rem;
        font-weight: normal;
    }

    .product-thumb {
        border-radius: 8px;
    }

        .product-thumb.active:before {
            border-radius: 8px;
        }
}

.fancybox-skin {
    -webkit-border-radius: 15px;
    -moz-border-radius: 15px;
    border-radius: 15px;
}

.fancybox-overlay {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: opacity .25s ease, visibility .25s;
}

/* ===== Car compatibility box ===== */
.car-compat-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    background: #fdf2f4;
    border: 1px solid #f6d9df;
    border-radius: 14px;
    padding: 16px 18px;
    margin: 16px 0;
    cursor: pointer;
    transition: box-shadow .3s;
}

    .car-compat-box:hover {
        box-shadow: 0 10px 22px -14px rgba(179,0,46,.35);
    }

.car-compat-icon {
    flex-shrink: 0;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: #fff;
    color: #B3002E;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .car-compat-icon svg {
        width: 22px;
        height: 22px;
    }

.car-compat-body {
    flex: 1;
    text-align: right;
}

.car-compat-label {
    display: block;
    font-size: 1.05rem;
    font-weight: 600;
    color: #B3002E;
    margin-bottom: 4px;
}

.car-compat-title {
    display: block;
    font-size: 1.2rem;
    font-weight: 700;
    color: #222;
    margin-bottom: 4px;
}

.car-compat-detail {
    display: block;
    font-size: 1.05rem;
    color: #777;
}

.car-compat-link {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 1.05rem;
    font-weight: 600;
    color: #B3002E;
    white-space: nowrap;
}

    .car-compat-link svg {
        width: 14px;
        height: 14px;
    }

/* ===== Compatible-cars modal ===== */
.compat-modal {
    width: 100%;
    max-width: 90vw;
    padding: 0;
    text-align: right;
    direction: rtl;
}

.compat-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}

    .compat-modal-header .car-compat-icon {
        background: #fdf2f4;
    }

.compat-modal-title {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    color: #222;
}

.compat-modal-subtitle {
    margin: 4px 0 18px;
    font-size: 1.05rem;
    color: #888;
}

    .compat-modal-subtitle b {
        color: #B3002E;
    }

.compat-modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 16px;
}

@media (max-width: 575px) {
    .compat-modal-grid {
        grid-template-columns: 1fr;
    }

    .compat-modal {
        padding: 16px;
    }
}

.compat-car-card {
    position: relative;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 14px;
    display: block;
    text-decoration: none !important;
    transition: all 0.25s ease-in-out;
    background: #fff;
}

    .compat-car-card:hover {
        border-color: #B3002E;
        box-shadow: 0 4px 12px rgba(179,0,46,0.08);
        transform: translateY(-2px);
    }

.compat-car-card-brand {
    font-size: 1.15rem;
    font-weight: 700;
    color: #222;
    margin-bottom: 0;
}

.compat-modal-note {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f5f5f5;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: .95rem;
    color: #666;
}

/* ===== Update-date box ===== */
.update-date-box {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #eafaf1;
    color: #1e8a5f;
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 1rem;
    font-weight: 500;
    margin: 10px 0;
}

    .update-date-box b {
        font-weight: 700;
    }

/* ===== Product specifications ===== */
.spec-table-wrap {
    width: 100%;
}

.spec-table {
    width: 100% !important;
    border-collapse: collapse;
    margin-bottom: 0 !important;
}

    .spec-table tbody tr:last-child .spec-row-cell {
        border-bottom: none !important;
    }

.spec-table-wrap .spec-row-cell {
    display: flex !important;
    align-items: center;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    gap: 10px;
    padding: 14px 16px !important;
    border: none !important;
    border-bottom: 1px solid #eee !important;
    border-radius: 0 !important;
    font-size: 1.1rem;
}

.spec-row-icon {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #f7f7f7;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .spec-row-icon svg {
        width: 13px;
        height: 13px;
    }

.spec-row-label {
    flex-shrink: 0;
    font-weight: 700;
    color: #333;
    white-space: nowrap;
}

.spec-row-value {
    font-weight: 500;
    color: #2b6cb0;
}

@media (max-width: 575px) {
    .spec-row-cell {
        padding: 12px !important;
        font-size: 1rem;
        flex-wrap: wrap;
    }
}
