/* ==========================================================================
   Console — page de création et administration d'un restaurant.

   Volontairement neutre : c'est l'outil, pas la marque du restaurant. Seuls les
   aperçus reprennent la couleur choisie par le restaurateur.
   ========================================================================== */

:root {
  --ink:     #211a16;
  --paper:   #faf7f2;
  --card:    #ffffff;
  --border:  #e4dbcf;
  --muted:   #857463;
  --body:    #5d4f42;
  --accent:  #b4441f;
  --accent-soft: #fbeee8;
  --green:   #1a7a3c;
  --red:     #b3261e;
  --radius:  14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Archivo', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

h1, h2, h3 { margin: 0; font-family: 'Archivo Black', system-ui, sans-serif; font-weight: 400; }
h1 { font-size: 30px; letter-spacing: -0.4px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
p  { margin: 0; }
a  { color: var(--accent); }

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 1px;
}

.wrap { max-width: 940px; margin: 0 auto; padding: 0 20px; }

/* ------------------------------------------------------------- boutons */

.btn {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { border-color: var(--muted); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { filter: brightness(1.08); }
.btn--danger { color: var(--red); }
.btn--ghost { background: transparent; }
.btn--sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn--lg { padding: 14px 24px; font-size: 17px; border-radius: 12px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* --------------------------------------------------------------- champs */

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label { font-size: 13px; font-weight: 600; color: var(--body); }
.field input[type="text"],
.field input[type="number"],
.field textarea,
.field select {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  background: var(--card);
  width: 100%;
}
.field textarea { resize: vertical; min-height: 62px; }
.field--inline { flex-direction: row; align-items: center; gap: 10px; }
.field__hint { font-size: 12px; color: var(--muted); }

.grid { display: grid; gap: 14px; }
.grid--2 { grid-template-columns: 1fr 1fr; }
.grid--3 { grid-template-columns: repeat(3, 1fr); }

.check { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

.color-row { display: flex; align-items: center; gap: 10px; }
.color-row input[type="color"] {
  width: 46px; height: 38px; padding: 0;
  border: 1px solid var(--border); border-radius: 10px; background: var(--card);
  cursor: pointer;
}

/* ------------------------------------------------------------- landing */

.landing { padding: 60px 0 80px; }
.landing__lede { font-size: 18px; color: var(--body); margin-top: 12px; max-width: 620px; }
.landing__form { display: flex; gap: 10px; margin-top: 28px; max-width: 560px; }
.landing__form input { flex: 1; }
.landing__steps {
  margin-top: 44px;
  display: grid; gap: 16px; grid-template-columns: repeat(3, 1fr);
}
.step {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
}
.step__n {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  font-weight: 700; font-size: 13px; margin-bottom: 10px;
}
.step p { color: var(--body); font-size: 14px; }

.result {
  margin-top: 32px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
  display: flex; flex-direction: column; gap: 18px;
}
.link-block { display: flex; flex-direction: column; gap: 6px; }
.link-block__label { font-weight: 700; }
.link-block__note { font-size: 13px; color: var(--muted); }
.link-row { display: flex; gap: 8px; }
.link-row input {
  flex: 1; min-width: 0;
  border: 1px solid var(--border); border-radius: 10px;
  padding: 9px 12px; background: var(--paper);
  font-family: ui-monospace, monospace; font-size: 13px;
}
.warn {
  background: #fff7e8; border: 1px solid #eccf8f;
  border-radius: 10px; padding: 12px 14px;
  font-size: 14px; color: #6b4d12;
}
.mine { margin-top: 40px; }
.mine ul { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-direction: column; gap: 8px; }
.mine li {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.mine__links { display: flex; gap: 12px; font-size: 14px; flex-shrink: 0; }

/* --------------------------------------------------------------- admin */

.appbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--ink); color: #f6efe6;
  padding: 12px 0;
}
.appbar__inner { display: flex; align-items: center; gap: 16px; }
.appbar__title { flex: 1; min-width: 0; }
.appbar__name {
  font-family: 'Archivo Black', sans-serif; font-size: 18px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.appbar__sub { font-size: 13px; opacity: 0.7; }
.appbar .btn { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.25); color: inherit; }
.appbar .btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }

.saved-flag { font-size: 13px; opacity: 0.75; white-space: nowrap; }
.saved-flag--error { color: #ffb4a8; opacity: 1; }

.tabs { display: flex; gap: 6px; padding: 18px 0 0; flex-wrap: wrap; }
.tab {
  border: 1px solid var(--border); background: var(--card);
  border-radius: 999px; padding: 8px 16px; cursor: pointer; font-weight: 600;
}
.tab.is-active { background: var(--ink); border-color: var(--ink); color: #f6efe6; }

.panel { padding: 22px 0 80px; display: flex; flex-direction: column; gap: 16px; }

.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
  display: flex; flex-direction: column; gap: 14px;
}
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card__actions { display: flex; gap: 6px; flex-shrink: 0; }

.row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--paper);
}
.row__grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.row__side { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }

.icon-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.icon-picker button {
  width: 42px; height: 42px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--card);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--body);
}
.icon-picker button.is-active { background: var(--ink); border-color: var(--ink); color: #f6efe6; }

.empty { color: var(--muted); font-size: 14px; font-style: italic; }
.subtle { color: var(--muted); font-size: 13px; }

.chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-edit {
  display: flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--card); padding: 4px 4px 4px 12px;
}
.chip-edit input { border: none; background: transparent; width: 130px; padding: 4px 0; }
.chip-edit button {
  border: none; background: transparent; cursor: pointer;
  color: var(--muted); width: 24px; height: 24px; border-radius: 50%;
}
.chip-edit button:hover { background: var(--accent-soft); color: var(--accent); }

