/* =====================================================================
   Le Champ du Coq — espace gérant
   Clair, lisible, pensé pour un usage au téléphone comme à l'ordinateur.
   ===================================================================== */

:root {
  --bg: #f4efe8;
  --surface: #ffffff;
  --line: #e4dbd0;
  --text: #1c1716;
  --text-2: #5d5552;
  --accent: #9b2f1f;
  --accent-hover: #7f2517;
  --accent-soft: #f6e3de;
  --ink: #141111;
  --ok: #1f7a46;
  --danger: #b3261e;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(28, 23, 22, 0.06), 0 8px 24px -12px rgba(28, 23, 22, 0.18);
  --font-script: 'Birthstone', cursive;
  --font-sans: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-sans); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
img { display: block; max-width: 100%; }
button { font: inherit; }
h1 { margin: 0; font-size: clamp(1.6rem, 1.3rem + 1vw, 2.1rem); letter-spacing: -0.02em; }
.muted { color: var(--text-2); margin: 0.3rem 0 0; }
.hint { color: var(--text-2); font-weight: 400; font-size: 0.85rem; }
:focus-visible { outline: 3px solid rgba(155, 47, 31, 0.45); outline-offset: 2px; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* --------------------------------------------------------------- marque */
.brand { display: inline-flex; flex-direction: column; font-family: var(--font-script); line-height: 0.78; color: var(--ink); text-decoration: none; }
.brand__le { font-size: 1.1rem; margin-left: 0.2rem; }
.brand__champ { font-size: 2.5rem; }
.brand__champ small { font-size: 1.15rem; }
.brand__coq { font-size: 2.5rem; margin-left: 1.5rem; }
.brand--light { color: #fff; }

/* -------------------------------------------------------------- boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; min-height: 46px; padding: 0.65rem 1.2rem;
  border-radius: 8px; border: 1px solid transparent; font-weight: 600; font-size: 0.95rem; cursor: pointer; text-decoration: none;
  transition: background 150ms, border-color 150ms, color 150ms, transform 150ms;
}
.btn:active { transform: scale(0.98); }
.btn[disabled] { opacity: 0.6; cursor: progress; }
.btn--block { width: 100%; }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-hover); }
.btn--ghost { background: var(--surface); border-color: var(--line); color: var(--text); }
.btn--ghost:hover { border-color: var(--text-2); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger-ghost { background: transparent; color: var(--danger); border-color: rgba(179, 38, 30, 0.35); }
.btn--danger-ghost:hover { background: #fdeceb; }
.btn--sm { min-height: 38px; padding: 0.4rem 0.8rem; font-size: 0.88rem; }
.iconbtn { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); cursor: pointer; }
.iconbtn:hover { color: var(--text); border-color: var(--text-2); }
.iconbtn--danger:hover { color: var(--danger); border-color: var(--danger); }
.iconbtn[disabled] { opacity: 0.35; cursor: default; }
.linkbtn { background: none; border: 0; padding: 0.35rem 0; color: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: 0.92rem; text-align: left; }

/* --------------------------------------------------------------- champs */
.field { display: flex; flex-direction: column; gap: 0.35rem; font-weight: 600; font-size: 0.92rem; }
.field__label { display: block; font-weight: 600; font-size: 0.92rem; margin-bottom: 0.5rem; }
.field input, .field textarea, .input {
  font: inherit; font-weight: 400; font-size: 1rem; color: var(--text); background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: 0.7rem 0.8rem; min-height: 46px; width: 100%;
}
.field input:focus, .field textarea:focus, .input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(155, 47, 31, 0.15); }
.form-error { margin: 0; color: var(--danger); font-size: 0.92rem; white-space: pre-line; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; box-shadow: var(--shadow); }
.stack { display: flex; flex-direction: column; gap: 1.2rem; }

.switch { display: flex; align-items: center; gap: 0.75rem; font-weight: 600; cursor: pointer; margin-bottom: 1rem; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch__track { width: 46px; height: 28px; border-radius: 99px; background: #cfc6bc; position: relative; transition: background 150ms; flex: none; }
.switch__track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 200ms; }
.switch input:checked + .switch__track { background: var(--ok); }
.switch input:checked + .switch__track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch__track { outline: 3px solid rgba(155, 47, 31, 0.45); outline-offset: 2px; }

/* ---------------------------------------------------------------- login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: radial-gradient(80% 60% at 50% 0%, #ead8cf, var(--bg)); }
.login__card { width: min(420px, 100%); background: var(--surface); border-radius: 16px; padding: 2rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 1rem; }
.login__card h1 { margin-top: 0.6rem; }
.demo-hint { margin: 0; padding: 0.7rem 0.9rem; border-radius: 8px; background: var(--accent-soft); font-size: 0.9rem; }
.demo-hint code { font-weight: 700; }

/* ------------------------------------------------------------- layout */
.app { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--ink); color: #fff; padding: 1.4rem 1rem; display: flex; flex-direction: column; gap: 2rem; }
.sidebar .brand { padding-inline: 0.5rem; }
.sidebar__nav { display: flex; flex-direction: column; gap: 0.3rem; }
.navbtn {
  display: flex; align-items: center; gap: 0.75rem; width: 100%; min-height: 46px; padding: 0.6rem 0.8rem; border: 0; border-radius: 8px;
  background: transparent; color: #d9d0cc; font-weight: 500; cursor: pointer; text-align: left;
}
.navbtn:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.navbtn[aria-current='page'] { background: var(--accent); color: #fff; }
.badge { margin-left: auto; min-width: 22px; padding: 0 6px; border-radius: 99px; background: #fff; color: var(--accent); font-size: 0.75rem; line-height: 22px; text-align: center; }
.sidebar__foot { margin-top: auto; display: flex; flex-direction: column; gap: 0.2rem; padding-inline: 0.5rem; color: #d9d0cc; }
.mode-pill { align-self: flex-start; margin-bottom: 0.6rem; padding: 0.2rem 0.6rem; border-radius: 99px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; background: #3a2f2c; }
.mode-pill.is-live { background: var(--ok); color: #fff; }
.content { padding: clamp(1.2rem, 3vw, 2.6rem); min-width: 0; padding-bottom: 7rem; }
.panel { max-width: 1100px; margin: 0 auto; }
.panel__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.6rem; }

/* ------------------------------------------------------- liste articles */
.article-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.8rem; }
.article-row { display: grid; grid-template-columns: 84px 1fr auto; gap: 1rem; align-items: center; padding: 0.8rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.article-row__thumb { width: 84px; height: 64px; border-radius: 6px; object-fit: cover; background: var(--line); }
.article-row__title { font-weight: 700; margin: 0; }
.article-row__meta { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 0.25rem; font-size: 0.85rem; color: var(--text-2); }
.status { padding: 0.1rem 0.55rem; border-radius: 99px; font-size: 0.75rem; font-weight: 700; }
.status--on { background: #e3f3e9; color: var(--ok); }
.status--off { background: #eee8e2; color: var(--text-2); }
.article-row__actions { display: flex; gap: 0.4rem; }
.empty { padding: 2.5rem 1rem; text-align: center; color: var(--text-2); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }

/* -------------------------------------------------------------- éditeur */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.4rem; align-items: start; }
.editor__main { display: flex; flex-direction: column; gap: 1.1rem; }
.editor__side { display: flex; flex-direction: column; gap: 1rem; position: sticky; top: 1rem; }
.editor__side .field + .field { margin-top: 0.9rem; }
.editor__actions { display: flex; flex-direction: column; gap: 0.6rem; }
.quill-wrap { background: var(--surface); border-radius: 8px; }
.quill-wrap .ql-toolbar { border-radius: 8px 8px 0 0; border-color: var(--line); font-family: var(--font-sans); }
.quill-wrap .ql-container { min-height: 320px; border-radius: 0 0 8px 8px; border-color: var(--line); font-family: var(--font-sans); font-size: 1.05rem; font-weight: 400; }
.quill-wrap .ql-editor { min-height: 320px; line-height: 1.7; }
.cover { aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; background: var(--bg); border: 1px dashed var(--line); display: grid; place-items: center; color: var(--text-2); font-size: 0.9rem; margin-bottom: 0.8rem; }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.upload { position: relative; overflow: hidden; }
.upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload:focus-within { outline: 3px solid rgba(155, 47, 31, 0.45); outline-offset: 2px; }

/* --------------------------------------------------------------- carte */
.chips { display: flex; gap: 0.5rem; overflow-x: auto; padding-bottom: 0.4rem; margin-bottom: 1.2rem; }
.chip { flex: none; min-height: 42px; padding: 0.45rem 1rem; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; cursor: pointer; }
.chip[aria-pressed='true'] { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip--add { border-style: dashed; color: var(--accent); }
.tab-settings { display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: end; margin-bottom: 1.2rem; }
.tab-settings__photo { display: flex; align-items: center; gap: 0.8rem; }
.tab-settings__photo img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; }
.menu-section { margin-bottom: 1.2rem; }
.menu-section__head { display: flex; gap: 0.6rem; align-items: center; margin-bottom: 0.8rem; }
.menu-section__head .input { font-weight: 700; font-size: 1.05rem; }
.item-row { display: grid; grid-template-columns: minmax(0, 1.4fr) 130px minmax(0, 2fr) auto; gap: 0.5rem; align-items: start; padding: 0.6rem 0; border-top: 1px solid var(--line); }
.item-row__tools { display: flex; gap: 0.3rem; }
.item-row label { display: block; min-width: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.savebar {
  position: fixed; left: 250px; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: flex-end; align-items: center; gap: 1rem;
  padding: 0.9rem clamp(1.2rem, 3vw, 2.6rem); background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(8px); border-top: 1px solid var(--line);
}
.savebar.is-dirty [data-menu-dirty] { color: var(--accent); font-weight: 700; }

/* --------------------------------------------------------------- infos */
.hours-edit { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.hours-edit legend { font-weight: 600; font-size: 0.92rem; margin-bottom: 0.5rem; }
.hour-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 0.5rem; }

/* ------------------------------------------------------------ messages */
.messages { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.8rem; }
.message { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; display: grid; grid-template-columns: 1fr auto; gap: 0.4rem 1rem; }
.message__head { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; align-items: baseline; }
.message__head strong { font-size: 1.05rem; }
.message__head a { color: var(--accent); font-weight: 600; }
.message__date { color: var(--text-2); font-size: 0.85rem; }
.message__body { grid-column: 1 / -1; margin: 0; white-space: pre-wrap; }

/* -------------------------------------------------- dialogue et toasts */
.dialog { border: 0; border-radius: 14px; padding: 1.6rem; width: min(420px, calc(100% - 2rem)); box-shadow: var(--shadow); }
.dialog::backdrop { background: rgba(20, 17, 17, 0.5); }
.dialog p { margin: 0 0 1.4rem; font-size: 1.05rem; }
.dialog__actions { display: flex; justify-content: flex-end; gap: 0.6rem; }
.toasts { position: fixed; right: 1rem; bottom: 5.5rem; z-index: 100; display: flex; flex-direction: column; gap: 0.5rem; }
.toast { padding: 0.8rem 1.1rem; border-radius: 10px; background: var(--ink); color: #fff; box-shadow: var(--shadow); font-weight: 500; animation: toast-in 250ms ease-out; max-width: 340px; }
.toast--error { background: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* ----------------------------------------------------------- responsive */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: auto 0 0 0; height: auto; z-index: 30; flex-direction: row; padding: 0.4rem; gap: 0; }
  .sidebar .brand, .sidebar__foot .mode-pill, .sidebar__foot .linkbtn:not([data-logout]) { display: none; }
  .sidebar__nav { flex: 1; flex-direction: row; justify-content: space-around; }
  .navbtn { flex-direction: column; gap: 0.15rem; font-size: 0.72rem; padding: 0.45rem 0.3rem; min-height: 56px; justify-content: center; text-align: center; position: relative; }
  .navbtn .badge { position: absolute; top: 4px; right: 18%; margin: 0; }
  .sidebar__foot { margin: 0; justify-content: center; padding: 0 0.4rem; }
  .sidebar__foot [data-logout] { font-size: 0.72rem; }
  .content { padding-bottom: 10rem; }
  .editor { grid-template-columns: 1fr; }
  .editor__side { position: static; }
  .savebar { left: 0; bottom: 68px; }
  .item-row { grid-template-columns: 1fr 110px; }
  .item-row > :nth-child(3) { grid-column: 1 / -1; }
  .item-row__tools { grid-column: 1 / -1; justify-content: flex-end; }
  .toasts { bottom: 9rem; }
}
@media (max-width: 560px) {
  .article-row { grid-template-columns: 64px 1fr; }
  .article-row__thumb { width: 64px; height: 52px; }
  .article-row__actions { grid-column: 1 / -1; justify-content: flex-end; }
  .tab-settings { grid-template-columns: 1fr; }
}
