/* Composants réutilisables. */

/* ----- Cartes ----- */
.carte {
  background: var(--carte);
  border-radius: var(--rayon-carte);
  box-shadow: var(--ombre);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.carte-auth { gap: 16px; padding: 24px 20px; }
.carte-action { padding: 6px; }

.auth-entete { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }

/* ----- En-tête de page ----- */
.entete-page {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 4px 0;
}
.entete-date { font-size: 13px; font-weight: 600; color: var(--texte-discret); }

/* ----- Avatars superposés ----- */
.avatars { display: flex; align-items: center; }
.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 700;
  font-size: 16px;
  border: 3px solid var(--fond);
}
.avatar + .avatar { margin-left: -12px; }
.carte .avatar { border-color: var(--carte); }
.avatar-teal { background: var(--degrade-teal); }
.avatar-indigo { background: var(--degrade-indigo); }

/* ----- Formulaires ----- */
.formulaire { display: flex; flex-direction: column; gap: 14px; }
.champ { display: flex; flex-direction: column; gap: 6px; }
.champ label { font-size: 14px; font-weight: 700; }
.champ input, .champ textarea, .champ select {
  min-height: 48px;
  width: 100%;
  border: 1px solid var(--bordure);
  border-radius: var(--rayon-controle);
  padding: 0 14px;
  /* 16px minimum : en dessous, Safari iOS zoome au focus */
  font-size: 16px;
  background: var(--champ-fond);
}
.champ textarea { padding: 12px 14px; resize: vertical; }
.champ input:focus, .champ textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.aide { font-size: 13px; color: var(--texte-discret); }

.case { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 15px; font-weight: 600; }
.case input { width: 22px; height: 22px; accent-color: var(--accent); }

/* Honeypot : hors écran plutôt que display:none, que certains robots détectent */
.piege { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* ----- Boutons ----- */
.bouton {
  min-height: 48px;
  padding: 0 18px;
  border-radius: var(--rayon-controle);
  border: 1.5px solid transparent;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.bouton-principal { background: var(--degrade-info-1); color: #ffffff; }
.bouton-principal:active { transform: scale(0.99); }
.bouton-danger { background: transparent; border-color: var(--danger-bord); color: var(--danger); }
.bouton-danger-texte { width: 100%; background: transparent; color: var(--danger); }
.bouton-petit { min-height: 40px; padding: 0 12px; font-size: 13px; }

/* ----- Messages ----- */
.alerte { border-radius: var(--rayon-controle); padding: 12px 14px; font-size: 14px; font-weight: 600; }
.alerte-erreur { background: var(--erreur-fond); color: var(--danger); }
.alerte-succes { background: var(--succes-fond); color: var(--succes-texte); }
.alerte-info { background: var(--info-fond); color: var(--info-texte); }

.texte-discret { font-size: 14px; color: var(--texte-discret); }
.lien-secondaire { font-size: 14px; text-align: center; }
.lien-secondaire a { display: inline-block; padding: 10px; }

.pastille {
  font-size: 12px;
  font-weight: 700;
  color: var(--succes-texte);
  background: var(--succes-fond);
  padding: 5px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

/* ----- Appareils ----- */
.liste-appareils { list-style: none; margin: 0; padding: 0; }
.appareil {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 8px 0;
}
.appareil + .appareil { border-top: 1px solid var(--bordure); }
.appareil-nom { font-size: 15px; font-weight: 700; }
.appareil-meta { font-size: 12px; font-weight: 600; color: var(--texte-discret); }

/* ----- Barre d'onglets : pilule flottante, icônes seules ----- */
.barre-onglets {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 10px);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px;
  background: var(--verre-fond);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--verre-bordure);
  border-radius: 999px;
  box-shadow: var(--ombre-barre), inset 0 1px 0 var(--verre-reflet);
  z-index: 10;
}
/* Repli sans verre dépoli : fond plein, pas de flou derrière la barre */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .barre-onglets { background: var(--carte); }
}
.onglet {
  position: relative;
  width: 53px;
  height: 53px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--texte-discret);
  transition: background-color 0.15s ease, color 0.15s ease;
}
.onglet.actif { color: #ffffff; background: var(--degrade-info-1); }

/* Visible seulement pour les lecteurs d'écran : la pilule n'affiche que des icônes */
.masque-visuel {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.onglet-pastille {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: #e5484d;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--carte);
}
.onglet.actif .onglet-pastille { box-shadow: 0 0 0 2px var(--accent-fort); }

/* ----- File hors ligne (todo/courses) : flotte au-dessus de la barre d'onglets ----- */
.file-attente {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 88px);
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 528px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 11;
}
.file-attente[hidden], .file-attente [hidden] { display: none; }
.file-attente .alerte { box-shadow: var(--ombre); }
.file-attente [data-file-attente-nombre] { align-self: center; border-radius: 999px; padding: 8px 14px; font-size: 13px; }
.file-attente ul { margin: 6px 0 10px; padding-left: 18px; font-weight: 500; }
.file-attente-fermer {
  border: none;
  border-radius: 999px;
  padding: 6px 16px;
  background: var(--carte);
  color: var(--danger);
  font-weight: 700;
  cursor: pointer;
}

/* ----- Déclenchement discret (voir commun.js) ----- */
[data-ring-appui-long] {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
.ring-discret {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin: 4px auto 0;
  border: none;
  background: transparent;
  color: var(--bordure);
  opacity: 0.7;
}
.ring-pulse { animation: ring-pulse 0.5s ease; }
@keyframes ring-pulse {
  0%   { opacity: 1; transform: scale(1); }
  40%  { opacity: 0.25; transform: scale(1.18); }
  100% { opacity: 1; transform: scale(1); }
}
