/* Utilitaires neutres */
.text-center { text-align: center; }
.text-red { color: var(--danger, #A30000); }
/* Alias sémantique aligné sur theme.css */
.text-danger { color: var(--danger, #A30000); }
/* ===== Compatibilité login: éléments manquants après retrait de style.css ===== */
/* Groupes de champs */
.form-group {
  display: grid;
  gap: .25rem;
  margin-bottom: .75rem;
}

/* Champs de saisie */
.form-input {
  width: 100%;
  padding: .6rem .75rem;
  box-sizing: border-box;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: var(--radius, 6px);
  background: var(--surface, #f9fafb);
  color: var(--text, #04151F);
}
.form-input::placeholder { color: var(--muted, #6b7280); }
.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent);
}


/* Pieds de formulaire et textes discrets */
.form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: .25rem;
}
.small-text { font-size: .875rem; color: var(--muted, #6b7280); }
.form-footer a { color: var(--accent, #00AFB5); text-decoration: none; }
.form-footer a:hover { text-decoration: underline; }

/* Footer de liens légaux (index) */
#legal-links {
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 1.25rem;
  padding-top: .5rem;
  border-top: 1px solid var(--line, #e5e7eb);
}
#legal-links span[aria-hidden="true"] { color: var(--line, #e5e7eb); }
/* Ligne 1: copyright centré ; ligne 2: liens */
#legal-links > :first-child { flex-basis: 100%; text-align: center; }
/* Maintenir l'enroulement aussi sur grands écrans */
@media (min-width: 640px) {
  #legal-links { flex-wrap: wrap; }
}

/* Messages d’erreur */
.error-message {
  margin-top: .5rem;
  color: var(--danger, #A30000);
  font-weight: 500;
}

/* Message d'information (aligné au thème) */
.forgot-message {
  color: var(--muted, #6b7280);
  background: transparent;
  border: none;
  padding: 0;
  margin: 0 0 1rem 0;
  text-align: center;
}

/* Cartes colorées (succès) */
.card-green {
  border-left: 4px solid var(--success, #16a34a);
}
/* déplacé vers titles.css: .card-title */

/* (styles de boutons déplacés vers buttons.css) */
/* ===== Base de page minimale ===== */
html, body {
    height: 100%;
    overflow-x: hidden; /* éviter les micro-débordements (reCAPTCHA, éléments fixed, etc.) */
  }
  
  body {
    font-family: var(--font-sans, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif);
    font-size: 16px;
    line-height: 1.5;
    color: var(--text, #04151F);
    background: var(--bg, #ffffff);
    margin: 0;                  /* supprime la marge par défaut qui crée du scroll */
    min-height: 100vh;          /* occupe toute la hauteur de l’écran */
    display: flex;              /* centrage vertical + horizontal */
    align-items: center;
    justify-content: center;
    padding: 0 12px;                 /* l’espace est géré par la marge du container */
    box-sizing: border-box;
  }
  /* Hériter la police globale pour tous les contrôles par défaut */
  button, input, select, textarea { font-family: inherit; }
  /* Pages avec header/app shell: on ne centre pas tout le body en flex */
  /* Note: Le display flex est géré dans footer.css pour le système de footbar */
  body.page-shell {
    padding: 0 !important; /* Padding géré dans footer.css sur les conteneurs principaux */
    min-height: 100vh;
  }
  body.page-shell .container {
    margin: 64px auto; /* recentrer le contenu sous le header */
    padding: 24 12px; /* Padding déplacé ici */
  }
  /* Centrage plein écran optionnel du conteneur (pages simples) */
  body.page-shell .container.center-in-page {
    margin: auto; /* centre verticalement et horizontalement */
  }
  /* iPhone SE et petits écrans: autoriser le scroll vertical à l'intérieur
     du conteneur d'index uniquement, sans impacter les autres pages */
  @media (max-width: 500px) {
    #page-root .container.center-in-page {
      margin: 12px auto;                 /* éviter le collage bord/écran */
      max-height: calc(100vh - 24px);    /* tenir dans la hauteur viewport */
      overflow-y: auto;                   /* activer le scroll interne */
      -webkit-overflow-scrolling: touch;  /* inertie iOS */
      overscroll-behavior: contain;       /* éviter les rebonds globaux */
    }
  }
  @media (max-width: 600px) {
    body.page-shell .container { padding: 24 16px; }
  }
  
  /* Conteneur central de la page d’accueil */
  .container {
    width: 95%;
    max-width: 560px;
    margin: 24px auto;          /* gère l’espace extérieur au lieu du padding body */
    padding: 24px;
    box-sizing: border-box;     /* éviter que le padding dépasse en mobile */
    background: var(--surface, #ffffff);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md, 0 4px 6px rgba(0,0,0,.1));
    overflow: hidden;            /* anti-débordement de sous-éléments (reCAPTCHA, etc.) */
  }

  /* Eviter la troncature quand la hauteur de l'écran est très petite */
  @media (max-height: 420px) {
    body {
      align-items: flex-start;   /* ne plus centrer verticalement */
      justify-content: flex-start;
      padding: 0;                /* padding du body supprimé */
    }
    .container {
      overflow: visible;         /* laisser le contenu dépasser/faire défiler */
    }
    /* En très petite hauteur, on désactive le centrage strict pour éviter la troncature */
    body.page-shell .container.center-in-page {
      margin: 24px auto;
    }
  }
  
  /* En-tête */
  /* Espace sous le titre quand pas de sous-titre */
  .header { margin-bottom: 16px; }
  
  /* Formulaire minimal */
  .form-section {
    display: grid;
    gap: .75rem;
  }
  
  .form-label {
    display: block;
    font-weight: 600;
    margin: .25rem 0;
  }
  
  .form-select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    font-size: 1rem;
    line-height: 1.4;
  
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
  
    /* Pour iOS Safari : retirer le style natif */
    -webkit-appearance: none;
    appearance: none;
  
    /* Hauteur mini standard (même que input/bouton) */
    min-height: 44px;
  }
  
  
  
  .hidden { display: none !important; }

  /* [hidden] utilisé par les menus popover (ex: couleurs phases) */
  [hidden] { display: none !important; }

  /* (doublon supprimé) */
  
  /* titres optimisés pour Manrope */
  .header h1 {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--brand);
    font-size: clamp(28px, 4vw, 40px);
    line-height: var(--leading-tight);
    letter-spacing: var(--tracking-normal); /* Manrope n'a pas besoin de tracking négatif */
    margin-bottom: .5rem;
    text-align: center;
  }
  
  /* Logo sous le titre, centré et soigné */
  .header-logo {
    display: block;
    margin: 12px auto 12px auto;
    width: 144px;
    height: 144px;
    border-radius: 12px;
    box-shadow: none;
    object-fit: cover;
  }
  /* Logo recoloré automatiquement avec la couleur de marque */
  .logo-brand {
    background: var(--brand);
    -webkit-mask: url('/logo.svg') center / contain no-repeat;
            mask: url('/logo.svg') center / contain no-repeat;
  }
  .header-subtitle {
    color: var(--muted);
    margin-bottom: 1rem;
  }
  /* Espace sous le titre quand pas de sous-titre */
  .header { margin-bottom: 16px; }
  
  /* formulaire : espacement cohérent */
  .form-section { display: grid; gap: .75rem; width: 100%; }
  .form-label {
    font-weight: 600;
  }


  /* Options du select (meilleure intégration dark) */
  .form-select option { background: var(--surface); color: var(--text); }
  .form-select option[disabled] { color: var(--muted); }
  
  /* alignement boutons */
  #btn-access, #btn-admin-access, #logout-btn { margin: 0; }

  /* Centrer le bouton de connexion uniquement */
  #loginForm { text-align: center; }
  #login-btn { display: inline-block; }
  #registerForm { text-align: center; }
  #register-btn { display: inline-block; }

  /* Centrage global des éléments de la page de connexion */
  #loginForm .form-group { max-width: 420px; margin-left: auto; margin-right: auto; }
  #loginForm .form-footer { justify-content: center; }
  #form-content .form-footer { justify-content: center; }
  #login-error { text-align: center; }
  .links-inline { display:flex; align-items:center; gap:8px; justify-content:center; margin-top:.5rem; }

/* rangée d’actions (aligne les boutons) */
.actions-row, .form-actions {
  display: flex;
  gap: 1rem; /* ~16px, plus d'air entre les boutons */
  align-items: center;
  justify-content: center;
  margin-top: 1rem; /* espace entre select et boutons */
  flex-wrap: wrap; /* éviter tout débordement quand le bouton de droite reste visible */
}
@media (max-width: 768px) {
  .actions-row, .form-actions { flex-direction: column; align-items: center; width: 100%; }
}
  
/* Variante d'espacement large pour les actions */
.actions-row--wide { gap: 2rem; margin-top: 1.25rem; }
  
/* ===== Index: composants manquants après refonte ===== */

/* Cartes d’infos (auth-info) */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-gray { background: var(--surface); }
.card-body { padding: 12px 16px; }
.auth-info { margin: 16px 0 0; }
#auth-info .card-body { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
#auth-user-name { margin-left: 4px; }
#auth-user-email { display: block; margin-left: 40px; }
/* Fond de page synchronisé avec la couleur de la navbar (version claire) */
body.site-bg-accent  { background: color-mix(in srgb, var(--accent) 12%, white 88%); }
body.site-bg-success { background: color-mix(in srgb, var(--success) 12%, white 88%); }
body.site-bg-warning { background: color-mix(in srgb, var(--warning) 12%, white 88%); }
body.site-bg-info    { background: color-mix(in srgb, var(--info)    12%, white 88%); }

/* Variante plus intense (utilisée par le chrono) */
body.site-bg-strong.site-bg-accent  { background: color-mix(in srgb, var(--accent) 20%, white 80%); }
body.site-bg-strong.site-bg-success { background: color-mix(in srgb, var(--success) 20%, white 80%); }
body.site-bg-strong.site-bg-warning { background: color-mix(in srgb, var(--warning) 20%, white 80%); }
body.site-bg-strong.site-bg-info    { background: color-mix(in srgb, var(--info)    20%, white 80%); }
body.site-bg-error   { background: color-mix(in srgb, var(--danger)  12%, white 88%); }
/* DÉSACTIVÉ - Remplacé par dark-theme.css
@media (prefers-color-scheme: dark) {
  body.site-bg-accent  { background: color-mix(in srgb, var(--accent) 14%, var(--surface) 86%); }
  body.site-bg-success { background: color-mix(in srgb, var(--success) 14%, var(--surface) 86%); }
  body.site-bg-warning { background: color-mix(in srgb, var(--warning) 14%, var(--surface) 86%); }
  body.site-bg-info    { background: color-mix(in srgb, var(--info)    14%, var(--surface) 86%); }
  body.site-bg-error   { background: color-mix(in srgb, var(--danger)  14%, var(--surface) 86%); }
}
*/
/* Badge et email plus discrets dans la carte Connecté */
#auth-info .badge { padding: 0.18rem 0.45rem; font-size: 0.78rem; border-radius: 999px; }
.auth-info .info-label { color: #94a3b8; }

/* Loader centré */
.loading-container {
  display: grid;
  place-items: center;
  gap: .5rem;
  padding: 12px 0;
  color: var(--muted);
}

/* Barre de progression */
.loading-progress { width: 100%; max-width: 520px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .5rem; }
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.progress-fill {
  width: 0%;
  height: 100%;
  background: var(--brand);
  transition: width .25s ease;
}
.progress-text { font-size: .875rem; color: var(--muted); }

/* Skeletons */
.skeleton {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: #eee;
}
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.6), transparent);
  transform: translateX(-100%);
  animation: skeleton-loading 1.2s infinite;
}
@keyframes skeleton-loading { to { transform: translateX(100%); } }
.skeleton-text { height: 16px; }
.skeleton-input { height: 44px; }
.skeleton-button { height: 44px; }

/* Conteneur skeleton limité */
.container-limited-large { width: 95%; max-width: 1000px; margin: 0 auto; }

/* DÉSACTIVÉ - Remplacé par dark-theme.css
@media (prefers-color-scheme: dark) {
  .skeleton { background: #1f2937; }
  .skeleton::after {
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.08), transparent);
  }
  .progress-bar { background: #1e293b; }
}
*/

/* Petites utilitaires */
.info-value { font-weight: 600; }
.info-label { color: var(--muted); }

/* === 🅰️ Utilitaires typographiques === */

/* Polices */
.font-display { font-family: var(--font-display); }
.font-body { font-family: var(--font-body); }
.font-mono { font-family: var(--font-mono); }

/* Tailles de texte */
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.text-3xl { font-size: var(--text-3xl); }
.text-4xl { font-size: var(--text-4xl); }

/* Interlignage */
.leading-tight { line-height: var(--leading-tight); }
.leading-normal { line-height: var(--leading-normal); }
.leading-relaxed { line-height: var(--leading-relaxed); }

/* Espacement des lettres */
.tracking-tight { letter-spacing: var(--tracking-tight); }
.tracking-normal { letter-spacing: var(--tracking-normal); }
.tracking-wide { letter-spacing: var(--tracking-wide); }

/* Poids de police */
.font-light { font-weight: 300; }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }
/* utilitaires utiles */

/* États focus accessibles */
.btn:focus-visible,
.form-select:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* Hover/active boutons */
.btn:hover { filter: brightness(.95); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); box-shadow: var(--shadow-sm); }

/* (version mobile de la navbar supprimée) */

/* (compat bg-yellow-500 supprimée; couleurs gérées via navbar-state-*) */
  
/* Laisser les enfants se réduire en flex / grid */
.form-section > *,
.actions-row > *,
.form-actions > * {
  min-width: 0;           /* clé pour autoriser le shrink */
}

/* Boutons en mobile: pas de min-width qui bloque */
@media (max-width: 480px) {
  .btn { min-width: 0; width: auto; box-sizing: border-box; }
  select, input { min-width: 0; }
}

/* Option confort : réduire légèrement le padding du container en très petit */
@media (max-width: 360px) {
  .container { padding: 12px; }   /* au lieu de 24px */
}
/* Autoriser les retours à la ligne dans la carte "Connecté" */
#auth-info .card-body > * { min-width: 0; }            /* important en flex */
#auth-user-email {
  display: block;
  max-width: 100%;
  white-space: normal;               /* pas en une seule ligne */
  overflow-wrap: anywhere;           /* coupe sur @ et . si besoin */
  word-break: break-word;            /* fallback */
  margin-left: 0;                    /* évite le décalage qui peut forcer la largeur */
  color: var(--muted);
  font-size: .95rem;
}

/* Option : garder l’alignement quand on a de la place */
@media (min-width: 420px) {
  #auth-user-email { margin-left: 40px; }
}
/* (unification du layout: anciennes variantes with-navbar supprimées) */


.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent);
}

  /* Case à cocher (thémée) */
  .form-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
  }
  .form-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--brand);
    border-radius: 4px;
  }
  .form-checkbox input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }
  .form-checkbox span {
    line-height: 1.4;
    color: var(--text);
    font-size: .95rem;
  }
  .form-checkbox a {
    color: var(--accent);
    text-decoration: none;
  }
  .form-checkbox a:hover { text-decoration: underline; }
  .form-checkbox a:visited { color: var(--accent); }
  .form-checkbox a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
  }

