/* Appli de capture ArtiBox : ce qui est propre à l'appli, par-dessus commun/artibox.css.
 * Pensée pour un téléphone de 360 px posé sur le comptoir (lisible de loin), propre aussi en
 * tablette et sur ordinateur. Couleurs : jetons du système commun uniquement. */

/* --- Couleur de chaque état (carte centrale) ------------------------------------------ */
.etat-pause { --etat: var(--ab-texte-3); }
.etat-ecoute { --etat: var(--ab-accent); }
.etat-envoi { --etat: var(--ab-info); }
.etat-ok { --etat: var(--ab-succes); }
.etat-hors { --etat: var(--ab-alerte); }
.etat-erreur { --etat: var(--ab-danger); }

/* --- En-tête -------------------------------------------------------------------------- */
.entete-capture .ab-entete-interieur { max-width: 1080px; flex-wrap: wrap; row-gap: var(--ab-e2); }
.marque-nom small { margin-left: 4px; }
.onglets button { gap: 6px; min-height: var(--ab-cible); }
.onglets [data-icone] { display: inline-flex; }
.onglets svg { width: 18px; height: 18px; fill: currentColor; }
.onglets .actif { color: var(--ab-accent); }
.zone-theme { display: inline-flex; }
.zone-theme .ab-btn-icone svg { fill: currentColor; }

/* Voyant « micro actif » : pastille verte qui bat (le micro écoute en ce moment). */
.voyant {
  display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 12px 0 10px; border-radius: var(--ab-r-rond);
  background: var(--ab-accent-doux); color: var(--ab-accent); font-size: var(--ab-t-xs); font-weight: 800; letter-spacing: .06em;
  text-transform: uppercase; white-space: nowrap;
}
.voyant-point { position: relative; width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.voyant-point::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: currentColor; animation: voyant 1.2s ease-out infinite; }
@keyframes voyant { from { transform: scale(1); opacity: .6; } to { transform: scale(2.6); opacity: 0; } }

@media (max-width: 559px) {
  /* Le voyant passe sur une ligne à lui, sous la marque et les onglets. */
  .voyant { order: 10; flex: 1 1 100%; justify-content: center; }
  .onglets button { padding: 0 12px; }
}
@media (max-width: 439px) {
  /* Téléphone : le logo seul, pour garder onglets et thème sur la même ligne. */
  .marque-nom { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .entete-capture .ab-entete-interieur { column-gap: var(--ab-e2); }
}

/* --- Page ----------------------------------------------------------------------------- */
.page-capture { max-width: 1080px; }
.ecran-lieu { display: grid; gap: var(--ab-e5); max-width: 640px; margin: 0 auto; }
.colonne-etat, .colonne-suivi { display: flex; flex-direction: column; gap: var(--ab-e4); min-width: 0; }
@media (max-width: 999px) {
  /* Une colonne : état, chiffres, titres, puis la mention vie privée. */
  .colonne-etat, .colonne-suivi { display: contents; }
  .ecran-lieu .vie-privee { order: 5; }
}
@media (min-width: 1000px) {
  .ecran-lieu { max-width: none; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: var(--ab-e6); align-items: start; }
  .colonne-etat { position: sticky; top: 84px; }
}

/* --- Carte d'état : lisible de loin --------------------------------------------------- */
.carte-etat {
  position: relative; overflow: hidden; isolation: isolate; display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: var(--ab-e3); padding: var(--ab-e8) var(--ab-e5) var(--ab-e6); border-radius: var(--ab-r-xl);
  background: var(--ab-surface); border: 1px solid var(--ab-bord); box-shadow: var(--ab-ombre-2);
  transition: border-color var(--ab-m-lent);
}
/* Halo de la couleur d'état, et motif d'ondes en fond */
.carte-etat::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(120% 70% at 50% 0%, color-mix(in srgb, var(--etat) 18%, transparent), transparent 70%);
  transition: background var(--ab-m-lent);
}
.carte-etat::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: var(--ab-motif-opacite);
  background-image: var(--ab-motif-ondes); background-size: 120px 24px;
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent 55%); mask-image: linear-gradient(to bottom, #000, transparent 55%);
}
[data-theme="sombre"] .carte-etat::after { filter: invert(1); }
.carte-etat.etat-erreur, .carte-etat.etat-hors { border-color: color-mix(in srgb, var(--etat) 45%, var(--ab-bord)); }

