/* فایل: assets/css/pwa-style.css */
/* نسخه نهایی: فیکس نمایش کامل لوگو (بدون بریدگی) */

:root {
    --pwa-color: #e3bf60; /* رنگ اصلی */
    --pwa-bg: #ffffff;
    --pwa-text: #333;
    --pwa-radius: 20px;
}

/* --- لایه تاریک پشت (Overlay) --- */
#wpfaraz-pwa-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 999999998;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#wpfaraz-pwa-toast {
    position: fixed;
    z-index: 999999999;
    font-family: inherit;
    direction: rtl;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}

.pwa-visible {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translate(0, 0) scale(1) !important;
}

/* --- استایل کلی محتوا --- */
.pwa-toast-content {
    background: var(--pwa-bg);
    position: relative;
    display: flex;
    /* ✅ حیاتی: جلوگیری از مخفی شدن لوگوی بیرون زده */
    overflow: visible !important; 
}

/* دکمه بستن (ضربدر) */
.pwa-close-btn {
    position: absolute;
    width: 30px;
    height: 30px;
    background: #f5f5f5;
    border: 1px solid #eee;
    border-radius: 50%;
    color: #999;
    font-size: 20px;
    line-height: 28px; /* سنتر دقیق */
    text-align: center;
    cursor: pointer;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.pwa-close-btn:hover {
    background: #fff0f0;
    color: #ff4d4d;
    border-color: #ffcccc;
}

/* ✅ تنظیمات مهم برای نمایش صحیح لوگو */
.pwa-icon-area img {
    display: block;
    /* این خط باعث می‌شود کل عکس در کادر جا شود و بریده نشود */
    object-fit: contain; 
    /* پس‌زمینه سفید برای لوگوهای PNG */
    background-color: #fff; 
    /* کمی فاصله از لبه‌ها */
    padding: 3px; 
    box-sizing: border-box;
}

/* متن‌ها */
.pwa-text-area { display: flex; flex-direction: column; }
.pwa-title { font-size: 15px; font-weight: 800; color: var(--pwa-text); margin-bottom: 4px; }
.pwa-desc { font-size: 12px; color: #666; line-height: 1.5; }

/* دکمه نصب */
.pwa-action-area button {
    background: var(--pwa-color);
    color: #fff;
    border: none;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: transform 0.2s, box-shadow 0.2s;
}
.pwa-action-area button:active { transform: scale(0.96); }

/* =========================================
   💻 نسخه دسکتاپ (کارت شناور سمت چپ)
   ========================================= */
@media (min-width: 769px) {
    #wpfaraz-pwa-toast {
        bottom: 30px;
        left: 30px;
        width: 380px;
        transform: translateY(30px);
    }
    
    #wpfaraz-pwa-toast.pwa-visible { transform: translateY(0); }

    .pwa-toast-content {
        padding: 15px;
        border-radius: 16px;
        box-shadow: 0 10px 40px rgba(0,0,0,0.1);
        border: 1px solid rgba(0,0,0,0.05);
        align-items: center;
        gap: 15px;
    }
    
    /* سایز لوگو در دسکتاپ */
    .pwa-icon-area img { 
        width: 100px; 
        height: 100px; 
    }
    
    /* دکمه بستن در دسکتاپ سمت چپ */
    .pwa-close-btn { right: auto; left: -10px; top: -10px; }
    
    .pwa-action-area button { padding: 8px 20px; border-radius: 50px; }
}

/* =========================================
   📱 نسخه موبایل
   ========================================= */
@media (max-width: 768px) {
    
    /* --------------------------------------
       حالت ۱: پاپ‌آپ وسط (Popup)
       -------------------------------------- */
    #wpfaraz-pwa-toast.layout-popup {
        top: 55%; 
        left: 50%;
        transform: translate(-50%, -45%) scale(0.9);
        width: 85%;
        max-width: 320px;
    }

    #wpfaraz-pwa-toast.layout-popup.pwa-visible {
        transform: translate(-50%, -50%) scale(1) !important;
    }

    #wpfaraz-pwa-toast.layout-popup .pwa-toast-content {
        flex-direction: column;
        text-align: center;
        padding: 55px 25px 30px 25px; 
        border-radius: 28px;
        box-shadow: 0 25px 70px rgba(0,0,0,0.3);
        gap: 12px;
    }

    /* لوگوی پاپ‌آپ (بیرون زده) */
    #wpfaraz-pwa-toast.layout-popup .pwa-icon-area img {
        width: 90px; 
        height: 90px;
        border-radius: 22px; /* گردی آیکون */
        position: absolute;
        top: -45px; /* بیرون زدگی */
        left: 50%;
        transform: translateX(-50%);
        
        /* استایل قاب دور لوگو */
        background-color: #fff;
        border: 4px solid #fff; 
        box-shadow: 0 10px 25px rgba(0,0,0,0.15);
        z-index: 5;
    }

    #wpfaraz-pwa-toast.layout-popup .pwa-title { font-size: 19px; margin-bottom: 5px; }
    #wpfaraz-pwa-toast.layout-popup .pwa-desc { font-size: 14px; margin-bottom: 15px; }

    #wpfaraz-pwa-toast.layout-popup .pwa-action-area { width: 100%; }
    #wpfaraz-pwa-toast.layout-popup .pwa-action-area button {
        width: 100%; padding: 15px; border-radius: 16px; font-size: 16px;
    }

    /* دکمه بستن */
    #wpfaraz-pwa-toast.layout-popup .pwa-close-btn {
        top: 15px; left: 15px; right: auto;
    }


    /* --------------------------------------
       حالت ۲: نوار پایین (Bottom Sheet)
       -------------------------------------- */
    #wpfaraz-pwa-toast.layout-bottom {
        top: auto; bottom: 0; left: 0; right: 0;
        transform: translateY(100%);
        width: 100%;
        padding-top: 20px; 
    }
    
    #wpfaraz-pwa-toast.layout-bottom.pwa-visible {
        transform: translateY(0) !important;
    }

    #wpfaraz-pwa-toast.layout-bottom .pwa-toast-content {
        padding: 20px 20px 35px 20px;
        border-radius: 24px 24px 0 0;
        box-shadow: 0 -10px 40px rgba(0,0,0,0.15);
        align-items: center;
        gap: 15px;
    }
    
    /* خط بالای شیت */
    #wpfaraz-pwa-toast.layout-bottom .pwa-toast-content::after {
        content: ''; position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
        width: 40px; height: 4px; background: #e0e0e0; border-radius: 10px;
    }

    #wpfaraz-pwa-toast.layout-bottom .pwa-icon-area img { 
        width: 100px; height: 100px; 
        border-radius: 14px; 
        border: 1px solid #f0f0f0;
    }
    
    #wpfaraz-pwa-toast.layout-bottom .pwa-text-area { flex-grow: 1; }
    #wpfaraz-pwa-toast.layout-bottom .pwa-action-area button { padding: 10px 25px; border-radius: 50px; }
    
    /* دکمه بستن برای حالت پایین */
    #wpfaraz-pwa-toast.layout-bottom .pwa-close-btn { 
        top: -15px; left: 15px; right: auto;
        background: #fff;
        box-shadow: 0 3px 10px rgba(0,0,0,0.15);
    }
}