/* Fond avec motif subtil (dégradé léger + trame douce) */
body.site-bg-pattern {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--brand) 6%, white 94%), white) fixed,
    repeating-linear-gradient(45deg, rgba(0,0,0,.02) 0 8px, rgba(0,0,0,.03) 8px 16px);
  background-blend-mode: normal, multiply;
}

/* DÉSACTIVÉ - Remplacé par dark-theme.css
@media (prefers-color-scheme: dark) {
  body.site-bg-pattern {
    background:
      linear-gradient(180deg, color-mix(in srgb, var(--brand) 12%, var(--surface) 88%), var(--surface)) fixed,
      repeating-linear-gradient(45deg, rgba(255,255,255,.03) 0 8px, rgba(255,255,255,.04) 8px 16px);
    background-blend-mode: normal, screen;
  }
}
*/

/* Variante plus visible */
body.site-bg-pattern-strong {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--brand) 12%, white 88%), white) fixed,
    repeating-linear-gradient(45deg, rgba(0,0,0,.035) 0 6px, rgba(0,0,0,.06) 6px 12px);
  background-blend-mode: normal, multiply;
}
/* DÉSACTIVÉ - Remplacé par dark-theme.css
@media (prefers-color-scheme: dark) {
  body.site-bg-pattern-strong {
    background:
      linear-gradient(180deg, color-mix(in srgb, var(--brand) 18%, var(--surface) 82%), var(--surface)) fixed,
      repeating-linear-gradient(45deg, rgba(255,255,255,.06) 0 6px, rgba(255,255,255,.08) 6px 12px);
    background-blend-mode: normal, screen;
  }
}
*/