/* Visuel : disque, ondes concentriques, égaliseur */
.visuel-etat { position: relative; width: clamp(150px, 46vw, 196px); aspect-ratio: 1; display: grid; place-items: center; margin-bottom: var(--ab-e2); }
.onde { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--etat); opacity: 0; }
.onde.o1 { inset: 4%; opacity: .22; }
.onde.o2 { inset: -6%; opacity: .12; }
.onde.o3 { inset: -16%; opacity: .06; }
.disque {
  position: relative; width: 62%; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  color: #fff; background: linear-gradient(145deg, color-mix(in srgb, var(--etat) 82%, #fff), var(--etat));
  box-shadow: 0 12px 32px -10px color-mix(in srgb, var(--etat) 70%, transparent), inset 0 -4px 0 rgb(0 0 0 / .12);
  transition: background var(--ab-m-lent), box-shadow var(--ab-m-lent);
}
[data-theme="sombre"] .disque { color: var(--ab-fond); }
.etat-icone { display: grid; place-items: center; }
.etat-icone svg { width: 46px; height: 46px; fill: currentColor; }
.etat-icone svg path[stroke] { stroke-width: 2.4; }
.egaliseur { display: none; position: absolute; bottom: 18%; gap: 3px; align-items: flex-end; height: 14px; }
.egaliseur i { width: 3px; height: 100%; border-radius: 2px; background: currentColor; transform-origin: bottom; opacity: .9; }

/* Micro actif : les ondes se propagent, l'égaliseur danse. */
.micro-actif .onde { animation: propage 2.4s cubic-bezier(.2, .6, .3, 1) infinite; inset: 10%; opacity: 0; }
.micro-actif .onde.o2 { animation-delay: .8s; }
.micro-actif .onde.o3 { animation-delay: 1.6s; }
.micro-actif .disque { animation: respire 1.6s ease-in-out infinite; }
.micro-actif .etat-icone { transform: translateY(-6px); }
.micro-actif .egaliseur { display: flex; }
.micro-actif .egaliseur i { animation: barre .9s ease-in-out infinite alternate; }
.micro-actif .egaliseur i:nth-child(2) { animation-delay: -.3s; }
.micro-actif .egaliseur i:nth-child(3) { animation-delay: -.6s; }
.micro-actif .egaliseur i:nth-child(4) { animation-delay: -.15s; }
.micro-actif .egaliseur i:nth-child(5) { animation-delay: -.45s; }
@keyframes propage { 0% { transform: scale(.85); opacity: .55; } 100% { transform: scale(1.45); opacity: 0; } }
@keyframes respire { 50% { transform: scale(1.04); } }
@keyframes barre { from { transform: scaleY(.25); } to { transform: scaleY(1); } }
/* Mouvement réduit : rien ne bouge ; les ondes restent visibles, fixes. */
@media (prefers-reduced-motion: reduce) {
  .micro-actif .onde, .micro-actif .disque, .micro-actif .egaliseur i, .voyant-point::after { animation: none !important; }
  .micro-actif .onde.o1 { inset: 4%; opacity: .45; } .micro-actif .onde.o2 { inset: -6%; opacity: .3; } .micro-actif .onde.o3 { inset: -16%; opacity: .15; }
  .micro-actif .egaliseur i:nth-child(odd) { transform: scaleY(.6); }
}

