/*  Application des parents — pensée pour le pouce, en plein soleil, à une main.
    Les mêmes couleurs que le logiciel de la crèche.                          */

:root {
  --primaire: #2E7D8F;
  --primaire-sombre: #25687A;
  --primaire-claire: #E3F1F4;
  --fond: #F4F6F8;
  --surface: #FFFFFF;
  --texte: #1F2A33;
  --texte-second: #5B6B77;
  --texte-discret: #93A1AC;
  --bordure: #E1E7EB;
  --succes: #2E7D32;
  --succes-clair: #E7F3E8;
  --danger: #C0392B;
  --danger-clair: #FBEAE8;
  --rayon: 14px;
  --ombre: 0 2px 10px rgba(31, 42, 51, .08);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--fond);
  color: var(--texte);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.45;
}

body {
  padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
}

.ecran { max-width: 520px; margin: 0 auto; }
[hidden] { display: none !important; }

/* ------------------------------------------------------------- appairage */
.marque { text-align: center; margin: 40px 0 28px; }
.marque .logo {
  width: 76px; height: 76px; margin: 0 auto 16px;
  border-radius: 24px; background: var(--primaire);
  display: flex; align-items: center; justify-content: center;
  font-size: 38px;
}
.marque h1 { margin: 0; font-size: 26px; }
.sous-titre { color: var(--texte-second); margin: 8px 0 0; font-size: 15px; }

form { background: var(--surface); border-radius: var(--rayon); padding: 20px; box-shadow: var(--ombre); }
label { display: block; font-size: 13px; font-weight: 600; color: var(--texte-second); margin-bottom: 8px; }

input[type=text] {
  width: 100%; height: 58px; padding: 0 16px;
  border: 1px solid var(--bordure); border-radius: 12px;
  background: var(--fond); color: var(--texte);
  font-size: 26px; font-weight: 700; letter-spacing: 6px; text-align: center;
  text-transform: uppercase;
}
input[type=text]:focus { outline: none; border-color: var(--primaire); background: var(--surface); }

.note { color: var(--texte-discret); font-size: 13px; text-align: center; margin-top: 16px; }

/* --------------------------------------------------------------- boutons */
button { font-family: inherit; cursor: pointer; border: none; }

.principal {
  width: 100%; min-height: 56px; margin-top: 16px;
  border-radius: 12px; background: var(--primaire); color: #fff;
  font-size: 17px; font-weight: 700;
}
.principal:active { background: var(--primaire-sombre); }
.principal:disabled { opacity: .5; }

.secondaire {
  width: 100%; min-height: 50px; margin-top: 10px;
  border-radius: 12px; background: transparent; color: var(--danger);
  border: 1px solid var(--bordure); font-size: 15px; font-weight: 600;
}

.lien { background: none; color: var(--texte-discret); font-size: 14px; text-decoration: underline; }

.icone {
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--surface); color: var(--texte-second);
  font-size: 20px; box-shadow: var(--ombre);
}

/* ---------------------------------------------------------------- entête */
.entete { display: flex; align-items: center; justify-content: space-between; margin: 8px 0 18px; }
.entete h1 { margin: 2px 0 0; font-size: 24px; }
.bonjour { margin: 0; color: var(--texte-second); font-size: 14px; }

/* --------------------------------------------------------- carte enfant */
.enfant {
  background: var(--surface); border-radius: var(--rayon);
  box-shadow: var(--ombre); padding: 18px; margin-bottom: 14px;
}

.enfant-tete { display: flex; align-items: center; gap: 14px; }

.portrait {
  width: 56px; height: 56px; border-radius: 50%; flex: 0 0 auto;
  background: var(--primaire); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; font-weight: 700; overflow: hidden;
}
.portrait img { width: 100%; height: 100%; object-fit: cover; }

.enfant-nom { margin: 0; font-size: 19px; font-weight: 700; }
.enfant-section { margin: 2px 0 0; color: var(--texte-discret); font-size: 14px; }

