/* ===== CHU Anosiala — Page d'authentification =====
   Applique les RÈGLES IHM de chu.css :
   - couleur principale noire (bouton, onglet actif, focus) ;
   - rouge réservé au danger (erreurs de saisie, notification d'erreur) ;
   - icônes colorées, jamais rouges ni orange ;
   - formulaire sans animation en boucle (seulement des retours courts).
   Le fond (photo, aurores, particules) garde ses animations décoratives. */
:root {
    --primaire: #111827;
    --primaire-2: #374151;
    --danger: #c8414b;
    --bord: #e8ebf3;
    --gris: #64748b;
    --nuit: #0b1020;
    --nuit-2: #141a33;
    --verre: rgba(255, 255, 255, .07);
    --verre-bord: rgba(255, 255, 255, .14);
    --texte: #e8ebf5;
    --texte-doux: #9aa3bf;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    background: var(--nuit);
    color: var(--texte);
    overflow-x: hidden;
}

/* ---------- Photo de l'hôpital (vue aérienne, site officiel du CHU) ---------- */
.photo-fond {
    position: fixed; inset: 0; z-index: 0; pointer-events: none;
    background: linear-gradient(180deg, rgba(11, 16, 32, .72), rgba(11, 16, 32, .9)), url(../../img/hopital.jpg) center / cover no-repeat;
}