.etat { font: 850 clamp(2.25rem, 1.6rem + 3.4vw, 3.5rem)/1.05 var(--ab-police-titre); letter-spacing: -.035em; color: var(--ab-texte); }
.etat-erreur .etat, .etat.etat-erreur { color: var(--ab-danger); }
.detail { color: var(--ab-texte-2); font-size: var(--ab-t-l); line-height: 1.4; min-height: 1.4em; max-width: 34ch; text-wrap: balance; }
.actions-ecoute { width: 100%; max-width: 420px; margin-top: var(--ab-e3); }
.bouton-ecoute { min-height: 64px; font-size: var(--ab-t-xl); box-shadow: var(--ab-ombre-2); }
.bouton-ecoute svg { width: 26px; height: 26px; }
.bouton-ecoute.ab-second { box-shadow: var(--ab-ombre-1); }
.carre-stop { width: 18px; height: 18px; border-radius: 4px; background: var(--ab-danger); flex: none; }
.ab-btn [data-icone] { display: inline-flex; }

/* --- Chiffres ------------------------------------------------------------------------- */
.stats-capture { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--ab-e2); }
.stats-capture .ab-stat { padding: var(--ab-e3); text-align: center; align-items: center; }
.stats-capture .ab-stat-valeur { font-size: clamp(1.625rem, 1.1rem + 2.4vw, 2.5rem); white-space: nowrap; }
.stats-capture #prochain { font-size: clamp(1.25rem, .95rem + 1.6vw, 2rem); line-height: 1.3; }
@media (min-width: 560px) { .stats-capture { gap: var(--ab-e3); } .stats-capture .ab-stat { padding: var(--ab-e4); } }

/* --- Derniers titres ------------------------------------------------------------------ */
.carte-titres { padding: var(--ab-e4) var(--ab-e4) var(--ab-e2); }
.carte-titres .ab-carte-titre { margin-bottom: var(--ab-e1); }
.carte-titres h2 { font-size: var(--ab-t-l); }
.icone-titre svg { width: 22px; height: 22px; fill: var(--ab-texte-3); display: block; }
.titres > li { min-height: 72px; }
.titres .ab-pochette { width: 56px; height: 56px; }
.titres .titre { font-size: var(--ab-t-l); font-weight: 750; }
.titres .artiste { font-size: var(--ab-t-m); }
.titres .ab-element-fin { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.titres .heure { font-size: var(--ab-t-l); font-weight: 700; color: var(--ab-texte-2); }
.titres li.dernier .ab-pochette { width: 64px; height: 64px; box-shadow: var(--ab-ombre-2); }
.titres li.dernier .titre { font-size: var(--ab-t-xl); }
.titres li.vide { gap: var(--ab-e4); color: var(--ab-texte-2); border-bottom: 0; padding: var(--ab-e4) var(--ab-e1); }
.titres li.vide > span:last-child { display: flex; flex-direction: column; gap: 2px; }
.titres li.vide strong { color: var(--ab-texte); }
.titres li.vide small { font-size: var(--ab-t-s); }
.vide-icone { width: 52px; height: 52px; flex: none; border-radius: var(--ab-r-m); display: grid; place-items: center; background: var(--ab-fond-2); }
.vide-icone svg { width: 26px; height: 26px; fill: var(--ab-texte-3); }

/* --- Vie privée ----------------------------------------------------------------------- */
.vie-privee {
  display: flex; align-items: flex-start; gap: var(--ab-e3); padding: var(--ab-e4); border-radius: var(--ab-r-l);
  background: var(--ab-succes-fond); color: var(--ab-texte); font-size: var(--ab-t-m); font-weight: 600; line-height: 1.4;
}
.vie-privee [data-icone] { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--ab-surface); }
.vie-privee svg { width: 18px; height: 18px; fill: var(--ab-succes); }
.vie-privee > span:last-child { align-self: center; }
.vie-privee-longue { font-weight: 500; font-size: var(--ab-t-s); margin-top: var(--ab-e6); }
.version { color: var(--ab-texte-3); text-align: center; font-size: var(--ab-t-xs); margin-top: var(--ab-e4); }

