/* ================================
   MasterGadget Warranty Popup
================================ */


/* دکمه مشاهده گارانتی - عرض به اندازه محتوا، نه تمام‌عرض */
.mrg-warranty-open {

    display: inline-block;

    width: auto;
    max-width: 100%;

    margin-top: 12px;

    padding: 10px 22px;

    border: none;
    border-radius: 4px !important;

    background: #d2daff !important;
    color: #fff;

    font-size: 14px;
    font-weight: 600;

    cursor: pointer;

    transition: .25s ease;

}


.mrg-warranty-open:hover {

    opacity: .85;

}


/* لایه اصلی Popup */
.mrg-warranty-popup {

    position: fixed !important;

    inset: 0 !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;

    display: none;

    align-items: center;
    justify-content: center;

    padding: 24px;
    box-sizing: border-box;

    z-index: 2147483647 !important;

    transform: none !important;

}



/* فعال شدن Popup */
.mrg-warranty-popup.active {

    display: flex;

}



/* بک گراند */
.mrg-warranty-overlay {

    position: absolute;

    inset: 0;

    background: rgba(0,0,0,.75);

}



/* باکس اصلی - وسط صفحه، نه تمام صفحه */

.mrg-warranty-box {


    position: relative;

    width: 100%;
    max-width: 850px;

    height: 85vh;
    height: 85dvh;
    max-height: 850px;

    background: #fff;

    border-radius: 14px;

    display: flex;
    flex-direction: column;

    overflow: hidden;

    box-shadow: 0 10px 40px rgba(0,0,0,.35);

}



/* نوار بالای باکس (همیشه ثابت و قابل مشاهده) */

.mrg-warranty-header {

    display: flex;
    align-items: center;
    justify-content: space-between;

    flex-shrink: 0;

    padding: 12px 16px;

    background: #f7f7f8;
    border-bottom: 1px solid #e5e5e5;

}


.mrg-warranty-title {

    font-size: 15px;
    font-weight: 700;
    color: #222;

}


/* دکمه بازگشت به محصول */

.mrg-warranty-close {

    padding: 8px 18px;

    border-radius: 8px !important;
    border: none;

    background: #d2daff !important;
    color: #fff;

    font-size: 14px;
    font-weight: 600;

    cursor: pointer;

    transition: .25s ease;

}


.mrg-warranty-close:hover {

    opacity: .85;

}



/* سه پنل نمایش (عکس / PDF گوگل / PDF محلی) - فقط یکی در لحظه فعاله */

.mrg-warranty-image-wrap,
.mrg-warranty-pdf-frame-wrap,
.mrg-warranty-pdf-canvas-wrap {

    display: none;

    width: 100%;

    flex: 1;
    min-height: 0;

}


.mrg-warranty-image-wrap.mrg-pane-active,
.mrg-warranty-pdf-frame-wrap.mrg-pane-active,
.mrg-warranty-pdf-canvas-wrap.mrg-pane-active {

    display: block;

}


/* عکس گارانتی - قابل اسکرول، زوم با pinch طبیعی مرورگر */

.mrg-warranty-image-wrap {

    overflow-y: auto;
    overflow-x: auto;

    background: #eeeeee;

    text-align: center;

    touch-action: pan-x pan-y pinch-zoom;

}


.mrg-warranty-image {

    display: block;

    width: 100%;
    height: auto;

    margin: 0 auto;

}


/* نمایش PDF با Google Docs Viewer */

.mrg-warranty-pdf-frame-wrap {

    height: 100%;

}


.mrg-warranty-frame {

    width: 100%;
    height: 100%;

    border: none;

    display: block;

    background: #525659;

}


/* نمایش PDF با رندر محلی (pdf.js) */

.mrg-warranty-pdf-canvas-wrap {

    overflow: auto;

    background: #525659;

    text-align: center;

    padding: 12px 0;

    touch-action: pan-x pan-y pinch-zoom;

}


.mrg-warranty-pdf-loading {

    color: #fff;

    padding: 40px 0;

    font-size: 14px;

}


.mrg-warranty-pdf-page {

    display: block;

    max-width: 100%;
    height: auto;

    margin: 0 auto 12px;

    box-shadow: 0 2px 10px rgba(0,0,0,.3);

}



/* موبایل: باکس تقریباً تمام عرض/ارتفاع صفحه */

@media (max-width: 768px) {

    .mrg-warranty-popup {

        padding: 10px;

    }

    .mrg-warranty-box {

        max-width: 100%;

        height: 88vh;
        height: 88dvh;

    }

    .mrg-warranty-title {

        display: none;

    }

    .mrg-warranty-close {

        padding: 7px 14px;
        font-size: 13px;

    }

}
