/* AmanaGestion — application installable : bouton « Installer », invitation sur téléphone,
   guide iPhone et bandeau « pas de connexion internet » (voir scripts/pwa.js). */

:root {
    --pwa-surface: #ffffff;
    --pwa-encre: #0f172a;
    --pwa-doux: #5b6b78;
    --pwa-bord: #dfe7e3;
    --pwa-vert: #059669;
    --pwa-vert-fonce: #047857;
    --pwa-vert-clair: #ecfdf5;
    --pwa-alerte: #92400e;
    --pwa-alerte-fond: #fffbeb;
    --pwa-alerte-bord: #f59e0b;
    --pwa-ok: #065f46;
    --pwa-ok-fond: #ecfdf5;
    --pwa-ok-bord: #10b981;
    --pwa-ombre: 0 18px 40px -18px rgba(6, 44, 34, .45);
}

html[data-theme="dark"] {
    --pwa-surface: #141b18;
    --pwa-encre: #e1ebe6;
    --pwa-doux: #a4ada9;
    --pwa-bord: #313c36;
    --pwa-vert-clair: #12302a;
    --pwa-alerte: #fde68a;
    --pwa-alerte-fond: #2a2210;
    --pwa-ok: #a7f3d0;
    --pwa-ok-fond: #0f2a22;
    --pwa-ombre: 0 18px 40px -18px rgba(0, 0, 0, .8);
}

[data-pwa-installer][hidden] { display: none !important; }

/* Bouton de la barre du haut */
.nav-chip.pwa-chip {
    cursor: pointer;
    color: var(--pwa-vert-fonce);
    background: var(--pwa-vert-clair);
    border-color: #a7f3d0;
}
.nav-chip.pwa-chip:hover { border-color: var(--pwa-vert); }
html[data-theme="dark"] .nav-chip.pwa-chip { color: #6ee7b7; border-color: #1f5a49; }
.pwa-chip svg { width: 16px; height: 16px; }
/* Téléphone : icône seule (le nom du centre garde sa place ; l'invitation en bas explique) */
@media (max-width: 575.98px) {
    .nav-chip.pwa-chip { width: 36px; padding: 0; justify-content: center; }
    .nav-chip.pwa-chip span { display: none; }
}

/* Carte de la page de connexion (même allure que « Découvrir l'application ») */
button.auth-alt {
    width: 100%;
    margin-top: 10px;
    font: inherit;
    text-align: start;
    cursor: pointer;
}
.auth-alt-installer .auth-alt-icon svg { width: 20px; height: 20px; }

/* Zone en bas de l'écran */
.pwa-zone {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 0 12px calc(12px + env(safe-area-inset-bottom, 0px));
    pointer-events: none;
}
.pwa-zone > * { pointer-events: auto; width: 100%; max-width: 520px; }

.pwa-bandeau {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 10px 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--pwa-alerte-bord);
    background: var(--pwa-alerte-fond);
    color: var(--pwa-alerte);
    box-shadow: var(--pwa-ombre);
    font-size: .9rem;
    font-weight: 600;
    line-height: 1.45;
    animation: pwa-entree .25s ease-out;
}
html[dir="rtl"] .pwa-bandeau { padding: 12px 14px 12px 10px; }
.pwa-bandeau.is-ok { border-color: var(--pwa-ok-bord); background: var(--pwa-ok-fond); color: var(--pwa-ok); }
.pwa-bandeau-ico svg { width: 20px; height: 20px; display: block; margin-top: 1px; }
.pwa-bandeau-txt { flex: 1; min-width: 0; }

.pwa-fermer {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    margin: -4px 0;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: inherit;
    opacity: .75;
    cursor: pointer;
}
.pwa-fermer:hover { opacity: 1; background: rgba(15, 23, 42, .06); }
.pwa-fermer svg { width: 16px; height: 16px; }

/* Invitation à installer (téléphones) */
.pwa-invitation {
    display: grid;
    grid-template-columns: 44px 1fr;
    gap: 10px 12px;
    align-items: center;
    padding: 14px;
    border-radius: 16px;
    border: 1px solid var(--pwa-bord);
    background: var(--pwa-surface);
    color: var(--pwa-encre);
    box-shadow: var(--pwa-ombre);
    animation: pwa-entree .3s ease-out;
}
.pwa-inv-icone { border-radius: 12px; }
.pwa-inv-texte strong { display: block; font-size: .95rem; }
.pwa-inv-texte span { display: block; font-size: .84rem; color: var(--pwa-doux); line-height: 1.4; }
.pwa-inv-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; }

.pwa-btn {
    min-height: 42px;
    padding: 0 18px;
    border: 0;
    border-radius: 11px;
    background: var(--pwa-vert);
    color: #fff;
    font: inherit;
    font-size: .9rem;
    font-weight: 700;
    cursor: pointer;
}
.pwa-btn:hover { background: var(--pwa-vert-fonce); }
.pwa-btn-discret { background: transparent; color: var(--pwa-doux); }
.pwa-btn-discret:hover { background: rgba(15, 23, 42, .06); color: var(--pwa-encre); }
.pwa-btn-large { width: 100%; min-height: 48px; }
.pwa-btn:focus-visible, .pwa-fermer:focus-visible { outline: 3px solid #f59e0b; outline-offset: 2px; }

/* Guide iPhone / iPad */
.pwa-guide {
    position: fixed;
    inset: 0;
    z-index: 1110;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: rgba(6, 44, 34, .55);
    animation: pwa-fondu .2s ease-out;
}
.pwa-guide-carte {
    width: 100%;
    max-width: 440px;
    padding: 18px 18px calc(18px + env(safe-area-inset-bottom, 0px));
    border-radius: 20px 20px 0 0;
    background: var(--pwa-surface);
    color: var(--pwa-encre);
    animation: pwa-entree .25s ease-out;
}
@media (min-width: 576px) {
    .pwa-guide { align-items: center; }
    .pwa-guide-carte { border-radius: 20px; padding-bottom: 18px; }
}
.pwa-guide-tete { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.pwa-guide-tete h2 { flex: 1; margin: 0; font-size: 1.1rem; font-weight: 800; color: var(--pwa-encre); }
.pwa-guide-etapes { list-style: none; counter-reset: etape; margin: 0 0 12px; padding: 0; }
.pwa-guide-etapes li {
    counter-increment: etape;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--pwa-bord);
    font-weight: 600;
}
.pwa-guide-etapes li::before {
    content: counter(etape);
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--pwa-vert-clair);
    color: var(--pwa-vert-fonce);
    font-size: .85rem;
    font-weight: 800;
}
html[data-theme="dark"] .pwa-guide-etapes li::before { color: #6ee7b7; }
.pwa-guide-txt { flex: 1; }
.pwa-guide-ico { flex-shrink: 0; color: #007aff; }
.pwa-guide-ico svg { width: 26px; height: 26px; display: block; }
.pwa-guide-note { margin: 0 0 14px; font-size: .84rem; color: var(--pwa-doux); line-height: 1.45; }

@keyframes pwa-entree { from { transform: translateY(12px); opacity: 0; } }
@keyframes pwa-fondu { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
    .pwa-bandeau, .pwa-invitation, .pwa-guide, .pwa-guide-carte { animation: none; }
}
@media print {
    .pwa-zone, .pwa-guide, [data-pwa-installer] { display: none !important; }
}
