/* ============================================================================
   GalereLand — PWA UI (bouton install, banner notifs, modal reward, modal prefs)
   Sprint PWA 1.0
   ============================================================================ */

/* ---- Bouton flottant "Installer l'app" ---------------------------------- */
.pwa-install-btn {
    position: fixed;
    right: 16px;
    bottom: 78px;
    z-index: 9500;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px 12px 14px;
    background: linear-gradient(135deg, #ff8c1a, #ff5500);
    color: #fff;
    border: none;
    border-radius: 999px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(255, 85, 0, 0.4), 0 0 0 1px rgba(255, 180, 100, 0.2);
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.25s ease;
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
}
.pwa-install-btn.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    animation: pwaInstallPulse 2.6s ease-in-out infinite;
}
.pwa-install-btn:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 12px 30px rgba(255, 85, 0, 0.5);
}
.pwa-install-btn .pwa-install-icon {
    width: 22px;
    height: 22px;
    filter: drop-shadow(0 0 6px rgba(255, 220, 160, 0.7));
}
.pwa-install-btn .pwa-install-reward {
    font-size: 0.78rem;
    background: rgba(255, 255, 255, 0.22);
    padding: 2px 8px;
    border-radius: 999px;
    margin-left: 4px;
    font-weight: 800;
    letter-spacing: 0.3px;
}
.pwa-install-btn .pwa-install-close {
    margin-left: 4px;
    background: rgba(0, 0, 0, 0.18);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.15s ease, background 0.15s ease;
    cursor: pointer;
}
.pwa-install-btn .pwa-install-close:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.35);
}
@keyframes pwaInstallPulse {
    0%, 100% { box-shadow: 0 8px 24px rgba(255, 85, 0, 0.4), 0 0 0 1px rgba(255, 180, 100, 0.2); }
    50%      { box-shadow: 0 10px 32px rgba(255, 85, 0, 0.6), 0 0 0 4px rgba(255, 140, 26, 0.25); }
}

