/**
 * assets/css/pwa.css
 * Styles for Progressive Web App features, Install Prompts, Offline Toasts, and Modals.
 */

/* ── 1. Floating PWA Install Banner ───────────────────────────────────────── */
.pwa-install-banner {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 480px;
    z-index: 99999;
    background: #FFFFFF;
    border-radius: 16px;
    box-shadow: 0 12px 32px -4px rgba(15, 23, 42, 0.18), 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(226, 232, 240, 0.9);
    padding: 12px 14px;
    backdrop-filter: blur(8px);
}

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

.pwa-banner-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    object-fit: contain;
    background: #FFFFFF;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
    padding: 2px;
}

.pwa-banner-content {
    flex: 1;
    min-width: 0;
    padding-right: 18px;
}

.pwa-banner-title {
    font-size: 13.5px;
    font-weight: 700;
    color: #0F172A;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pwa-banner-desc {
    font-size: 11.5px;
    color: #64748B;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

.pwa-banner-actions {
    flex-shrink: 0;
}

.btn-pwa-install {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 14px;
    background: var(--primary-color, #D32F2F);
    color: #FFFFFF;
    font-size: 12.5px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 3px 8px rgba(211, 47, 47, 0.25);
}

.btn-pwa-install:hover {
    background: #B71C1C;
    transform: translateY(-1px);
}

.pwa-banner-close {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 22px;
    height: 22px;
    background: #F1F5F9;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748B;
    cursor: pointer;
    padding: 0;
    transition: background 0.15s ease;
}

.pwa-banner-close:hover {
    background: #E2E8F0;
    color: #0F172A;
}

/* ── 2. Connection Status Toast (Online / Offline) ────────────────────────── */
.pwa-status-toast {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100000;
    padding: 10px 18px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.pwa-status-toast.offline {
    background: #B91C1C;
    color: #FFFFFF;
}

.pwa-status-toast.online {
    background: #15803D;
    color: #FFFFFF;
}

/* ── 3. Notification & Update Toasts ─────────────────────────────────────── */
.pwa-notification-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100000;
    padding: 11px 20px;
    border-radius: 12px;
    font-size: 13.5px;
    font-weight: 500;
    background: #1E293B;
    color: #FFFFFF;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.pwa-notification-toast.success {
    background: #16A34A;
}

.pwa-update-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 100000;
    padding: 12px 18px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    background: #0F172A;
    color: #FFFFFF;
    display: flex;
    align-items: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
}

/* ── 4. iOS Add to Home Screen Modal ─────────────────────────────────────── */
.pwa-ios-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 100000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 16px;
}

.pwa-ios-modal {
    background: #FFFFFF;
    border-radius: 20px 20px 16px 16px;
    width: 100%;
    max-width: 440px;
    padding: 24px 20px;
    position: relative;
    text-align: center;
    animation: pwaSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.pwa-ios-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: none;
    border: none;
    font-size: 22px;
    color: #64748B;
    cursor: pointer;
}

.pwa-ios-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    margin: 0 auto 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.pwa-ios-steps {
    text-align: left;
    margin: 16px 0;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    padding: 12px 14px;
}

.step-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #334155;
    padding: 8px 0;
}

.step-item:not(:last-child) {
    border-bottom: 1px solid #EEF2F6;
}

.step-num {
    width: 22px;
    height: 22px;
    background: var(--primary-color, #D32F2F);
    color: #FFFFFF;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

/* ── 5. Animations ───────────────────────────────────────────────────────── */
@keyframes pwaSlideUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in-up {
    animation: pwaFadeInUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-fade-out-down {
    animation: pwaFadeOutDown 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-slide-in {
    animation: pwaSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-slide-out {
    animation: pwaSlideOut 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes pwaFadeInUp {
    from {
        opacity: 0;
        transform: translate(-50%, 30px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

@keyframes pwaFadeOutDown {
    from {
        opacity: 1;
        transform: translate(-50%, 0);
    }
    to {
        opacity: 0;
        transform: translate(-50%, 30px);
    }
}

@keyframes pwaSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

@keyframes pwaSlideOut {
    from {
        opacity: 1;
        transform: translate(-50%, 0);
    }
    to {
        opacity: 0;
        transform: translate(-50%, -20px);
    }
}

@media (max-width: 576px) {
    .pwa-install-banner {
        bottom: 12px;
        width: calc(100% - 20px);
        padding: 10px 12px;
    }
    .pwa-banner-icon {
        width: 38px;
        height: 38px;
    }
    .pwa-banner-title {
        font-size: 12.5px;
    }
    .pwa-banner-desc {
        font-size: 10.5px;
    }
    .btn-pwa-install {
        padding: 6px 11px;
        font-size: 11.5px;
    }
}
