/* =============================================
   استایل مودال هوشمند نصب PWA - نسخه Bottom Sheet
   نسخه 3.4.0
   نویسنده: سعید ئیل ترک
   ============================================= */

/* ====== استفاده از فونت سایت ====== */
#cpwa-overlay,
#cpwa-overlay * {
    font-family: inherit !important;
}

/* ====== پس‌زمینه محو ====== */
#cpwa-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    z-index: 9999999;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    transition: background 0.4s ease, backdrop-filter 0.4s ease;
}

/* حالت فعال (پس‌زمینه با تاری) */
#cpwa-overlay.cpwa-active {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* ====== کارت مودال (Bottom Sheet) ====== */
#cpwa-modal {
    background: #ffffff;
    border-radius: 28px 28px 0 0;
    max-width: 500px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2);
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
    direction: rtl;
    position: relative;
}

/* حالت باز (اسلاید آپ) */
#cpwa-modal.cpwa-slide-up {
    transform: translateY(0);
}

/* ====== نشانگر بالای مودال ====== */
#cpwa-modal::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: #d1d1d6;
    border-radius: 4px;
    z-index: 10;
}

/* ====== محتوای مودال ====== */
.cpwa-modal-content {
    padding: 32px 24px 28px;
    text-align: center;
}

/* ====== هدر مودال ====== */
.cpwa-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 12px;
}

#cpwa-site-logo {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    margin-bottom: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    object-fit: cover;
}

#cpwa-site-title {
    font-size: 22px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
}

/* ====== زیرنویس ====== */
.cpwa-subtitle {
    font-size: 15px;
    color: #666;
    margin: 0 0 16px 0;
    line-height: 1.6;
}

/* ====== خط جداکننده ====== */
.cpwa-divider {
    border: none;
    border-top: 1px solid #e8e8ed;
    margin: 16px 0 20px 0;
}

/* ====== عنوان نصب ====== */
.cpwa-install-title {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 10px 0;
}

.cpwa-install-desc {
    font-size: 14px;
    color: #555;
    margin: 0 0 16px 0;
    line-height: 1.6;
}

#cpwa-site-name-ios,
#cpwa-site-name-android,
#cpwa-site-name-general {
    font-weight: 700;
    color: #1a1a1a;
}

/* ====== لیست مراحل ====== */
.cpwa-steps {
    list-style: none;
    padding: 0;
    margin: 0 0 24px 0;
    text-align: right;
}

.cpwa-steps li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid #f0f0f2;
}

.cpwa-steps li:last-child {
    border-bottom: none;
}

/* ====== دایره شماره‌گذاری (مینمال و بسیار کوچک) ====== */
.cpwa-step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 10px;
    font-weight: 600;
    flex-shrink: 0;
    margin-top: 2px;
    font-family: inherit !important;
    line-height: 1;
}

.cpwa-step-text {
    font-size: 14px;
    color: #333;
    line-height: 1.6;
}

.cpwa-step-text strong {
    color: #1a1a1a;
    font-weight: 700;
}

/* ====== آیکون‌های اختصاصی سافاری ====== */
.cpwa-step-icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    margin-left: 4px;
    vertical-align: middle;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* آیکون اشتراک‌گذاری سافاری */
.cpwa-step-icon.safari-share {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23007aff'%3E%3Cpath d='M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81 1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9c-1.66 0-3 1.34-3 3s1.34 3 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.16c-.05.21-.08.43-.08.65 0 1.61 1.31 2.92 2.92 2.92 1.61 0 2.92-1.31 2.92-2.92s-1.31-2.92-2.92-2.92z'/%3E%3C/svg%3E");
}

/* آیکون افزودن به صفحه اصلی سافاری */
.cpwa-step-icon.safari-add {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23007aff'%3E%3Cpath d='M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z'/%3E%3C/svg%3E");
}

/* آیکون تایید/انجام شده سافاری */
.cpwa-step-icon.safari-done {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2334c759'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
}