/* =========================================
   راهنمای iOS (Modal)
   ========================================= */
#pwa-ios-modal-overlay {
    display: none;
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 10000000000;
    align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.3s;
}
.pwa-ios-modal {
    background: #fff; width: 85%; max-width: 320px;
    border-radius: 28px; padding: 30px 25px; text-align: center;
    box-shadow: 0 25px 70px rgba(0,0,0,0.4);
    transform: scale(0.9); transition: transform 0.3s;
}
#pwa-ios-modal-overlay.active { opacity: 1; display: flex; }
#pwa-ios-modal-overlay.active .pwa-ios-modal { transform: scale(1); }

/* آیکون در راهنمای iOS */
.ios-header img { 
    width: 70px; height: 70px; 
    border-radius: 18px; 
    margin-bottom: 15px; 
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    object-fit: contain; /* اینجا هم درست شد */
    background: #fff;
}
.ios-header h3 { font-size: 18px; margin: 0 0 20px 0; color: #333; }
.ios-body { margin-bottom: 25px; }
.ios-step { background: #f9f9f9; padding: 12px; border-radius: 14px; margin-bottom: 10px; font-size: 13px; color: #555; display: flex; align-items: center; gap: 10px; text-align: right;}
.step-num { background: #333; color: #fff; width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: bold; flex-shrink: 0; font-size: 12px;}
.ios-icon { width: 18px; height: 18px; vertical-align: middle; background-size: contain; background-repeat: no-repeat; display: inline-block; margin: 0 4px; filter: brightness(0);}
.ios-icon.share { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 50 50'%3E%3Cpath d='M30.3 13.7L25 8.4l-5.3 5.3-1.4-1.4L25 5.6l6.7 6.7z'/%3E%3Cpath d='M24 7h2v21h-2z'/%3E%3Cpath d='M35 40H15c-1.7 0-3-1.3-3-3V19c0-1.7 1.3-3 3-3h7v2h-7c-.6 0-1 .4-1 1v18c0 .6.4 1 1 1h20c.6 0 1-.4 1-1V19c0-.6-.4-1-1-1h-7v-2h7c1.7 0 3 1.3 3 3v18c0 1.7-1.3 3-3 3z'/%3E%3C/svg%3E"); }
.ios-icon.plus { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='12' y1='8' x2='12' y2='16'/%3E%3Cline x1='8' y1='12' x2='16' y2='12'/%3E%3C/svg%3E"); }

#pwa-ios-close-modal { background: var(--pwa-color); color: #fff; width: 100%; padding: 15px; border: none; border-radius: 16px; font-weight: bold; cursor: pointer; font-size: 16px;}