/* ═══════════════════════════════════════════════════
   مودال آفلاین بودن
   ═══════════════════════════════════════════════════ */

.offline-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    direction: rtl;
    font-family: var(--font-ui, inherit);
}

.offline-modal.is-visible {
    display: flex;
    animation: offlineFadeIn 0.25s ease;
}

.offline-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 23, 0.68);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.offline-modal__card {
    position: relative;
    background: #ffffff;
    border-radius: 24px;
    padding: 32px 26px 24px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow:
        0 24px 60px -12px rgba(0, 0, 0, 0.4),
        0 8px 24px -8px rgba(220, 38, 38, 0.15);
    animation: offlineSlideUp 0.32s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.offline-modal__icon {
    width: 76px;
    height: 76px;
    margin: 0 auto 18px;
    background: linear-gradient(135deg, #FBEAEA 0%, #F5D5D5 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #DC2626;
    position: relative;
}

.offline-modal__icon::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(220, 38, 38, 0.15);
    animation: offlinePulse 2s ease-in-out infinite;
}

.offline-modal__icon svg {
    width: 38px;
    height: 38px;
    position: relative;
    z-index: 1;
}

.offline-modal__title {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 10px;
    color: #202B2B;
    line-height: 1.5;
}

.offline-modal__text {
    font-size: .9rem;
    line-height: 1.85;
    color: #747B7B;
    margin: 0 0 22px;
}

.offline-modal__retry {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 20px;
    background: #155E59;
    color: #ffffff;
    border: none;
    border-radius: 14px;
    font-family: inherit;
    font-size: .95rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
    box-shadow: 0 6px 18px -6px rgba(21, 94, 89, 0.5);
    -webkit-tap-highlight-color: transparent;
}

.offline-modal__retry:hover:not(:disabled) {
    background: #104A46;
    box-shadow: 0 8px 22px -6px rgba(21, 94, 89, 0.6);
}

.offline-modal__retry:active:not(:disabled) {
    transform: scale(0.98);
}

.offline-modal__retry:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.offline-modal__retry svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    animation: offlineSpin 1s linear infinite;
    animation-play-state: paused;
}

.offline-modal__retry:disabled svg {
    animation-play-state: running;
}

.offline-modal__status {
    margin-top: 14px;
    font-size: .8rem;
    color: #DC2626;
    min-height: 20px;
    line-height: 1.6;
    font-weight: 500;
}

/* ─── Dark mode ─── */
@media (prefers-color-scheme: dark) {
    .offline-modal__card {
        background: #17201D;
    }
    .offline-modal__title {
        color: #EDEFEC;
    }
    .offline-modal__text {
        color: #9AA6A3;
    }
}

/* ─── انیمیشن‌ها ─── */
@keyframes offlineFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes offlineSlideUp {
    from { opacity: 0; transform: translateY(30px) scale(0.94); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes offlinePulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50%      { transform: scale(1.08); opacity: 0.2; }
}

@keyframes offlineSpin {
    to { transform: rotate(360deg); }
}

/* ─── موبایل ─── */
@media (max-width: 480px) {
    .offline-modal__card {
        padding: 28px 20px 22px;
        border-radius: 20px;
    }
    .offline-modal__icon {
        width: 68px;
        height: 68px;
        margin-bottom: 16px;
    }
    .offline-modal__icon svg {
        width: 32px;
        height: 32px;
    }
    .offline-modal__title {
        font-size: 1.05rem;
    }
    .offline-modal__text {
        font-size: .85rem;
    }
}

/* ─── Safe area (iPhone notch, Android gesture bar) ─── */
@supports (padding: env(safe-area-inset-top)) {
    .offline-modal {
        padding-top: calc(20px + env(safe-area-inset-top));
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }
}