/* Motif à points bien visible */
body.site-bg-dots {
  background-color: color-mix(in srgb, var(--brand) 6%, white 94%);
  background-image:
    radial-gradient(circle at 1px 1px, rgba(0,0,0,0.12) 1px, transparent 1.5px),
    radial-gradient(circle at 1px 1px, rgba(0,0,0,0.06) 1px, transparent 1.5px);
  background-size: 16px 16px, 16px 16px;
  background-position: 0 0, 8px 8px;
}
/* DÉSACTIVÉ - Remplacé par dark-theme.css
@media (prefers-color-scheme: dark) {
  body.site-bg-dots {
    background-color: color-mix(in srgb, var(--brand) 14%, var(--surface) 86%);
    background-image:
      radial-gradient(circle at 1px 1px, rgba(255,255,255,0.18) 1px, transparent 1.5px),
      radial-gradient(circle at 1px 1px, rgba(255,255,255,0.10) 1px, transparent 1.5px);
  }
}
*/

/* Rayures diagonales légères */
body.site-bg-stripes {
  background-color: color-mix(in srgb, var(--brand) 5%, white 95%);
  background-image: repeating-linear-gradient(
    135deg,
    rgba(0,0,0,.05) 0 10px,
    transparent 10px 20px
  );
}
/* DÉSACTIVÉ - Remplacé par dark-theme.css
@media (prefers-color-scheme: dark) {
  body.site-bg-stripes {
    background-color: color-mix(in srgb, var(--brand) 12%, var(--surface) 88%);
    background-image: repeating-linear-gradient(
      135deg,
      rgba(255,255,255,.08) 0 10px,
      transparent 10px 20px
    );
  }
}
*/