/* ---------- Fond animé : aurores + grille ---------- */
.aurora { position: fixed; inset: 0; overflow: hidden; z-index: 0; }
.aurora .blob {
    position: absolute; border-radius: 50%; filter: blur(90px); opacity: .55;
    animation: derive 18s ease-in-out infinite alternate;
    will-change: transform;
}
.blob.b1 { width: 520px; height: 520px; background: #4f46e5; opacity: .4; top: -140px; left: -120px; }
.blob.b2 { width: 460px; height: 460px; background: #7c3aed; bottom: -160px; right: -100px; animation-duration: 22s; opacity: .35; }
.blob.b3 { width: 380px; height: 380px; background: #0d9488; top: 40%; left: 45%; animation-duration: 26s; opacity: .30; }
@keyframes derive {
    0%   { transform: translate(0, 0) scale(1); }
    50%  { transform: translate(80px, 60px) scale(1.15); }
    100% { transform: translate(-60px, 100px) scale(.95); }
}
.grille {
    position: fixed; inset: 0; z-index: 0; pointer-events: none;
    background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
}
.particules { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.particules span {
    position: absolute; bottom: -20px; color: rgba(255,255,255,.25); font-weight: 800;
    animation: monter linear infinite;
}
@keyframes monter {
    from { transform: translateY(0) rotate(0); opacity: 0; }
    10%  { opacity: 1; }
    to   { transform: translateY(-110vh) rotate(180deg); opacity: 0; }
}

/* ---------- Mise en page ---------- */
.scene {
    position: relative; z-index: 1; min-height: 100vh;
    display: grid; grid-template-columns: 1.1fr 1fr; align-items: center;
    gap: 40px; padding: 40px 6vw; max-width: 1400px; margin: 0 auto;
}
@media (max-width: 960px) {
    .scene { grid-template-columns: 1fr; padding: 28px 16px; gap: 28px; }
    .hero .stats, .hero .ecg { display: none; }
}
/* Téléphone : le formulaire doit être visible sans défiler */
@media (max-width: 600px) {
    .scene { align-items: start; gap: 20px; padding: 20px 16px 28px; }
    .hero p.lead, .hero .parcours { display: none; }
    .hero h1 { font-size: 1.6rem; margin: 18px 0 0; }
    .marque .logo { width: 52px; height: 52px; border-radius: 15px; }
    .onglets button { font-size: .9rem; white-space: nowrap; }
}

/* ---------- Héro ---------- */
.marque { display: flex; align-items: center; gap: 14px; }
.marque .logo {
    width: 64px; height: 64px; border-radius: 18px; background: #fff; padding: 6px;
    display: grid; place-items: center; box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
    animation: pulse 2.6s ease-in-out infinite;
}
.marque .logo img { max-width: 100%; max-height: 100%; }
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .35), 0 10px 30px rgba(0, 0, 0, .35); }
    50%      { box-shadow: 0 0 0 14px rgba(255, 255, 255, 0), 0 10px 30px rgba(0, 0, 0, .35); }
}
.marque .nom { font-weight: 800; letter-spacing: .14em; font-size: 15px; }
.marque .sous { font-size: 12px; color: var(--texte-doux); letter-spacing: .04em; }

.hero h1 {
    font-size: clamp(2rem, 4.2vw, 3.6rem); font-weight: 800; line-height: 1.08;
    margin: 34px 0 18px; letter-spacing: -.02em;
}
.hero h1 .degrade {
    background: linear-gradient(90deg, #93c5fd, #c4b5fd, #5eead4, #93c5fd);
    background-size: 300% 100%;
    -webkit-background-clip: text; background-clip: text; color: transparent;
    animation: defile 6s linear infinite;
}
@keyframes defile { to { background-position: 300% 0; } }
.hero p.lead { color: var(--texte-doux); font-size: 1.05rem; max-width: 520px; line-height: 1.7; }

.ecg { margin: 30px 0 10px; max-width: 560px; height: 70px; }
.ecg path {
    fill: none; stroke: url(#gradEcg); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round;
    stroke-dasharray: 1200; stroke-dashoffset: 1200;
    animation: trace 3.2s ease-in-out infinite;
    filter: drop-shadow(0 0 6px rgba(147, 197, 253, .6));
}
@keyframes trace {
    0%   { stroke-dashoffset: 1200; }
    60%  { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -1200; }
}

.stats { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 22px; }
.stat {
    background: var(--verre); border: 1px solid var(--verre-bord); border-radius: 16px;
    padding: 14px 18px; backdrop-filter: blur(12px); min-width: 130px;
    transition: transform .35s cubic-bezier(.2,.8,.2,1), border-color .35s;
}
.stat:hover { transform: translateY(-6px); border-color: rgba(255, 255, 255, .4); }
.stat b { display: block; font-size: 1.5rem; font-weight: 800; }
.stat span { font-size: 12px; color: var(--texte-doux); }

.parcours { display: flex; gap: 8px; margin-top: 26px; flex-wrap: wrap; }
.parcours .etape {
    font-size: 12.5px; padding: 7px 14px; border-radius: 30px; border: 1px solid var(--verre-bord);
    color: var(--texte-doux); transition: all .4s;
}
.parcours .etape.actif { background: #fff; color: var(--primaire); border-color: transparent; box-shadow: 0 6px 20px rgba(0, 0, 0, .3); }

/* ---------- Carte verre ---------- */
.carte {
    position: relative; background: #fff; color: var(--primaire); border: 0;
    border-radius: 24px; padding: 34px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .45);
    transform-style: preserve-3d; transition: transform .2s ease-out;
    max-width: 480px; width: 100%; justify-self: center;
}

.onglets { position: relative; display: grid; grid-template-columns: 1fr 1fr; background: #f1f2f4; border-radius: 14px; padding: 4px; margin-bottom: 26px; }
.onglets button {
    position: relative; z-index: 1; background: none; border: 0; color: var(--gris);
    font: inherit; font-weight: 700; padding: 10px; cursor: pointer; transition: color .25s;
}
.onglets button.actif { color: #fff; }
.onglets .indicateur {
    position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 11px;
    background: var(--primaire);
    box-shadow: 0 4px 12px rgba(17, 24, 39, .25);
    transition: transform .3s cubic-bezier(.65, 0, .35, 1);
}
.onglets.inscription .indicateur { transform: translateX(100%); }

.panneaux { position: relative; overflow: hidden; padding: 0 2px 14px; margin: 0 -2px -14px; }
.panneau { transition: transform .35s cubic-bezier(.65, 0, .35, 1), opacity .3s; }
.panneau.cache { position: absolute; inset: 0 0 auto 0; opacity: 0; pointer-events: none; transform: translateX(40px); }
.panneau.gauche.cache { transform: translateX(-40px); }

.carte h2 { font-size: 1.6rem; font-weight: 800; letter-spacing: -.01em; }
.carte .soustitre { color: var(--gris); font-size: .92rem; margin: 6px 0 22px; }

/* ---------- Champs ---------- */
.champ { position: relative; margin-bottom: 16px; }
.champ input {
    width: 100%; padding: 22px 46px 9px 46px; font: inherit; font-size: .95rem; color: var(--primaire);
    background: #fff; border: 1.5px solid var(--bord); border-radius: 14px;
    outline: none; transition: border-color .3s, background .3s, box-shadow .3s;
}
.champ input:focus { border-color: var(--primaire); box-shadow: 0 0 0 4px rgba(17, 24, 39, .08); }
.champ label {
    position: absolute; left: 46px; top: 16px; color: var(--gris); font-size: .92rem;
    pointer-events: none; transition: all .25s cubic-bezier(.2,.8,.2,1);
}
.champ input:focus + label, .champ input:not(:placeholder-shown) + label { top: 7px; font-size: .7rem; color: var(--primaire); font-weight: 700; letter-spacing: .04em; }
.champ .ico { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--ic, var(--gris)); }
/* Couleur des icônes par type de champ (règle IHM n° 5 : jamais rouge ni orange) */
.ico.i-id     { --ic: #2563eb; }   /* identité : bleu */
.ico.i-compte { --ic: #0284c7; }   /* compte : bleu ciel */
.ico.i-cle    { --ic: #4f46e5; }   /* sécurité : indigo */
.ico.i-lieu   { --ic: #0d9488; }   /* adresse : sarcelle */
.ico.i-tel    { --ic: #0891b2; }   /* téléphone : cyan */
.champ .oeil { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--gris); cursor: pointer; padding: 6px; }
.champ .oeil svg { display: block; }
.champ.erreur input { border-color: var(--danger); box-shadow: 0 0 0 4px rgba(200, 65, 75, .1); animation: secoue .4s; }
.champ.erreur .ico { --ic: var(--danger); }
@keyframes secoue { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.ligne2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .ligne2 { grid-template-columns: 1fr; gap: 0; } .carte { padding: 24px 18px; } }

.options { display: flex; justify-content: space-between; align-items: center; font-size: .85rem; color: var(--gris); margin: 4px 0 22px; }
.options a { color: var(--primaire); font-weight: 700; text-decoration: none; }
.options a:hover { text-decoration: underline; }
.options label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.options input { accent-color: var(--primaire); }

/* ---------- Bouton ---------- */
.btn-principal {
    position: relative; overflow: hidden; width: 100%; border: 0; border-radius: 14px; padding: 15px;
    font: inherit; font-weight: 800; font-size: 1rem; color: #fff; cursor: pointer;
    background: linear-gradient(135deg, var(--primaire), var(--primaire-2));
    box-shadow: 0 8px 20px rgba(17, 24, 39, .3);
    transition: box-shadow .25s, filter .25s;
}
.btn-principal:hover { filter: brightness(1.15); box-shadow: 0 10px 24px rgba(17, 24, 39, .35); }
.btn-principal:focus-visible { outline: 3px solid rgba(17, 24, 39, .25); outline-offset: 2px; }
.btn-principal .spin { display: none; width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: rot .7s linear infinite; vertical-align: -3px; margin-right: 8px; }
.btn-principal.charge .spin { display: inline-block; }
.btn-principal.charge { pointer-events: none; opacity: .9; }
@keyframes rot { to { transform: rotate(360deg); } }
.ripple { position: absolute; border-radius: 50%; background: rgba(255,255,255,.25); transform: scale(0); animation: onde .4s ease-out; pointer-events: none; }
@keyframes onde { to { transform: scale(4); opacity: 0; } }

.legal { font-size: .75rem; color: var(--gris); text-align: center; margin-top: 16px; }

/* ---------- Apparition échelonnée ---------- */
.apparait { opacity: 0; transform: translateY(24px); animation: entre .9s cubic-bezier(.2,.8,.2,1) forwards; }
@keyframes entre { to { opacity: 1; transform: none; } }
.d1 { animation-delay: .1s; } .d2 { animation-delay: .25s; } .d3 { animation-delay: .4s; }
.d4 { animation-delay: .55s; } .d5 { animation-delay: .7s; } .d6 { animation-delay: .85s; }

body.sortie .scene { animation: sortie .45s ease-in forwards; }
@keyframes sortie { to { opacity: 0; transform: scale(.97); filter: blur(6px); } }

/* ---------- Toast ---------- */
.toast-zone { position: fixed; top: 20px; right: 20px; z-index: 99; display: flex; flex-direction: column; gap: 10px; }
.toast {
    display: flex; align-items: center; gap: 12px; min-width: 280px; max-width: 380px;
    background: rgba(20, 26, 51, .92); border: 1px solid var(--verre-bord); border-radius: 14px;
    padding: 12px 16px; backdrop-filter: blur(14px); box-shadow: 0 16px 40px rgba(0,0,0,.4);
    animation: toastIn .5s cubic-bezier(.2,.8,.2,1);
}
.toast.out { animation: toastOut .4s forwards; }
.toast .pastille { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.toast.err .pastille { background: var(--danger); } .toast.ok .pastille { background: #10b981; }
.toast .pastille svg { width: 16px; height: 16px; stroke: #fff; }
.toast p { font-size: .9rem; }
@keyframes toastIn { from { opacity: 0; transform: translateX(60px) scale(.9); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(60px); } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
