/**
 * MarocPsy PWA Modern Styles (2024-2026 UX)
 */

/* 1. Bannière d'Installation Flottante Inférieure */
.pwa-banner {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    max-width: 500px;
    margin: 0 auto;
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 20px 40px -10px rgba(15, 23, 42, 0.22), 0 0 1px 1px rgba(15, 23, 42, 0.08);
    padding: 16px;
    z-index: 99999;
    display: flex;
    align-items: center;
    gap: 14px;
    transform: translateY(120%);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
    border: 1px solid rgba(2, 132, 199, 0.15);
}
.pwa-banner.pwa-visible {
    transform: translateY(0);
    opacity: 1;
}
.pwa-banner-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    object-fit: contain;
    background: #f8fafc;
    padding: 4px;
    border: 1px solid #e2e8f0;
    flex-shrink: 0;
}
.pwa-banner-content {
    flex: 1;
    min-width: 0;
}
.pwa-banner-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pwa-banner-subtitle {
    font-size: 0.8rem;
    color: #64748b;
    margin: 0;
    line-height: 1.3;
}
.pwa-banner-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #0284c7;
    background: #e0f2fe;
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 4px;
}
.pwa-banner-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.pwa-btn-install {
    background: #0284c7;
    color: #ffffff;
    border: none;
    padding: 9px 16px;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
}
.pwa-btn-install:hover {
    background: #0369a1;
    transform: scale(1.02);
}
.pwa-btn-close {
    background: transparent;
    border: none;
    color: #94a3b8;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: background 0.2s, color 0.2s;
}
.pwa-btn-close:hover {
    background: #f1f5f9;
    color: #475569;
}

/* 2. Modal d'Installation Central */
.pwa-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s;
}
.pwa-modal-backdrop.pwa-visible {
    opacity: 1;
    visibility: visible;
}
.pwa-modal {
    background: #ffffff;
    border-radius: 24px;
    max-width: 440px;
    width: 100%;
    padding: 32px 24px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    position: relative;
    transform: scale(0.92);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.pwa-modal-backdrop.pwa-visible .pwa-modal {
    transform: scale(1);
}
.pwa-modal-icon {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    object-fit: contain;
    margin: 0 auto 16px;
    box-shadow: 0 8px 20px -4px rgba(2, 132, 199, 0.35);
    padding: 4px;
    background: #fff;
    border: 1px solid #e2e8f0;
}
.pwa-modal-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 8px;
}
.pwa-modal-desc {
    font-size: 0.9rem;
    color: #64748b;
    margin: 0 0 20px;
    line-height: 1.5;
}
.pwa-features-list {
    list-style: none;
    padding: 0;
    margin: 0 0 24px;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
[dir="rtl"] .pwa-features-list {
    text-align: right;
}
.pwa-feature-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.88rem;
    color: #334155;
}
.pwa-feature-item i {
    color: #0284c7;
    font-size: 0.95rem;
    width: 20px;
    text-align: center;
}
.pwa-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.pwa-btn-dismiss {
    background: transparent;
    border: none;
    color: #64748b;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    padding: 8px;
    transition: color 0.2s;
}
.pwa-btn-dismiss:hover {
    color: #0f172a;
}

/* 3. Assistant iOS Safari */
.pwa-ios-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -10px 40px rgba(15, 23, 42, 0.2);
    padding: 24px 20px calc(24px + env(safe-area-inset-bottom, 0px));
    z-index: 99999;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    max-width: 520px;
    margin: 0 auto;
}
.pwa-ios-sheet.pwa-visible {
    transform: translateY(0);
}
.pwa-ios-sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.pwa-ios-steps {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 20px;
}
.pwa-ios-step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 0.9rem;
    color: #334155;
    line-height: 1.4;
}
.pwa-ios-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #0284c7;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}
.pwa-ios-icon-box {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 700;
    color: #0f172a;
}

/* 4. Toasts : Mise à jour & Connectivité */
.pwa-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: #0f172a;
    color: #ffffff;
    padding: 12px 20px;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
    z-index: 100000;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
}
.pwa-toast.pwa-visible {
    transform: translateX(-50%) translateY(0);
}
.pwa-toast-btn {
    background: #0284c7;
    color: #ffffff;
    border: none;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}
.pwa-toast-btn:hover {
    background: #38bdf8;
}

/* 5. Bouton Flottant (FAB) & Bouton Header */
.pwa-fab-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #0284c7;
    color: #ffffff;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    box-shadow: 0 8px 24px rgba(2, 132, 199, 0.4);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    z-index: 99998;
    transition: transform 0.2s, background 0.2s;
}
.pwa-fab-btn:hover {
    transform: scale(1.08);
    background: #0369a1;
}
.pwa-header-btn {
    background: rgba(2, 132, 199, 0.1);
    color: #0284c7;
    border: 1px solid rgba(2, 132, 199, 0.25);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}
.pwa-header-btn:hover {
    background: #0284c7;
    color: #ffffff;
}

/* Support RTL pour l'Arabe */
[dir="rtl"] .pwa-banner {
    direction: rtl;
}
[dir="rtl"] .pwa-fab-btn {
    right: auto;
    left: 24px;
}