/* --- Réglages ------------------------------------------------------------------------- */
.ecran-reglages { max-width: 640px; margin: 0 auto; }
.entete-reglages { margin-bottom: var(--ab-e4); }
.entete-reglages h1 { margin-top: 4px; }
.bienvenue { margin-bottom: var(--ab-e4); }
.bienvenue [data-icone] { display: inline-flex; }
.grille-reglages { display: grid; gap: var(--ab-e5); }
@media (min-width: 1000px) {
  .ecran-reglages { max-width: none; }
  .grille-reglages { grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); align-items: start; gap: var(--ab-e6); }
  .carte-pairage { position: sticky; top: 84px; }
}

.carte-pairage {
  border-radius: var(--ab-r-xl); border: 1px solid color-mix(in srgb, var(--ab-accent) 30%, var(--ab-bord));
  background: radial-gradient(120% 60% at 0% 0%, var(--ab-accent-doux), transparent 65%), var(--ab-surface);
}
.pairage-tete { display: flex; gap: var(--ab-e4); align-items: center; margin-bottom: var(--ab-e5); }
.pairage-tete h2 { font-size: var(--ab-t-xl); margin-bottom: 4px; }
.pairage-tete p { font-size: var(--ab-t-s); }
.pastille-icone {
  flex: none; width: 52px; height: 52px; border-radius: var(--ab-r-l); display: grid; place-items: center;
  background: linear-gradient(135deg, var(--ab-accent), var(--ab-accent-2)); color: #fff; box-shadow: var(--ab-ombre-2);
}
[data-theme="sombre"] .pastille-icone { color: var(--ab-sur-accent); }
.pastille-icone svg { width: 26px; height: 26px; fill: currentColor; }
.ab-form input.entree-code {
  min-height: 64px; text-align: center; font: 750 1.5rem/1 var(--ab-police-mono); letter-spacing: .18em; text-transform: uppercase;
  background: var(--ab-surface-2);
}
.ab-form input.entree-code::placeholder { letter-spacing: .18em; }

.carte-avances h2 { font-size: var(--ab-t-l); margin-bottom: 2px; }
.sous-titre { margin-bottom: var(--ab-e5); }
.sources { gap: var(--ab-e2) !important; }
.sources legend { font-size: var(--ab-t-m) !important; margin-bottom: var(--ab-e2) !important; }
.ab-choix-carte { align-items: center; min-height: 64px; }
.choix-icone { flex: none; width: 40px; height: 40px; border-radius: var(--ab-r-m); display: grid; place-items: center; background: var(--ab-fond-2); color: var(--ab-texte-2); }
.choix-icone svg { width: 22px; height: 22px; fill: currentColor; }
.ab-choix-carte:has(input:checked) .choix-icone { background: var(--ab-surface); color: var(--ab-accent); }
.choix-texte { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.choix-texte strong { font-weight: 700; }
.choix-texte small { color: var(--ab-texte-2); font-size: var(--ab-t-s); }

.natif { padding: var(--ab-e4) !important; border-radius: var(--ab-r-l) !important; background: var(--ab-surface-2) !important; border: 1px solid var(--ab-bord) !important; gap: var(--ab-e3) !important; }
.natif legend { float: left; width: 100%; font-size: var(--ab-t-m) !important; margin-bottom: var(--ab-e1) !important; }
.natif-etat { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: var(--ab-t-s); color: var(--ab-texte-2); }
.natif-etat:empty { display: none; }
.natif-etat li { display: flex; gap: 8px; align-items: flex-start; }
.natif-etat svg { width: 18px; height: 18px; flex: none; fill: var(--ab-texte-3); margin-top: 1px; }
.natif-etat li.ok svg { fill: var(--ab-succes); }
.natif-etat li.attention svg { fill: var(--ab-alerte); }
.natif .ab-btn { align-self: flex-start; white-space: normal; text-align: left; padding-block: 10px; }

.message { font-size: var(--ab-t-s); font-weight: 600; color: var(--ab-texte-2); min-height: 1.4em; }
.message:empty { min-height: 0; }
.ab-form .ab-actions .ab-btn { white-space: normal; }
@media (max-width: 479px) { .ab-form .ab-actions .ab-btn { flex: 1 1 100%; } }
