/* ====================================================================
 * Coconut Studio — Styles spécifiques studio
 * ====================================================================
 * Ajouts au système de design pour des composants particuliers
 * (catalogue, etc.). On ne modifie pas tokens.css/components.css qui
 * restent strictement alignés avec le repo design/.
 * ==================================================================== */

/* ---------- Catalogue ---------- */
.cat-section {
  margin-bottom: 32px;
}
.cat-section__head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.cat-section__head h2 {
  margin: 0;
  font-size: var(--fs-lg);
  letter-spacing: -0.01em;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}
.cat-section__head .count {
  color: var(--ink-45);
  font-family: var(--font-mono);
  font-size: 12px;
}
.cat-section__head .actions { margin-left: auto; }

.prest {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  overflow: hidden;
}
.prest + .prest { margin-top: 10px; }
.prest__head {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
}
.prest__title { min-width: 0; }
.prest__name {
  font-weight: 500;
  font-size: var(--fs-base);
  display: flex;
  align-items: center;
  gap: 8px;
}
.prest__name .code {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-45);
}
.prest__desc {
  color: var(--ink-65);
  font-size: var(--fs-xs);
  margin-top: 2px;
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.prest__unit {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-65);
  background: var(--surface);
  padding: 3px 8px;
  border-radius: 4px;
}
.prest__price {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-md);
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.prest__actions {
  display: flex;
  gap: 4px;
}
.prest__tiers {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 12px 16px;
}
.prest__tier {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 16px;
  align-items: center;
  padding: 6px 0;
  font-size: var(--fs-sm);
}
.prest__tier + .prest__tier { border-top: 1px dashed var(--line); }
.prest__tier .name { font-weight: 500; }
.prest__tier .meta { color: var(--ink-65); font-size: var(--fs-xs); margin-top: 1px; }
.prest__tier .price {
  font-family: var(--font-mono);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.prest__tier-add {
  display: grid;
  grid-template-columns: 1fr 120px auto;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}
.prest.is-disabled { opacity: 0.55; }
.prest.is-disabled .prest__name::after {
  content: "désactivé";
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-45);
  background: var(--ink-12);
  padding: 1px 6px;
  border-radius: 4px;
}

/* ---------- Devis (formulaire + totaux) ---------- */
.form-section {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.form-section:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.form-section > h2 {
  font-size: var(--fs-md);
  font-weight: 500;
  margin: 0 0 12px 0;
  letter-spacing: -0.01em;
}

.totals-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.totals-table td {
  padding: 4px 8px;
}
.totals-table td:first-child {
  color: var(--ink-65);
}

.danger-card {
  background: var(--surface);
}

/* ---------- Bouton refresh : rotation discrète pendant le fetch ---------- */
.is-spinning {
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ---------- Toasts (lib/toast.js + Ui.ToastHost) ---------- */
.toast-host {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: 360px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  font-size: var(--fs-sm);
  color: var(--ink);
  pointer-events: auto;
  animation: toastSlideIn 0.18s ease-out;
}
.toast--success {
  border-color: var(--leaf);
  background: rgba(45, 91, 63, 0.08);
  color: var(--leaf);
}
.toast--error {
  border-color: var(--danger);
  background: var(--danger-soft, rgba(193, 59, 44, 0.08));
  color: var(--danger);
}
.toast__msg {
  flex: 1;
  min-width: 0;
}
.toast__close {
  border: none;
  background: transparent;
  color: inherit;
  opacity: 0.65;
  cursor: pointer;
  padding: 2px;
  display: inline-flex;
  align-items: center;
  border-radius: 4px;
}
.toast__close:hover { opacity: 1; }
@keyframes toastSlideIn {
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ====================================================================
 * Micro-interactions et transitions (Chantier P8)
 * Objectif design.md : l'app doit être plus vivante mais SOBRE.
 * ==================================================================== */

/* Boutons : hover plus marqué (translate + transition uniforme) */
.btn {
  transition: background 0.15s ease, border-color 0.15s ease,
              color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover:not([disabled]):not(.is-disabled) {
  transform: translateY(-1px);
}
.btn:active:not([disabled]):not(.is-disabled) {
  transform: translateY(0);
}

/* Cards : hover discret */
.card {
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* Tableaux : transition au hover des lignes */
.table tbody tr {
  transition: background 0.15s ease;
}

/* Modal : fade-in + slide-up (animation discrète 200ms max) */
@keyframes modalFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes modalSlideUp {
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: translateY(0);   opacity: 1; }
}
.modal-anim-bg {
  animation: modalFadeIn 0.15s ease-out;
}
.modal-anim-content {
  animation: modalSlideUp 0.18s ease-out;
}

/* Autocomplete dropdown : déjà animé inline ; classe utilitaire dispo */
.autocomplete-list {
  animation: modalSlideUp 0.12s ease-out;
}

/* Skeleton loader : rectangle grisé animé (alternative au spinner sur listes) */
@keyframes skeletonPulse {
  0%   { background-color: var(--surface); }
  50%  { background-color: rgba(30, 20, 12, 0.06); }
  100% { background-color: var(--surface); }
}
.skeleton {
  display: inline-block;
  background: var(--surface);
  border-radius: 4px;
  animation: skeletonPulse 1.2s ease-in-out infinite;
  vertical-align: middle;
}
.skeleton--text   { height: 12px; border-radius: 3px; }
.skeleton--row    { height: 14px; margin: 6px 0; }
.skeleton--avatar { width: 22px; height: 22px; border-radius: 50%; }
.skeleton--block  { width: 100%; height: 80px; }

/* Liste de skeleton rows (utilisée dans les pages de liste pendant load) */
.skeleton-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 0;
}

/* ---------- Shortcuts footer (P9) ---------- */
.shortcuts-footer {
  position: fixed;
  bottom: 12px;
  right: 16px;
  z-index: 50;
  display: flex;
  gap: 14px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 11px;
  color: var(--ink-65);
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.shortcuts-footer__item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.shortcuts-footer kbd {
  display: inline-block;
  padding: 1px 6px;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-bottom-width: 1.5px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink);
  line-height: 1.3;
}

/* ---------- Empty state riche (P10) ---------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  color: var(--ink-65);
}
.empty-state__icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  color: var(--ink-45);
  margin-bottom: 16px;
}
.empty-state__title {
  font-size: var(--fs-md);
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 6px;
}
.empty-state__desc {
  font-size: var(--fs-sm);
  color: var(--ink-65);
  max-width: 420px;
  line-height: 1.5;
  margin-bottom: 16px;
}
.empty-state__action {
  margin-top: 4px;
}

/* ---------- Command Palette (P11) ---------- */
.command-palette__backdrop {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.32);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
  animation: modalFadeIn 0.12s ease-out;
}
.command-palette {
  width: 100%;
  max-width: 560px;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  max-height: 70vh;
  overflow: hidden;
}
.command-palette__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-65);
}
.command-palette__input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-size: var(--fs-md);
  font-family: var(--font-sans);
}
.command-palette__list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}
.command-palette__group-head {
  padding: 6px 14px 2px;
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-45);
}
.command-palette__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  cursor: pointer;
  color: var(--ink);
  font-size: 13px;
  transition: background 0.1s ease;
}
.command-palette__item.is-highlighted {
  background: var(--surface);
}
.command-palette__label {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.command-palette__sub {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
}
