/* =====================================================================
   ChillEatGo — feuille de style
   Identité : marché de rue / food truck
   Basilic (#17694A) + Ambre (#F2A93B) sur papier chaud (#FBF8F2)
   ===================================================================== */

:root {
  --paper:       #FBF8F2;
  --card:        #FFFFFF;
  --ink:         #1B1917;
  --ink-soft:    #6B6559;
  --ink-faint:   #9A9285;
  --green:       #17694A;
  --green-bright:#1F8A62;
  --green-wash:  #E8F1EC;
  --amber:       #F2A93B;
  --amber-wash:  #FDF0D8;
  --tomato:      #D6482F;
  --tomato-wash: #FBE6E1;
  --line:        #E7E0D4;
  --shadow:      0 1px 2px rgba(27,25,23,.04), 0 8px 24px rgba(27,25,23,.06);
  --radius:      14px;
  --radius-sm:   9px;
  --maxw:        1080px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: 'Bricolage Grotesque', 'Inter', sans-serif;
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0 0 .5em;
}
h1 { font-size: clamp(1.9rem, 4vw, 2.9rem); }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; font-weight: 600; }

a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }

code, .mono { font-family: 'JetBrains Mono', monospace; }

/* ---- Top bar -------------------------------------------------------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .85rem 1.4rem;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.brand { display: inline-flex; align-items: center; gap: .5rem; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark { color: var(--amber); font-size: 1.5rem; line-height: 1; }
.brand-name {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 800; font-size: 1.35rem; color: var(--ink);
  letter-spacing: -0.03em;
}
.brand-go { color: var(--green); }
.topnav { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.topnav a { color: var(--ink-soft); font-weight: 500; font-size: .95rem; }
.topnav a:hover { color: var(--ink); text-decoration: none; }

/* ---- Layout --------------------------------------------------------- */
.page { max-width: var(--maxw); margin: 0 auto; padding: 2rem 1.4rem 4rem; }
.page-narrow { max-width: 560px; }
.stack > * + * { margin-top: 1rem; }
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }
.center { text-align: center; }
.row { display: flex; gap: 1rem; flex-wrap: wrap; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.eyebrow {
  text-transform: uppercase; letter-spacing: .14em; font-size: .72rem;
  font-weight: 600; color: var(--green); margin-bottom: .4rem;
}

/* ---- Buttons -------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  background: var(--green); color: #fff; border: 1px solid var(--green);
  padding: .7rem 1.2rem; border-radius: 999px; font-weight: 600;
  font-size: .95rem; cursor: pointer; text-decoration: none;
  transition: transform .06s ease, background .15s ease, box-shadow .15s ease;
}
.btn:hover { background: var(--green-bright); border-color: var(--green-bright); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-sm { padding: .5rem .95rem; font-size: .88rem; }
.btn-block { width: 100%; }
.btn-amber { background: var(--amber); border-color: var(--amber); color: #3a2a06; }
.btn-amber:hover { filter: brightness(1.04); background: var(--amber); border-color: var(--amber); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: #f3efe6; }
.btn-danger { background: var(--tomato); border-color: var(--tomato); }
.btn-danger:hover { filter: brightness(1.05); background: var(--tomato); border-color: var(--tomato); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---- Cards ---------------------------------------------------------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.4rem; box-shadow: var(--shadow);
}
.card + .card { margin-top: 1rem; }
.card-flush { padding: 0; overflow: hidden; }

/* ---- Badges --------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .2rem .6rem; border-radius: 999px; font-size: .76rem; font-weight: 600;
  background: #f2eee5; color: var(--ink-soft); white-space: nowrap;
}
.badge-today { background: var(--amber); color: #3a2a06; }
.badge-green { background: var(--green-wash); color: var(--green); }
.badge-amber { background: var(--amber-wash); color: #8a5a00; }
.badge-tomato{ background: var(--tomato-wash); color: var(--tomato); }
.badge-service { background: var(--green-wash); color: var(--green); }

/* status chips (orders) */
.st { font-weight: 600; padding: .22rem .65rem; border-radius: 999px; font-size: .78rem; display: inline-block; }
.st-received  { background: #eee9df; color: #6b6559; }
.st-confirmed { background: var(--green-wash); color: var(--green); }
.st-preparing { background: var(--amber-wash); color: #8a5a00; }
.st-ready     { background: #dff5e8; color: #12734a; }
.st-completed { background: #e7e2f5; color: #4a3f8a; }
.st-cancelled { background: var(--tomato-wash); color: var(--tomato); }

/* ---- Forms ---------------------------------------------------------- */
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .3rem; }
.field { margin-bottom: 1rem; }
input[type=text], input[type=email], input[type=password], input[type=tel],
input[type=number], input[type=date], input[type=time], input[type=file],
select, textarea {
  width: 100%; padding: .68rem .8rem; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: #fff; color: var(--ink);
  font: inherit; font-size: .95rem;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-wash);
}
textarea { min-height: 90px; resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.hint { font-size: .82rem; color: var(--ink-soft); margin-top: .25rem; }

/* ---- Flash ---------------------------------------------------------- */
.flash-stack { max-width: var(--maxw); margin: 1rem auto 0; padding: 0 1.4rem; }
.flash {
  border-radius: var(--radius-sm); padding: .8rem 1rem; margin-bottom: .6rem;
  font-weight: 500; font-size: .92rem; border: 1px solid transparent;
}
.flash-ok   { background: var(--green-wash); color: var(--green); border-color: #cfe6da; }
.flash-warn { background: var(--amber-wash); color: #8a5a00; border-color: #f2e0b8; }
.flash-error{ background: var(--tomato-wash); color: var(--tomato); border-color: #f2cec5; }

/* ---- Hero (accueil) ------------------------------------------------- */
.hero {
  background:
    radial-gradient(120% 140% at 100% 0%, var(--green-wash) 0%, transparent 55%),
    var(--card);
  border: 1px solid var(--line); border-radius: 22px;
  padding: 2.6rem 2rem; margin-bottom: 2rem; position: relative; overflow: hidden;
}
.hero h1 { max-width: 14ch; }
.hero p { max-width: 46ch; color: var(--ink-soft); font-size: 1.05rem; }
.hero-emoji { position: absolute; right: -10px; bottom: -20px; font-size: 8rem; opacity: .12; }

/* ---- Restaurant grid ------------------------------------------------ */
.resto-grid {
  display: grid; gap: 1.2rem;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.resto-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
  transition: transform .12s ease, box-shadow .12s ease; display: flex; flex-direction: column;
}
.resto-card:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(27,25,23,.1); }
.resto-cover {
  height: 120px; background: linear-gradient(135deg, var(--green) 0%, var(--green-bright) 100%);
  display: flex; align-items: center; justify-content: center; color: #fff;
  font-family: 'Bricolage Grotesque'; font-size: 2.4rem; font-weight: 800;
}
.resto-body { padding: 1.1rem 1.2rem 1.3rem; flex: 1; display: flex; flex-direction: column; gap: .5rem; }
.resto-name { font-size: 1.15rem; font-weight: 800; font-family: 'Bricolage Grotesque'; letter-spacing: -.02em; }
.resto-loc { display: flex; align-items: center; gap: .4rem; color: var(--ink-soft); font-size: .9rem; }
.resto-meta { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: auto; }

/* ---- Today strip (signature) --------------------------------------- */
.today-strip {
  display: flex; align-items: center; gap: .8rem; flex-wrap: wrap;
  background: var(--ink); color: #fff; border-radius: var(--radius);
  padding: 1rem 1.3rem; margin-bottom: 1.6rem;
}
.today-strip .pin { font-size: 1.4rem; }
.today-strip .today-loc { font-family: 'Bricolage Grotesque'; font-weight: 800; font-size: 1.2rem; }
.today-strip .today-day { color: var(--amber); font-weight: 600; text-transform: uppercase; letter-spacing: .1em; font-size: .72rem; }

/* ---- Menu ----------------------------------------------------------- */
.menu-cat { margin-top: 2rem; }
.menu-cat h2 { border-bottom: 2px solid var(--line); padding-bottom: .4rem; }
.menu-item {
  display: flex; gap: 1rem; align-items: flex-start; justify-content: space-between;
  padding: 1rem 0; border-bottom: 1px solid var(--line);
}
.menu-item-info { flex: 1; }
.menu-item-name { font-weight: 600; }
.menu-item-desc { color: var(--ink-soft); font-size: .9rem; margin-top: .15rem; }
.menu-item-right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: .4rem; min-width: 92px; }
.price { font-family: 'JetBrains Mono'; font-weight: 700; }
.opt-list { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }
.opt-chip {
  border: 1px solid var(--line); border-radius: 999px; padding: .3rem .7rem;
  font-size: .82rem; cursor: pointer; background: #fff; user-select: none;
}
.opt-chip.on { border-color: var(--green); background: var(--green-wash); color: var(--green); }

/* ---- Cart (sticky) -------------------------------------------------- */
.layout-order { display: grid; grid-template-columns: 1fr 340px; gap: 2rem; align-items: start; }
.cart {
  position: sticky; top: 84px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.cart-head { padding: 1rem 1.2rem; border-bottom: 1px solid var(--line); font-weight: 800; font-family: 'Bricolage Grotesque'; }
.cart-body { padding: 1rem 1.2rem; max-height: 40vh; overflow: auto; }
.cart-line { display: flex; justify-content: space-between; gap: .6rem; font-size: .9rem; padding: .4rem 0; border-bottom: 1px dashed var(--line); }
.cart-line small { color: var(--ink-soft); display: block; }
.cart-empty { color: var(--ink-faint); text-align: center; padding: 1.4rem 0; }
.cart-foot { padding: 1rem 1.2rem; border-top: 1px solid var(--line); }
.cart-total { display: flex; justify-content: space-between; font-weight: 800; font-size: 1.15rem; margin: .4rem 0 .8rem; }
.qty-mini { display: inline-flex; align-items: center; gap: .4rem; }
.qty-mini button { width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--line); background: #fff; cursor: pointer; line-height: 1; }

/* ---- Order timeline ------------------------------------------------- */
.timeline { list-style: none; padding: 0; margin: 1.4rem 0; }
.timeline li { position: relative; padding: 0 0 1.3rem 2rem; }
.timeline li::before {
  content: ''; position: absolute; left: 6px; top: 4px; width: 12px; height: 12px;
  border-radius: 50%; background: #fff; border: 2px solid var(--line);
}
.timeline li::after {
  content: ''; position: absolute; left: 11px; top: 16px; bottom: -4px; width: 2px; background: var(--line);
}
.timeline li:last-child::after { display: none; }
.timeline li.done::before { background: var(--green); border-color: var(--green); }
.timeline li.done::after { background: var(--green); }
.timeline li.current::before { border-color: var(--amber); background: var(--amber); box-shadow: 0 0 0 4px var(--amber-wash); }
.timeline .tl-label { font-weight: 600; }
.timeline .tl-sub { font-size: .82rem; color: var(--ink-soft); }

/* ---- Tables --------------------------------------------------------- */
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { text-align: left; padding: .7rem .8rem; border-bottom: 1px solid var(--line); }
.table th { font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); font-weight: 600; }
.table tbody tr:hover { background: #faf7f0; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }

/* ---- Stat cards ----------------------------------------------------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 1rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; }
.stat-num { font-family: 'Bricolage Grotesque'; font-weight: 800; font-size: 2rem; line-height: 1; }
.stat-label { color: var(--ink-soft); font-size: .85rem; margin-top: .3rem; }

/* ---- Order cards (kanban-ish for admin) ----------------------------- */
.order-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); padding: 1.1rem; box-shadow: var(--shadow); }
.order-card .oc-code { font-family: 'JetBrains Mono'; font-weight: 700; font-size: 1.05rem; }
.order-card .oc-items { font-size: .88rem; color: var(--ink-soft); margin: .5rem 0; }

/* ---- Tabs ----------------------------------------------------------- */
.tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--line); margin-bottom: 1.4rem; flex-wrap: wrap; }
.tabs a { padding: .6rem 1rem; color: var(--ink-soft); font-weight: 600; font-size: .9rem; border-bottom: 2px solid transparent; }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.tabs a.active { color: var(--green); border-color: var(--green); }

/* ---- Auth split ----------------------------------------------------- */
.auth-wrap { max-width: 420px; margin: 3rem auto; }
.auth-wrap .card { padding: 2rem; }
.role-pick { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin-bottom: 1rem; }
.role-pick label { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .8rem; text-align: center; cursor: pointer; font-weight: 600; margin: 0; }
.role-pick input { display: none; }
.role-pick input:checked + span { color: var(--green); }
.role-pick label:has(input:checked) { border-color: var(--green); background: var(--green-wash); }

/* ---- Footer --------------------------------------------------------- */
.sitefoot { border-top: 1px solid var(--line); background: var(--card); margin-top: 3rem; }
.foot-inner { max-width: var(--maxw); margin: 0 auto; padding: 1.4rem; display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; color: var(--ink-soft); font-size: .88rem; }
.foot-brand { font-family: 'Bricolage Grotesque'; font-weight: 800; color: var(--ink); }
.foot-tag { flex: 1; }

/* ---- Toast ---------------------------------------------------------- */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: .8rem 1.2rem; border-radius: 999px; font-weight: 600;
  font-size: .9rem; opacity: 0; pointer-events: none; transition: all .25s ease; z-index: 100; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- Responsive ----------------------------------------------------- */
@media (max-width: 820px) {
  .layout-order { grid-template-columns: 1fr; }
  .cart { position: static; }
  .field-row { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: stretch; gap: .6rem; }
  .topnav { justify-content: center; }
}

/* ---- A11y ----------------------------------------------------------- */
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