/* Grille subtile (carrés) */
body.site-bg-grid {
  background-color: color-mix(in srgb, var(--brand) 6%, white 94%);
  background-image:
    linear-gradient(rgba(0,0,0,0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,0,0,0.08) 1px, transparent 1px);
  background-size: 22px 22px, 22px 22px;
}
/* DÉSACTIVÉ - Remplacé par dark-theme.css
@media (prefers-color-scheme: dark) {
  body.site-bg-grid {
    background-color: color-mix(in srgb, var(--brand) 14%, var(--surface) 86%);
    background-image:
      linear-gradient(rgba(255,255,255,0.16) 1px, transparent 1px),
      linear-gradient(90deg, rgba(255,255,255,0.16) 1px, transparent 1px);
  }
}
*/

/* Mesh gradient (taches colorées douces) */
body.site-bg-mesh {
  background:
    radial-gradient(1200px 600px at 15% 10%, color-mix(in srgb, var(--accent) 14%, white 86%), transparent 60%),
    radial-gradient(900px 600px at 85% 85%, color-mix(in srgb, var(--brand) 12%, white 88%), transparent 55%),
    radial-gradient(800px 500px at 0% 100%, color-mix(in srgb, var(--success) 10%, white 90%), transparent 55%),
    var(--bg);
}
/* DÉSACTIVÉ - Remplacé par dark-theme.css
@media (prefers-color-scheme: dark) {
  body.site-bg-mesh {
    background:
      radial-gradient(1200px 600px at 15% 10%, color-mix(in srgb, var(--accent) 18%, var(--surface) 82%), transparent 60%),
      radial-gradient(900px 600px at 85% 85%, color-mix(in srgb, var(--brand) 16%, var(--surface) 84%), transparent 55%),
      radial-gradient(800px 500px at 0% 100%, color-mix(in srgb, var(--success) 14%, var(--surface) 86%), transparent 55%),
      var(--surface);
  }
}
*/