/* ====== دکمه متوجه شدم ====== */
#cpwa-close-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 14px;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
    letter-spacing: 0.3px;
    margin-top: 4px;
}

#cpwa-close-btn:hover {
    opacity: 0.9;
}

#cpwa-close-btn:active {
    transform: scale(0.98);
}

/* ====== اسکرول‌بار مودال ====== */
#cpwa-modal::-webkit-scrollbar {
    width: 4px;
}

#cpwa-modal::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

#cpwa-modal::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

#cpwa-modal::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

#cpwa-modal {
    scrollbar-width: thin;
    scrollbar-color: #ccc #f1f1f1;
}

/* ====== ریسپانسیو ====== */

/* تبلت و موبایل بزرگ */
@media (max-width: 768px) {
    #cpwa-modal {
        max-width: 100%;
        border-radius: 24px 24px 0 0;
    }
    .cpwa-modal-content {
        padding: 28px 20px 24px;
    }
}

/* موبایل */
@media (max-width: 480px) {
    #cpwa-modal {
        border-radius: 20px 20px 0 0;
        max-height: 80vh;
    }
    .cpwa-modal-content {
        padding: 24px 16px 20px;
    }
    
    #cpwa-site-logo {
        width: 64px;
        height: 64px;
        border-radius: 16px;
    }
    
    #cpwa-site-title {
        font-size: 19px;
    }
    
    .cpwa-subtitle {
        font-size: 14px;
    }
    
    .cpwa-install-title {
        font-size: 17px;
    }
    
    .cpwa-step-text {
        font-size: 13px;
    }
    
    .cpwa-step-number {
        min-width: 16px;
        height: 16px;
        font-size: 9px;
    }
    
    .cpwa-step-icon {
        width: 16px;
        height: 16px;
    }
    
    #cpwa-close-btn {
        font-size: 16px;
        padding: 13px;
        border-radius: 12px;
    }
    
    #cpwa-modal::before {
        width: 32px;
        height: 3px;
        top: 8px;
    }
}

/* موبایل خیلی کوچک */
@media (max-width: 380px) {
    .cpwa-modal-content {
        padding: 20px 12px 16px;
    }
    
    #cpwa-site-logo {
        width: 52px;
        height: 52px;
    }
    
    #cpwa-site-title {
        font-size: 16px;
    }
    
    .cpwa-step-text {
        font-size: 12px;
    }
    
    .cpwa-step-number {
        min-width: 14px;
        height: 14px;
        font-size: 8px;
    }
    
    #cpwa-close-btn {
        font-size: 14px;
        padding: 11px;
    }
    
    #cpwa-modal::before {
        width: 28px;
        height: 3px;
        top: 6px;
    }
}

/* ====== حالت تاریک (Dark Mode) ====== */
@media (prefers-color-scheme: dark) {
    #cpwa-modal {
        background: #1c1c1e;
    }
    
    #cpwa-modal::before {
        background: #3a3a3c;
    }
    
    #cpwa-site-title {
        color: #f5f5f7;
    }
    
    .cpwa-subtitle {
        color: #a1a1a6;
    }
    
    .cpwa-install-title {
        color: #f5f5f7;
    }
    
    .cpwa-install-desc {
        color: #a1a1a6;
    }
    
    .cpwa-step-text {
        color: #d1d1d6;
    }
    
    .cpwa-step-text strong {
        color: #f5f5f7;
    }
    
    .cpwa-steps li {
        border-bottom-color: #2c2c2e;
    }
    
    .cpwa-divider {
        border-top-color: #2c2c2e;
    }
    
    #cpwa-site-name-ios,
    #cpwa-site-name-android,
    #cpwa-site-name-general {
        color: #f5f5f7;
    }
    
    #cpwa-modal::-webkit-scrollbar-track {
        background: #2c2c2e;
    }
    
    #cpwa-modal::-webkit-scrollbar-thumb {
        background: #555;
    }
    
    #cpwa-modal {
        scrollbar-color: #555 #2c2c2e;
    }
}