.errors {
  background: #fdecea; border: 1px solid #f2b8b3; color: var(--red);
  border-radius: 10px; padding: 12px 14px; font-size: 14px;
}

/* --------------------------------------------------- choix par bascule */

.segmented { display: flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.segmented button {
  flex: 1; border: none; background: var(--card);
  padding: 10px 14px; cursor: pointer; font-weight: 600;
}
.segmented button + button { border-left: 1px solid var(--border); }
.segmented button.is-active { background: var(--ink); color: #f6efe6; }

/* Étiquette cliquable façon interrupteur, pour les listes courtes. */
.pick {
  border: 1px solid var(--border); background: var(--card);
  border-radius: 999px; padding: 6px 14px; cursor: pointer; font-size: 14px;
}
.pick.is-on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }

/* ---------------------------------------------------------- formule menu */

.formula-picker {
  max-height: 260px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; background: var(--paper);
  display: flex; flex-direction: column; gap: 4px;
}
.formula-picker__cat {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--muted);
  margin-top: 8px;
}
.formula-picker__cat:first-child { margin-top: 0; }

.formula-preview {
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--accent-soft); padding: 12px 14px;
  display: flex; flex-direction: column; gap: 4px;
}
.formula-preview__result { margin-top: 4px; }

/* --------------------------------------------------------- pictogrammes */

.asset-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}
.asset {
  margin: 0; padding: 12px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--paper);
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
}
.asset img { width: 48px; height: 48px; object-fit: contain; }
.asset figcaption { display: flex; flex-direction: column; gap: 2px; min-width: 0; width: 100%; }
.asset__name {
  font-weight: 600; font-size: 13px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.icon-asset { object-fit: contain; display: block; }

/* --------------------------------------------------------- motifs */

.pattern-preview {
  height: 140px; border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
}
.pattern-preview > * { position: relative; z-index: 1; }
.pattern-preview__mark {
  width: 44px; height: 44px; border-radius: 50%; background: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Archivo Black', sans-serif; font-size: 16px;
}
.pattern-preview__name { font-family: 'Archivo Black', sans-serif; font-size: 22px; }

.pattern-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.pattern-swatch {
  width: 108px; height: 66px; border-radius: 10px; overflow: hidden;
  border: 2px solid var(--border); cursor: pointer; padding: 0;
  display: flex; align-items: flex-end; justify-content: center;
}
.pattern-swatch.is-active { border-color: var(--ink); }
.pattern-swatch__label {
  position: relative; z-index: 1;
  width: 100%; padding: 3px 4px;
  background: rgba(0, 0, 0, 0.45); color: #fff;
  font-size: 11px; font-weight: 600;
}

.color-dot {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--border); cursor: pointer; padding: 0;
}
.color-dot.is-active { border-color: var(--ink); box-shadow: 0 0 0 2px var(--paper) inset; }

/* ------------------------------------------------------- visuels produits */

/* Ligne d'édition compacte : plusieurs champs alignés plutôt qu'empilés. */
.inline-row {
  display: flex; align-items: flex-end; gap: 10px;
  padding: 10px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--paper);
}
.inline-row__grow { flex: 1; min-width: 0; }
.inline-row .field { min-width: 96px; }
.tier-result {
  display: flex; flex-direction: column; gap: 2px;
  min-width: 92px; padding-bottom: 8px;
}

@media (max-width: 720px) {
  .inline-row { flex-direction: column; align-items: stretch; }
}

.url-import { display: flex; gap: 8px; }
.url-import input {
  flex: 1; min-width: 0;
  border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 12px; background: var(--card); font-size: 14px;
}

.visual { display: flex; gap: 12px; align-items: flex-start; }
.visual__preview {
  width: 96px; height: 96px; flex-shrink: 0;
  border-radius: 10px; border: 1px solid var(--border);
  object-fit: cover; background: var(--paper);
}
.visual__preview--empty {
  display: flex; align-items: center; justify-content: center;
  padding: 6px; text-align: center;
  font-family: ui-monospace, monospace; font-size: 10px; color: var(--muted);
  background: repeating-linear-gradient(45deg, #f3e9db, #f3e9db 8px, #ece0cf 8px, #ece0cf 16px);
}
.visual__actions { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }

@media (max-width: 720px) {
  .visual { flex-direction: column; }
}

@media (max-width: 720px) {
  .grid--2, .grid--3, .landing__steps { grid-template-columns: 1fr; }
  .landing__form { flex-direction: column; }
  .row { flex-direction: column; }
  .row__side { flex-direction: row; }
}
