/* ============================================================
   PANNEAU DE PERSONNALISATION — composant partagé par les démos.
   Espace de noms "tp-" pour ne jamais entrer en collision avec
   les classes Tailwind générées par la page hôte.
   ============================================================ */
#tp-root {
  --tp-ink: #14171c;
  --tp-panel: #1c2027;
  --tp-panel-2: #232830;
  --tp-line: #313945;
  --tp-mut: #8a93a3;
  --tp-txt: #e7ebf1;
  --tp-fn: #5b8cff;
  font-family: 'Inter', system-ui, sans-serif;
  position: fixed;
  z-index: 2147483000;
  bottom: 20px;
  right: 20px;
}

#tp-root * { box-sizing: border-box; }

.tp-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--tp-panel);
  color: var(--tp-txt);
  border: 1px solid var(--tp-line);
  border-radius: 999px;
  padding: 12px 18px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 12px 30px -10px #00000066;
}
.tp-toggle:hover { border-color: var(--tp-fn); }
.tp-toggle svg { width: 16px; height: 16px; flex: none; }

.tp-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: min(340px, 100vw);
  background: var(--tp-panel);
  color: var(--tp-txt);
  border-left: 1px solid var(--tp-line);
  box-shadow: -20px 0 40px -20px #00000080;
  transform: translateX(100%);
  transition: transform .25s ease;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.tp-drawer.tp-open { transform: translateX(0); }

.tp-drawer__head {
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--tp-line);
  position: sticky; top: 0;
  background: var(--tp-panel);
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px;
  z-index: 1;
}
.tp-drawer__head h2 { font-size: 14px; font-weight: 600; margin: 0; letter-spacing: .2px; }
.tp-drawer__head p { font-size: 12px; color: var(--tp-mut); margin: 4px 0 0; line-height: 1.4; }
.tp-close {
  background: none; border: none; color: var(--tp-mut);
  cursor: pointer; font-size: 18px; line-height: 1; padding: 2px;
}
.tp-close:hover { color: var(--tp-txt); }

.tp-group { padding: 18px 22px; border-bottom: 1px solid var(--tp-line); }
.tp-group__label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .12em;
  color: var(--tp-mut); margin: 0 0 12px; font-weight: 600;
}

.tp-field {
  width: 100%; background: var(--tp-panel-2); color: var(--tp-txt);
  border: 1px solid var(--tp-line); border-radius: 8px;
  padding: 10px 12px; font: inherit; font-size: 13px;
}
select.tp-field {
  appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a93a3' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.tp-field:focus-visible { outline: 2px solid var(--tp-fn); outline-offset: 1px; }

.tp-swatch { display: flex; align-items: center; gap: 11px; padding: 7px 0; }
.tp-swatch label { flex: 1; font-size: 13px; color: var(--tp-txt); }
.tp-swatch .tp-hex { font-size: 11px; color: var(--tp-mut); font-variant-numeric: tabular-nums; }
.tp-swatch input[type=color] {
  -webkit-appearance: none; appearance: none;
  width: 34px; height: 34px; border: 1px solid var(--tp-line);
  border-radius: 8px; padding: 0; background: none; cursor: pointer;
}
.tp-swatch input[type=color]::-webkit-color-swatch-wrapper { padding: 3px; }
.tp-swatch input[type=color]::-webkit-color-swatch { border: none; border-radius: 5px; }

.tp-btn {
  width: 100%; margin-top: 10px;
  background: var(--tp-fn); color: #fff; border: none;
  border-radius: 8px; padding: 11px; font: inherit; font-weight: 600;
  font-size: 13px; cursor: pointer;
}
.tp-btn:hover { filter: brightness(1.08); }
.tp-btn:disabled { opacity: .55; cursor: wait; }
.tp-btn--ghost {
  background: transparent; color: var(--tp-mut);
  border: 1px solid var(--tp-line); margin-top: 8px;
}
.tp-btn--ghost:hover { color: var(--tp-txt); border-color: var(--tp-mut); }

.tp-share { margin-top: 10px; display: none; }
.tp-share.tp-show { display: block; }
.tp-share__row { display: flex; gap: 6px; }
.tp-share__row input {
  flex: 1; min-width: 0;
  background: var(--tp-panel-2); color: var(--tp-txt);
  border: 1px solid var(--tp-line); border-radius: 8px;
  padding: 8px 10px; font-size: 12px;
}
.tp-share__row button {
  flex: none; background: var(--tp-panel-2); color: var(--tp-txt);
  border: 1px solid var(--tp-line); border-radius: 8px;
  padding: 8px 12px; font: inherit; font-size: 12px; cursor: pointer;
}
.tp-share__row button:hover { border-color: var(--tp-fn); }
.tp-msg { font-size: 12px; margin: 8px 0 0; line-height: 1.4; min-height: 0; }
.tp-msg--err { color: #ff8f8f; }
.tp-msg--ok { color: #8fd19e; }

@media (max-width: 480px) {
  .tp-drawer { width: 100vw; }
  #tp-root { bottom: 14px; right: 14px; }
}
