/* =====================================================================
   RoboLab — composants.css
   Éléments réutilisables : boutons, cartes, grilles, barres de
   progression, pastilles, étoiles, accordéons, tableaux, notifications,
   confettis et fenêtre « nouveau badge ».
   ===================================================================== */

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 800; text-decoration: none; cursor: pointer;
  border: 2px solid transparent; border-radius: 999px;
  padding: 10px 22px; min-height: 46px; line-height: 1.2;
  transition: transform .15s, box-shadow .15s, background .15s, color .15s;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--ombre); }
.btn:active { transform: translateY(0); }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-bleu { background: var(--bleu); color: #fff; }
.btn-bleu:hover { background: var(--bleu-fonce); }
.btn-orange { background: var(--orange); color: #fff; }
.btn-orange:hover { background: var(--orange-fonce); }
.btn-vert { background: var(--vert); color: #fff; }
.btn-contour { background: #fff; color: var(--bleu); border-color: var(--bleu-pale); }
.btn-contour:hover { border-color: var(--bleu); }
.btn-danger { background: #fff; color: var(--rouge); border-color: #fecaca; }
.btn-danger.plein { background: var(--rouge); color: #fff; border-color: var(--rouge); }
.btn-petit { padding: 6px 14px; min-height: 36px; font-size: .9rem; }
.btn-large { padding: 14px 30px; font-size: 1.1rem; }
/* La flèche se retourne en arabe */
.fleche { display: inline-block; }
[dir="rtl"] .fleche { transform: scaleX(-1); }

/* ---------- Cartes et grilles ---------- */
.carte {
  background: var(--carte); border-radius: var(--rayon); box-shadow: var(--ombre);
  border: 1px solid #eef2ff; overflow: hidden;
}
.carte-pad { padding: 20px; }
.grille { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .grille-2, .grille-3, .grille-4 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) {
  .grille-3 { grid-template-columns: repeat(3, 1fr); }
  .grille-4 { grid-template-columns: repeat(4, 1fr); }
}
.carte-lien {
  display: flex; flex-direction: column; color: inherit; text-decoration: none;
  transition: transform .2s, box-shadow .2s;
}
.carte-lien:hover { transform: translateY(-4px); box-shadow: var(--ombre-forte); }

.section { margin: 28px 0; }
.section-titre { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.section-titre .icone {
  width: 40px; height: 40px; flex: 0 0 40px; border-radius: 12px;
  display: grid; place-items: center; font-size: 1.25rem;
  background: var(--bleu-clair);
}
.section-titre h2 { margin: 0; }
.intro { color: var(--texte-doux); font-size: 1.05rem; max-width: 70ch; }
.entete-page { margin-bottom: 18px; }

/* ---------- Barres de progression ---------- */
.barre { height: 12px; background: var(--bleu-pale); border-radius: 999px; overflow: hidden; }
.barre-petite { height: 8px; }
.barre-remplie {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--bleu), var(--orange));
  transition: width .6s ease;
}
.barre-legende { display: flex; justify-content: space-between; font-size: .9rem; font-weight: 700; color: var(--texte-doux); margin-bottom: 4px; gap: 8px; }

/* ---------- Pastilles, étiquettes, étoiles ---------- */
.pastille-niveau {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .8rem; font-weight: 800; padding: 2px 10px; border-radius: 999px;
  color: var(--c); background: color-mix(in srgb, var(--c) 14%, white);
  border: 1px solid color-mix(in srgb, var(--c) 35%, white);
}
.etiquette {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .8rem; font-weight: 800; padding: 3px 10px; border-radius: 999px;
  background: var(--bleu-clair); color: var(--bleu-fonce);
}
.etiquette-orange { background: var(--orange-clair); color: var(--orange-fonce); }
.etiquette-vert { background: #dcfce7; color: #15803d; }
.etiquette-gris { background: #e2e8f0; color: #475569; }
.etiquette-rouge { background: #fee2e2; color: #b91c1c; }
.etoiles { letter-spacing: 1px; white-space: nowrap; }
.etoiles .on { color: var(--orange); }
.etoiles .off { color: #cbd5e1; }
.metas { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; font-size: .9rem; color: var(--texte-doux); font-weight: 700; }

/* ---------- Filtres (boutons pilules) ---------- */
.filtres { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 18px; }
.filtre {
  font: inherit; font-weight: 700; cursor: pointer;
  background: #fff; color: var(--texte-doux); border: 2px solid var(--bord);
  padding: 6px 14px; border-radius: 999px; min-height: 40px;
  transition: all .15s;
}
.filtre:hover { border-color: var(--bleu); color: var(--bleu); }
.filtre[aria-pressed="true"] { background: var(--bleu); border-color: var(--bleu); color: #fff; }
.filtre-kit[aria-pressed="true"] { background: var(--orange); border-color: var(--orange); }

/* ---------- Case à cocher stylée ---------- */
.case {
  display: inline-flex; align-items: center; gap: 10px; cursor: pointer;
  font-weight: 700; user-select: none; padding: 8px 14px; border-radius: 999px;
  border: 2px solid var(--bord); background: #fff; min-height: 44px;
  transition: all .15s;
}
.case input { width: 20px; height: 20px; accent-color: var(--vert); cursor: pointer; margin: 0; }
.case:hover { border-color: var(--vert); }
.case.cochee { background: #dcfce7; border-color: #86efac; color: #15803d; }

/* ---------- Accordéons (details/summary) ---------- */
.accordeon { border: 1px solid var(--bord); border-radius: var(--rayon-petit); background: #fff; margin-bottom: 10px; overflow: hidden; }
.accordeon > summary {
  list-style: none; cursor: pointer; padding: 14px 16px; font-weight: 700;
  display: flex; align-items: center; gap: 10px;
}
.accordeon > summary::-webkit-details-marker { display: none; }
.accordeon > summary::after {
  content: "+"; margin-inline-start: auto; font-size: 1.4rem; line-height: 1; color: var(--orange);
  transition: transform .2s;
}
.accordeon[open] > summary::after { transform: rotate(45deg); }
.accordeon[open] > summary { background: var(--bleu-clair); }
.accordeon-corps { padding: 12px 16px 16px; }
.accordeon-corps p:last-child { margin-bottom: 0; }

/* ---------- Tableaux ---------- */
.tableau-conteneur { overflow-x: auto; border-radius: var(--rayon-petit); border: 1px solid var(--bord); background: #fff; }
.tableau { width: 100%; border-collapse: collapse; font-size: .95rem; }
.tableau th, .tableau td { padding: 10px 12px; text-align: start; border-bottom: 1px solid var(--bord); vertical-align: middle; }
.tableau th { background: var(--bleu-clair); color: var(--bleu-nuit); font-weight: 800; white-space: nowrap; }
.tableau tr:last-child td { border-bottom: 0; }
.fil-couleur {
  display: inline-block; width: 26px; height: 10px; border-radius: 5px;
  vertical-align: middle; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15);
}
.broche { font-family: var(--police-code); font-weight: 700; background: #f1f5f9; padding: 1px 7px; border-radius: 6px; white-space: nowrap; }

/* ---------- Notification (toast) ---------- */
.toast {
  position: fixed; inset-inline: 0; margin: 0 auto; width: max-content; max-width: 90vw;
  bottom: calc(var(--hauteur-menu-bas) + 16px); z-index: 90;
  background: var(--bleu-nuit); color: #fff; font-weight: 700;
  padding: 10px 18px; border-radius: 999px; box-shadow: var(--ombre-forte);
  opacity: 0; transform: translateY(12px); pointer-events: none;
  transition: opacity .25s, transform .25s;
}
.toast.visible { opacity: 1; transform: none; }
@media (min-width: 1100px) { .toast { bottom: 24px; } }

/* « +5 pts » qui s'envole */
.flash-points {
  position: absolute; z-index: 95; transform: translateX(-50%);
  font-weight: 800; color: var(--orange); font-size: 1.1rem; pointer-events: none;
  animation: envol 1.2s ease-out forwards; direction: ltr;
}
@keyframes envol { from { opacity: 1; margin-top: 0; } to { opacity: 0; margin-top: -60px; } }

/* ---------- Confettis ---------- */
.confettis { position: fixed; inset: 0; z-index: 120; pointer-events: none; }

/* ---------- Fenêtre « Nouveau badge » ---------- */
.modale-badge {
  position: fixed; inset: 0; z-index: 110; display: grid; place-items: center; padding: 20px;
  background: rgba(15, 23, 42, .55); animation: fondu .25s ease;
}
.modale-badge-boite {
  background: #fff; border-radius: 24px; padding: 28px 24px; text-align: center;
  max-width: 340px; width: 100%; box-shadow: var(--ombre-forte);
  animation: rebond .55s cubic-bezier(.2, 1.6, .4, 1);
}
.modale-badge-titre { font-weight: 800; color: var(--orange); text-transform: uppercase; letter-spacing: 1px; font-size: .9rem; }
.modale-badge-emoji {
  font-size: 4.5rem; line-height: 1; margin: 14px auto; width: 120px; height: 120px;
  display: grid; place-items: center; border-radius: 50%;
  background: radial-gradient(circle, #fff7ed 40%, #fed7aa);
  animation: tourne 1s ease .2s;
}
.modale-badge-nom { font-size: 1.4rem; font-weight: 800; color: var(--bleu-nuit); }
.modale-badge-cond { color: var(--texte-doux); }
@keyframes fondu { from { opacity: 0; } }
@keyframes rebond { from { transform: scale(.5); opacity: 0; } }
@keyframes tourne { 50% { transform: scale(1.15) rotate(-8deg); } }

/* ---------- Divers ---------- */
.vide {
  text-align: center; color: var(--texte-doux); padding: 30px 16px;
  background: #fff; border-radius: var(--rayon); border: 2px dashed var(--bord);
}
.astuce {
  background: var(--orange-clair); border-inline-start: 4px solid var(--orange);
  padding: 10px 14px; border-radius: 10px; color: #9a3412; font-weight: 600; margin: 10px 0;
}
.info {
  background: var(--bleu-clair); border-inline-start: 4px solid var(--bleu);
  padding: 10px 14px; border-radius: 10px; color: var(--bleu-nuit); font-weight: 600; margin: 10px 0;
}
.succes {
  background: #dcfce7; border-inline-start: 4px solid var(--vert);
  padding: 10px 14px; border-radius: 10px; color: #166534; font-weight: 600; margin: 10px 0;
}
.fil-ariane { font-size: .9rem; font-weight: 700; margin-bottom: 12px; }
.fil-ariane a { text-decoration: none; }
