/* Mouvement : micro-interactions sobres. Survol, focus et pression changent une couleur ou une
 * ombre, jamais la place d’un élément ; les fondus durent moins de 200 ms ; rien ne tourne,
 * ne rebondit ni ne clignote pour décorer, à l’exception des témoins de chargement. */
:root {
  --ease-out: cubic-bezier(0.2, 0, 0, 1);
  /* Ancien nom, conservé pour les feuilles qui y renvoient : même courbe, sans dépassement. */
  --ease-spring: cubic-bezier(0.2, 0, 0, 1);
  --chevron-up: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m4 10 4-4 4 4' fill='none' stroke='%232f6c59' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* Menu, onglets, boutons : la couleur change, rien ne se déplace */
.nav button,
.tabs button {
  transition: color 0.15s, background-color 0.15s, border-color 0.15s;
}
.btn {
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.btn:active:not(:disabled) {
  filter: brightness(0.94);
}
.metric,
.card-pipeline button,
.queue-row,
.workspace-choice,
.choice-option .choice-visual,
.family-profile-card,
.quicklink {
  transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}
.metric:hover,
.card-pipeline button:hover,
.workspace-choice:hover,
.family-profile-card:hover {
  box-shadow: 0 4px 12px #183b3810;
}
.table tbody tr {
  transition: background-color 0.12s;
}
.chart rect {
  transition: fill-opacity 0.15s;
}
.chart rect:hover {
  fill-opacity: 0.75;
}
.bartrack i {
  display: block;
}
.operation-progress i {
  transition: width 0.2s var(--ease-out);
}
.question-field input,
.question-field select,
.question-field textarea {
  transition: border-color 0.15s, box-shadow 0.15s;
}

/* Travail en cours : barre fine en haut de l’écran */
#fss-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 400;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
#fss-progress.on {
  opacity: 1;
}
#fss-progress.done {
  opacity: 0;
  transition: opacity 0.2s 0.1s;
}
#fss-progress i {
  display: block;
  height: 100%;
  transform-origin: 0 50%;
  transform: scaleX(0);
  transition: transform 0.2s var(--ease-out);
  background: #2f6c59;
}

/* Bouton en cours : l’intitulé reste, un anneau tourne devant */
.is-busy {
  pointer-events: none;
  opacity: 0.85;
}
.is-busy::before,
.fss-spinner {
  content: '';
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-right: 8px;
  vertical-align: -2px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
.is-busy > .icon {
  display: none;
}
.fss-spinner {
  margin: 0;
  color: #2f6c59;
}
.fss-spinner.large {
  width: 32px;
  height: 32px;
  border-width: 3px;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Notifications */
#toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px 12px 14px;
  border-radius: 8px;
  min-width: 240px;
  background: #183f3c;
  cursor: pointer;
  transition: opacity 0.18s var(--ease-out), transform 0.18s var(--ease-out);
}
#toast.show {
  pointer-events: auto;
}
#toast .toast-text {
  line-height: 1.45;
}
#toast .toast-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  fill: none;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke: #b8d294;
}
#toast.kind-error {
  background: #5a2620;
}
#toast.kind-error .toast-icon {
  stroke: #f2b8ad;
}
#toast.kind-info .toast-icon {
  stroke: #e6d49a;
}

/* Squelette de chargement */
.skeleton {
  display: grid;
  gap: 12px;
  padding: 6px 0;
}
.skeleton i {
  display: block;
  height: 12px;
  border-radius: 6px;
  background: #edf2e8;
  animation: skeleton-pulse 1.6s ease-in-out infinite;
}
@keyframes skeleton-pulse {
  50% {
    opacity: 0.55;
  }
}

/* Menu des listes de choix */
.fsel-layer {
  position: fixed;
  inset: 0;
  z-index: 320;
  pointer-events: none;
}
.fsel {
  position: fixed;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #dce5d3;
  border-radius: 12px;
  box-shadow: 0 24px 60px #183b382e, 0 2px 6px #183b3812;
  overflow: hidden;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(-4px);
  transform-origin: 50% 0;
  transition: opacity 0.12s var(--ease-out), transform 0.12s var(--ease-out);
}
.fsel.up {
  transform: translateY(4px);
  transform-origin: 50% 100%;
}
.fsel-layer.in .fsel {
  opacity: 1;
  transform: none;
}
.fsel-layer.out .fsel {
  opacity: 0;
  transition: opacity 0.1s;
}
.fsel-search {
  position: relative;
  padding: 9px;
  border-bottom: 1px solid var(--line);
}
.fsel-search .icon {
  position: absolute;
  left: 20px;
  top: 50%;
  width: 14px;
  height: 14px;
  transform: translateY(-50%);
  stroke: #7c8f71;
  fill: none;
}
.fsel-search input {
  width: 100%;
  border: 1px solid transparent;
  background: var(--soft);
  border-radius: 8px;
  padding: 9px 10px 9px 32px;
  font-size: 12px;
}
.fsel-search input:focus {
  background: #fff;
  border-color: var(--green);
  box-shadow: 0 0 0 3px #2f6c5918;
}
.fsel-options {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px;
  flex: 1;
  min-height: 0;
}
.fsel-group {
  padding: 12px 10px 5px;
  font-size: 9.5px;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  color: #7c8f71;
}
.fsel-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 11px;
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--ink);
  cursor: pointer;
  transition: background-color 0.1s;
}
.fsel-option.active {
  background: var(--soft);
}
.fsel-option.selected {
  color: var(--green);
  font-weight: 600;
  background: #e6efdc;
}
.fsel-option .icon {
  width: 15px;
  height: 15px;
  stroke: var(--green);
  fill: none;
  stroke-width: 2.4;
  flex-shrink: 0;
}
.fsel-option.disabled {
  color: #9aa79f;
  cursor: default;
}
.fsel-option.disabled.active {
  background: transparent;
}
.fsel-empty {
  padding: 18px 12px;
  font-size: 12px;
  color: var(--muted);
}
:is(#app, #overlay, main) select.fsel-open {
  border-color: var(--green);
  box-shadow: 0 0 0 3px #2f6c5922;
  background-image: var(--chevron-up);
}
/* Téléphone : le menu monte du bas de l’écran */
.fsel-sheet {
  pointer-events: auto;
  background: #0b221e00;
  transition: background-color 0.2s;
}
.fsel-sheet.in {
  background: #0b221e52;
}
.fsel-sheet .fsel {
  left: 0;
  right: 0;
  bottom: 0;
  top: auto;
  max-height: 74vh;
  border-radius: 20px 20px 0 0;
  transform: translateY(100%);
  padding-bottom: env(safe-area-inset-bottom);
  transition: transform 0.22s var(--ease-out);
}
.fsel-sheet.in .fsel {
  transform: none;
}
.fsel-sheet.out .fsel {
  transform: translateY(100%);
}
.fsel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 10px;
}
.fsel-head::before {
  content: '';
  position: absolute;
  top: 7px;
  left: 50%;
  width: 38px;
  height: 4px;
  margin-left: -19px;
  border-radius: 2px;
  background: #d5ded7;
}
.fsel-head b {
  font-size: 15px;
  color: var(--ink);
}
.fsel-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--soft);
  font-size: 18px;
  color: var(--ink);
}
.fsel-sheet .fsel-option {
  padding: 14px 13px;
  font-size: 14px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
}
