/* =========================================================
   شاویرا - استایل بنر نصب PWA (Add to Home Screen)
   ========================================================= */

.pwa-install-banner {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 9999;
    max-width: 460px;
    margin: 0 auto;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(15, 23, 42, .18), 0 2px 8px rgba(15, 23, 42, .08);
    border: 1px solid rgba(15, 23, 42, .06);
    padding: 14px;
    animation: pwaSlideUp .45s cubic-bezier(.22, 1, .36, 1);
}

@keyframes pwaSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pwa-install-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.pwa-install-close {
    position: absolute;
    top: -8px;
    left: -6px;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 50%;
    background: #f1f5f9;
    color: #64748b;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s ease, color .15s ease;
}

    .pwa-install-close:hover {
        background: #e2e8f0;
        color: #0f172a;
    }

.pwa-install-icon img {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 8, .18);
    flex-shrink: 0;
    object-fit: cover;
}

.pwa-install-text {
    flex: 1;
    min-width: 0;
}

.pwa-install-title {
    font-weight: 800;
    font-size: .95rem;
    color: #0f172a;
    margin-bottom: 2px;
}

.pwa-install-desc {
    font-size: .78rem;
    color: #64748b;
    line-height: 1.5;
}

.pwa-install-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    border: none;
    border-radius: 12px;
    padding: 10px 16px;
    font-size: .82rem;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, #fc0c0d, #ff5d5e);
    box-shadow: 0 6px 16px rgba(252, 12, 13, .3);
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
    white-space: nowrap;
}

    .pwa-install-btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 8px 20px rgba(252, 12, 13, .38);
    }

    .pwa-install-btn:active {
        transform: translateY(0);
    }

    .pwa-install-btn:disabled {
        opacity: .65;
        cursor: default;
        transform: none;
        box-shadow: none;
    }

.pwa-install-btn-icon {
    display: inline-flex;
    animation: pwaBounce 1.4s ease-in-out infinite;
}

@keyframes pwaBounce {
    0%, 100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(3px);
    }
}

.pwa-install-btn.is-loading .pwa-install-btn-icon {
    animation: pwaSpin .9s linear infinite;
}

@keyframes pwaSpin {
    to {
        transform: rotate(360deg);
    }
}

/* ===================== نوار وضعیت دانلود / نصب ===================== */
.pwa-install-progress {
    margin-top: 12px;
    animation: pwaFadeIn .25s ease;
}

@keyframes pwaFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.pwa-progress-track {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: #eef1f4;
    overflow: hidden;
    position: relative;
}

.pwa-progress-fill {
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: linear-gradient(90deg, #fc0c0d, #ff9f43);
    transition: width .35s ease;
    position: relative;
    overflow: hidden;
}

    .pwa-progress-fill::after {
        content: "";
        position: absolute;
        inset: 0;
        background-image: linear-gradient( 135deg, rgba(255,255,255,.35) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.35) 50%, rgba(255,255,255,.35) 75%, transparent 75%, transparent );
        background-size: 22px 22px;
        animation: pwaStripes 1s linear infinite;
    }

@keyframes pwaStripes {
    from {
        background-position: 0 0;
    }

    to {
        background-position: 22px 0;
    }
}

.pwa-install-progress.is-done .pwa-progress-fill {
    background: linear-gradient(90deg, #16a34a, #22c55e);
}

    .pwa-install-progress.is-done .pwa-progress-fill::after {
        display: none;
    }

.pwa-progress-label {
    margin-top: 6px;
    font-size: .74rem;
    color: #64748b;
    text-align: center;
}

.pwa-install-progress.is-done .pwa-progress-label {
    color: #16a34a;
    font-weight: 700;
}

/* ===================== راهنمای نصب iOS ===================== */
.pwa-ios-guide {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pwa-ios-step {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .8rem;
    color: #334155;
    background: #f8fafc;
    border-radius: 10px;
    padding: 8px 10px;
}

.pwa-ios-num {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #0f172a;
    color: #fff;
    font-size: .72rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pwa-ios-share-icon {
    font-size: 1rem;
}

.pwa-ios-guide-close {
    align-self: center;
    margin-top: 2px;
    border: none;
    background: #0f172a;
    color: #fff;
    font-size: .8rem;
    font-weight: 700;
    padding: 8px 22px;
    border-radius: 10px;
    cursor: pointer;
}

/* ===================== دکمه ثابت دانلود/نصب ===================== */
.pwa-fixed-install-btn {
    position: fixed;
    left: 16px;
    bottom: 80px;
    z-index: 9998;
    display: flex;
    align-items: center;
    gap: 8px;
    border: none;
    border-radius: 999px;
    padding: 12px 18px;
    background: linear-gradient(135deg, #fc0c0d, #ff5d5e);
    color: #fff;
    font-size: .82rem;
    font-weight: 800;
    box-shadow: 0 8px 22px rgba(252, 12, 13, .35), 0 2px 6px rgba(15, 23, 42, .12);
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease;
    animation: pwaFabIn .4s cubic-bezier(.22, 1, .36, 1);
}

    .pwa-fixed-install-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 10px 26px rgba(252, 12, 13, .42), 0 2px 6px rgba(15, 23, 42, .12);
    }

    .pwa-fixed-install-btn:active {
        transform: translateY(0);
    }

    .pwa-fixed-install-btn svg {
        flex-shrink: 0;
        animation: pwaBounce 1.6s ease-in-out infinite;
    }

@keyframes pwaFabIn {
    from {
        opacity: 0;
        transform: scale(.7);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* وقتی بنر اصلی هم روی صفحه باز است، دکمه ثابت را بالاتر ببر تا رویش نیفتد */
.pwa-fixed-install-btn.pwa-fixed-raised {
    bottom: 172px;
}

@media (max-width: 380px) {
    .pwa-fixed-install-text {
        display: none;
    }

    .pwa-fixed-install-btn {
        padding: 12px;
    }
}

@media (max-width: 380px) {
    .pwa-install-title {
        font-size: .88rem;
    }

    .pwa-install-desc {
        font-size: .72rem;
    }

    .pwa-install-btn-text {
        display: none;
    }

    .pwa-install-btn {
        padding: 10px;
        border-radius: 50%;
    }
}