/* === Aide: icônes “?” (modales uniquement) — très visibles avant clic, très discrètes après === */
.help-icon {
  --help-size: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--help-size);
  height: var(--help-size);
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent, #0ea5e9) 50%, white 50%);
  color: #ffffff; /* icône en blanc */
  opacity: 1;
  cursor: pointer;
  transition: opacity .15s ease, color .15s ease, background-color .15s ease, transform .1s ease;
  vertical-align: -2px; /* aligne la pastille avec les titres, y compris en responsive */
}

.help-icon:hover {
  opacity: .95;
  transform: translateY(-1px);
}

/* État vu: gris clair, plus faible contraste */
.help-icon.help-seen {
  background: #e2e8f0; /* slate-200 */
  color: #64748b; /* slate-500 */
  opacity: .4;
  filter: saturate(.6) contrast(.95);
}

.help-icon.help-seen:hover {
  opacity: .8;
}

/* Accessibilité clavier */
.help-icon:focus-visible {
  outline: 2px solid var(--accent, #0ea5e9);
  outline-offset: 2px;
}

/* Garde la règle globale telle quelle */
body.page-shell { justify-content: flex-start; }

/* Ne centre QUE ce container d’accueil */
body.page-shell > .container.center-in-page {
  margin-top: auto !important;
  margin-bottom: auto !important;
  min-height: 0; /* pour éviter le débordement avec overflow */
}

/* Bonus viewport mobile */
@supports (height: 100dvh) {
  body.page-shell { min-height: 100dvh; } /* évite le bug 100vh */
}