.etat { display: inline-flex; align-items: center; gap: 7px; margin-top: 10px; font-size: 14px; font-weight: 600; }
.etat .pastille { width: 9px; height: 9px; border-radius: 50%; }
.etat.present { color: var(--succes); }
.etat.present .pastille { background: var(--succes); }
.etat.absent { color: var(--texte-discret); }
.etat.absent .pastille { background: var(--texte-discret); }

/* Annonce déjà en cours : on rappelle l'heure plutôt que de proposer à nouveau. */
.en-cours {
  margin-top: 14px; padding: 13px 15px; border-radius: 12px;
  background: var(--primaire-claire); color: var(--primaire-sombre);
  font-size: 15px; font-weight: 600;
}

.impossible { margin-top: 14px; color: var(--texte-discret); font-size: 14px; }

/* ------------------------------------------------- vue de la direction */
.arrivee {
  background: var(--surface); border-radius: var(--rayon);
  box-shadow: var(--ombre); padding: 16px; margin-bottom: 12px;
  border: 1.5px solid transparent;
}
/* La couleur porte l'urgence avant même la lecture. */
.arrivee.imminent { border-color: var(--primaire); }
.arrivee.retard   { border-color: #B8860B; }

.arrivee-qui { flex: 1 1 auto; min-width: 0; }
.arrivee-qui p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.arrivee-delai { flex: 0 0 auto; text-align: right; }
.delai { margin: 0; font-size: 17px; font-weight: 700; color: var(--primaire); }
.arrivee.retard .delai { color: #B8860B; }

.arrivee-actions { display: flex; gap: 10px; margin-top: 14px; }
.arrivee-actions > * { flex: 1 1 0; margin-top: 0; }

.principal.compact, .lien-appel {
  min-height: 46px; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
}
.lien-appel { text-decoration: none; color: var(--primaire); }

.vide { text-align: center; padding: 48px 16px; }
.vide-titre { margin: 0; font-size: 17px; font-weight: 600; color: var(--texte-second); }

/* -------------------------------------------------------- confirmation */
.confirmation { text-align: center; padding-top: 34px; }
.coche {
  width: 84px; height: 84px; margin: 0 auto 20px; border-radius: 50%;
  background: var(--succes-clair); color: var(--succes);
  display: flex; align-items: center; justify-content: center; font-size: 44px;
}
.confirmation h1 { font-size: 24px; margin: 0; }
.confirmation-enfant { color: var(--texte-second); margin: 6px 0 24px; }

.estimation {
  background: var(--surface); border-radius: var(--rayon);
  box-shadow: var(--ombre); padding: 22px; margin-bottom: 18px;
}
.etiquette { margin: 0; font-size: 11px; font-weight: 700; letter-spacing: .5px; color: var(--texte-discret); }
.minutes { margin: 8px 0 0; font-size: 40px; font-weight: 700; color: var(--primaire); line-height: 1; }
.heure { margin: 8px 0 0; color: var(--texte-second); font-size: 15px; }

/* --------------------------------------------------------------- divers */
.erreur {
  background: var(--danger-clair); color: var(--danger);
  border-radius: 12px; padding: 13px 15px; margin: 16px 0 0;
  font-size: 14px; font-weight: 600;
}

.pied { text-align: center; margin-top: 26px; }

.attente {
  position: fixed; inset: 0; background: rgba(244, 246, 248, .72);
  display: flex; align-items: center; justify-content: center;
}
.rond {
  width: 42px; height: 42px; border-radius: 50%;
  border: 4px solid var(--bordure); border-top-color: var(--primaire);
  animation: tourne .8s linear infinite;
}
@keyframes tourne { to { transform: rotate(360deg); } }

@media (prefers-color-scheme: dark) {
  :root {
    --fond: #151B21; --surface: #1D242B; --texte: #ECF1F4;
    --texte-second: #A9B7C1; --texte-discret: #7C8B96; --bordure: #2C353D;
    --primaire-claire: #1E3A40; --succes-clair: #1C3020; --danger-clair: #3A2220;
    --ombre: 0 2px 10px rgba(0, 0, 0, .35);
  }
}