/* ---- Banner "Activer les notifications" --------------------------------- */
.pwa-notif-banner {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 9400;
    background: linear-gradient(160deg, #1f1730 0%, #2a1a3d 100%);
    border: 1px solid rgba(255, 140, 26, 0.4);
    border-radius: 14px;
    padding: 14px 16px;
    color: #f1ebe1;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 14px;
    transform: translateY(140%);
    transition: transform 0.3s cubic-bezier(.2, 1.2, .4, 1);
    max-width: 540px;
    margin: 0 auto;
}
.pwa-notif-banner.show { transform: translateY(0); }
.pwa-notif-banner-icon {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    filter: drop-shadow(0 0 6px rgba(255, 140, 26, 0.5));
}
.pwa-notif-banner-text {
    flex: 1;
    font-size: 0.88rem;
    line-height: 1.4;
}
.pwa-notif-banner-text strong { color: #ffb35a; display: block; margin-bottom: 2px; }
.pwa-notif-banner-actions { display: flex; gap: 6px; flex-shrink: 0; }
.pwa-notif-banner-actions button {
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 700;
    font-family: inherit;
}
.pwa-notif-banner-actions .pwa-btn-yes {
    background: linear-gradient(135deg, #ff8c1a, #ff5500);
    color: #fff;
}
.pwa-notif-banner-actions .pwa-btn-no {
    background: rgba(255, 255, 255, 0.08);
    color: #c5b9aa;
}

/* ---- Modal reward "+5000 aura" ------------------------------------------ */
.pwa-reward-overlay {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(4px);
    z-index: 10001;
    display: flex; align-items: center; justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.pwa-reward-overlay.show { opacity: 1; }
.pwa-reward-card {
    background: linear-gradient(160deg, #1f1730 0%, #2a1a3d 100%);
    border: 2px solid #ff8c1a;
    border-radius: 18px;
    padding: 28px 32px;
    max-width: 460px;
    width: 92vw;
    box-shadow: 0 20px 60px rgba(255, 140, 26, 0.35), 0 0 0 1px rgba(255, 140, 26, 0.15);
    color: #f1ebe1;
    text-align: center;
    transform: scale(0.85);
    transition: transform 0.35s cubic-bezier(.2, 1.4, .5, 1);
}
.pwa-reward-overlay.show .pwa-reward-card { transform: scale(1); }
.pwa-reward-icon img {
    width: 64px;
    height: 64px;
    filter: drop-shadow(0 0 18px rgba(255, 140, 26, 0.75));
    animation: pwaRewardIconPulse 2.4s ease-in-out infinite;
}
@keyframes pwaRewardIconPulse {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 18px rgba(255, 140, 26, 0.75)); }
    50%      { transform: scale(1.08); filter: drop-shadow(0 0 26px rgba(255, 140, 26, 1)); }
}
.pwa-reward-card h2 {
    margin: 14px 0 6px;
    font-size: 1.35rem;
    background: linear-gradient(135deg, #ffb35a, #ff5c00);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-weight: 800;
}
.pwa-reward-amount {
    font-size: 2.4rem;
    font-weight: 900;
    background: linear-gradient(135deg, #ffd28a, #ff5c00);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin: 8px 0 12px;
    text-shadow: 0 0 24px rgba(255, 140, 26, 0.4);
    letter-spacing: 1px;
}
.pwa-reward-card p {
    font-size: 0.92rem;
    color: #c5b9aa;
    margin: 0 0 22px;
    line-height: 1.5;
}
.pwa-reward-actions {
    display: flex; gap: 10px; justify-content: center; flex-wrap: wrap;
}
.pwa-reward-btn-primary,
.pwa-reward-btn-secondary {
    border: none;
    border-radius: 12px;
    padding: 12px 22px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
}
.pwa-reward-btn-primary {
    background: linear-gradient(135deg, #ff8c1a, #ff5500);
    color: #fff;
    box-shadow: 0 4px 14px rgba(255, 85, 0, 0.4);
}
.pwa-reward-btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #c5b9aa;
}
.pwa-reward-btn-primary:hover { transform: translateY(-2px); }

/* ---- Modal préférences notifications ------------------------------------ */
.pwa-prefs-overlay {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(4px);
    z-index: 10002;
    display: flex; align-items: center; justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.pwa-prefs-overlay.show { opacity: 1; }
.pwa-prefs-card {
    background: linear-gradient(160deg, #1f1730 0%, #2a1a3d 100%);
    border: 2px solid #ff8c1a;
    border-radius: 18px;
    padding: 24px 28px;
    max-width: 480px;
    width: 92vw;
    max-height: 88vh;
    overflow-y: auto;
    color: #f1ebe1;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(.2, 1.4, .5, 1);
    box-shadow: 0 20px 60px rgba(255, 140, 26, 0.35);
}
.pwa-prefs-overlay.show .pwa-prefs-card { transform: scale(1); }
.pwa-prefs-card h2 {
    margin: 0 0 6px;
    font-size: 1.2rem;
    color: #ffb35a;
}
.pwa-prefs-card .pwa-prefs-sub {
    color: #c5b9aa;
    font-size: 0.85rem;
    margin: 0 0 18px;
}
.pwa-prefs-list { display: flex; flex-direction: column; gap: 10px; }
.pwa-prefs-row {
    display: flex; align-items: center; gap: 12px;
    background: rgba(255, 140, 26, 0.06);
    border-left: 3px solid #ff8c1a;
    padding: 10px 14px;
    border-radius: 10px;
}
.pwa-prefs-row .pwa-prefs-row-icon { font-size: 1.3rem; }
.pwa-prefs-row .pwa-prefs-row-text { flex: 1; }
.pwa-prefs-row .pwa-prefs-row-text strong { display: block; font-size: 0.95rem; }
.pwa-prefs-row .pwa-prefs-row-text span { display: block; font-size: 0.78rem; color: #a09487; }

/* Switch toggle */
.pwa-switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 24px;
    flex-shrink: 0;
}
.pwa-switch input { opacity: 0; width: 0; height: 0; }
.pwa-switch-slider {
    position: absolute; cursor: pointer; inset: 0;
    background-color: #3a2d52;
    transition: 0.25s;
    border-radius: 999px;
}
.pwa-switch-slider:before {
    position: absolute;
    content: "";
    height: 18px; width: 18px;
    left: 3px; bottom: 3px;
    background: #fff;
    transition: 0.25s;
    border-radius: 50%;
}
.pwa-switch input:checked + .pwa-switch-slider {
    background: linear-gradient(135deg, #ff8c1a, #ff5500);
}
.pwa-switch input:checked + .pwa-switch-slider:before {
    transform: translateX(18px);
}

.pwa-prefs-footer {
    margin-top: 18px;
    display: flex; gap: 8px; justify-content: flex-end;
}
.pwa-prefs-footer button {
    border: none;
    border-radius: 10px;
    padding: 10px 18px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
}
.pwa-prefs-footer .pwa-prefs-save {
    background: linear-gradient(135deg, #ff8c1a, #ff5500);
    color: #fff;
}
.pwa-prefs-footer .pwa-prefs-cancel {
    background: rgba(255, 255, 255, 0.08);
    color: #c5b9aa;
}

/* iOS install hint modal */
.pwa-ios-hint-overlay {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.72);
    z-index: 10003;
    display: flex; align-items: flex-end; justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.pwa-ios-hint-overlay.show { opacity: 1; }
.pwa-ios-hint-card {
    background: linear-gradient(160deg, #1f1730 0%, #2a1a3d 100%);
    border-top: 2px solid #ff8c1a;
    border-radius: 18px 18px 0 0;
    padding: 22px 24px;
    max-width: 520px;
    width: 100%;
    color: #f1ebe1;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(.2, 1.2, .4, 1);
}
.pwa-ios-hint-overlay.show .pwa-ios-hint-card { transform: translateY(0); }
.pwa-ios-hint-card h2 { margin: 0 0 8px; color: #ffb35a; font-size: 1.1rem; }
.pwa-ios-hint-card ol { margin: 0; padding-left: 22px; line-height: 1.7; }
.pwa-ios-hint-card .pwa-ios-hint-close {
    width: 100%;
    margin-top: 16px;
    background: linear-gradient(135deg, #ff8c1a, #ff5500);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 12px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
}

/* En standalone mode : on cache le bouton install (déjà installé) */
@media (display-mode: standalone) {
    .pwa-install-btn,
    .pwa-header-install-btn { display: none !important; }
}

/* ---- Bouton rond header (entre theme-toggle et aura-display) ----------- */
.pwa-header-install-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #ff8c1a, #ff5500);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin: 0 6px;
    padding: 0;
    box-shadow: 0 2px 10px rgba(255, 85, 0, 0.45), 0 0 0 1px rgba(255, 180, 100, 0.18);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    animation: pwaHeaderPulse 2.8s ease-in-out infinite;
    flex-shrink: 0;
}
.pwa-header-install-btn:hover,
.pwa-header-install-btn:focus-visible {
    transform: scale(1.08);
    box-shadow: 0 4px 14px rgba(255, 85, 0, 0.6), 0 0 0 3px rgba(255, 140, 26, 0.25);
    outline: none;
}
.pwa-header-install-btn:active {
    transform: scale(0.94);
}
.pwa-header-install-btn svg {
    display: block;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.3));
}
@keyframes pwaHeaderPulse {
    0%, 100% { box-shadow: 0 2px 10px rgba(255, 85, 0, 0.45), 0 0 0 1px rgba(255, 180, 100, 0.18); }
    50%      { box-shadow: 0 3px 14px rgba(255, 85, 0, 0.6), 0 0 0 4px rgba(255, 140, 26, 0.18); }
}
/* Sur très petits écrans, on retire l'animation pulse pour économiser de la batterie */
@media (max-width: 480px) {
    .pwa-header-install-btn { animation: none; width: 34px; height: 34px; margin: 0 4px; }
}

/* ---- Animation slide-fade des notifications quand le panel s'ouvre ----- */
/* Les items du panel notif (annonces, sondages, message admin) glissent
   depuis la gauche en cascade quand l'utilisateur ouvre le panel. */
@keyframes glNotifSlideIn {
    from { opacity: 0; transform: translateX(-22px); }
    to   { opacity: 1; transform: translateX(0); }
}
.notif-panel:not(.hidden) .notif-section {
    animation: glNotifSlideIn 0.38s cubic-bezier(.22, 1, .36, 1) backwards;
}
.notif-panel:not(.hidden) .notif-section:nth-child(1) { animation-delay: 40ms; }
.notif-panel:not(.hidden) .notif-section:nth-child(2) { animation-delay: 110ms; }
.notif-panel:not(.hidden) .notif-section:nth-child(3) { animation-delay: 180ms; }
.notif-panel:not(.hidden) .notif-section:nth-child(4) { animation-delay: 250ms; }
/* Cascade fine dans chaque section (annonces + sondages individuels) */
.notif-panel:not(.hidden) .notif-section > .notif-ann,
.notif-panel:not(.hidden) .notif-section > .notif-poll,
.notif-panel:not(.hidden) .notif-section > .notif-admin-msg {
    animation: glNotifSlideIn 0.42s cubic-bezier(.22, 1, .36, 1) backwards;
}
.notif-panel:not(.hidden) .notif-section > *:nth-child(1) { animation-delay: 100ms; }
.notif-panel:not(.hidden) .notif-section > *:nth-child(2) { animation-delay: 170ms; }
.notif-panel:not(.hidden) .notif-section > *:nth-child(3) { animation-delay: 240ms; }
.notif-panel:not(.hidden) .notif-section > *:nth-child(4) { animation-delay: 310ms; }
.notif-panel:not(.hidden) .notif-section > *:nth-child(5) { animation-delay: 380ms; }
.notif-panel:not(.hidden) .notif-section > *:nth-child(n+6) { animation-delay: 450ms; }
@media (prefers-reduced-motion: reduce) {
    .notif-panel:not(.hidden) .notif-section,
    .notif-panel:not(.hidden) .notif-section > * { animation: none; }
}

/* ---- Bouton "Configurer" dans Paramètres -------------------------------- */
.setting-cta-btn {
    background: linear-gradient(135deg, #ff8c1a, #ff5500);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 2px 8px rgba(255, 85, 0, 0.35);
}
.setting-cta-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 85, 0, 0.5);
}
