/* ============================================================
   Via Vai — menu.css
   App menu mobile — design system
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overscroll-behavior: none; }

:root {
  --terra:    #C4622D;
  --terra-d:  #8B3A1A;
  --terra-l:  #E8956B;
  --terra-xl: rgba(196,98,45,.1);
  --sand:     #F2EAD8;
  --ink:      #1C1309;
  --ink-m:    #3D2B1A;
  --ink-s:    #6B4E35;
  --gold-l:   #D4AF5A;
  --white:    #FFFFFF;
  --bg:       oklch(0.97 0.008 55);

  --tab-h:    72px;
  --header-h: 62px;

  --fd: 'Playfair Display', Georgia, serif;
  --fs: 'DM Sans', system-ui, sans-serif;

  --ease:        cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

body {
  background: var(--bg); color: var(--ink);
  font-family: var(--fs); overflow: hidden;
  -webkit-font-smoothing: antialiased;
  position: fixed; inset: 0;
}

/* ── HEADER ── */
.app-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--header-h);
  background: oklch(0.97 0.008 55 / 0.97);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(196,98,45,.12);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.1rem 0 1rem;
}
.header-back {
  display: flex; align-items: center; gap: .45rem;
  font-size: .78rem; font-weight: 400; letter-spacing: .04em;
  color: var(--terra); padding: .4rem .2rem;
  background: none; border: none; cursor: pointer; transition: opacity .2s;
}
.header-back:active { opacity: .6; }
.header-back svg { width: 18px; height: 18px; stroke: var(--terra); fill: none; stroke-width: 2; }

.header-logo-wrap { display: flex; align-items: center; gap: .5rem; }
.header-logo-img  { height: 28px; width: auto; display: block; }
.header-title {
  font-family: var(--fd); font-size: 1.35rem; font-weight: 700;
  color: var(--ink); letter-spacing: -.01em;
}

.header-phone {
  display: flex; align-items: center; gap: .4rem;
  font-size: .76rem; font-weight: 500; color: var(--terra);
  padding: .45rem .8rem; border: 1px solid rgba(196,98,45,.25);
  border-radius: 20px; transition: all .2s; text-decoration: none;
}
.header-phone:active { background: rgba(196,98,45,.1); }
.header-phone svg { width: 14px; height: 14px; stroke: var(--terra); fill: none; stroke-width: 2; }

/* ── CORPS APP ── */
.app-body {
  position: fixed;
  top: var(--header-h); left: 0; right: 0;
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px));
  overflow: hidden;
}

/* ── SWIPE ── */
.swipe-wrap {
  display: flex; height: 100%;
  will-change: transform;
  transition: transform .38s var(--ease);
  -webkit-overflow-scrolling: touch;
}
.swipe-wrap.no-transition { transition: none !important; }
.swipe-panel {
  min-width: 100%; height: 100%;
  overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding: 1rem 1rem 1.5rem 1rem;
  scroll-behavior: smooth;
}

/* ── PANEL HERO ── */
.panel-hero {
  position: relative; height: 160px;
  border-radius: 10px; overflow: hidden;
  margin-bottom: 1.25rem; flex-shrink: 0;
  background: var(--ink-m);
}
.panel-hero img {
  width: 100%; height: 100%; object-fit: cover;
  display: block;
}
.panel-hero-ov {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(28,19,9,.82), rgba(28,19,9,.15));
  display: flex; align-items: flex-end; padding: 1rem 1.1rem;
}
.panel-hero-title {
  font-family: var(--fd); font-size: 1.7rem; font-style: italic;
  font-weight: 500; color: var(--white); letter-spacing: .02em; line-height: 1.1;
}
.panel-hero-sub {
  font-family: var(--fs); font-size: .7rem; letter-spacing: .14em;
  text-transform: uppercase; color: rgba(255,255,255,.65); margin-bottom: .25rem;
}
.panel-hero-badge {
  position: absolute; top: .9rem; right: .9rem;
  background: var(--terra); color: var(--white);
  font-family: var(--fs); font-size: .68rem; font-weight: 500;
  letter-spacing: .08em; text-transform: uppercase;
  padding: .35rem .75rem; border-radius: 20px;
}

/* ── TIME STRIP ── */
.time-strip {
  display: flex; align-items: center; gap: .5rem;
  background: var(--terra-xl); border: 1px solid rgba(196,98,45,.2);
  border-radius: 8px; padding: .7rem 1rem; margin-bottom: 1.1rem;
  font-size: .8rem; color: var(--terra-d); font-weight: 500;
}
.time-strip svg { width: 16px; height: 16px; stroke: var(--terra); fill: none; stroke-width: 1.8; flex-shrink: 0; }

/* ── TITRE DE SECTION (legacy fallback) ── */
.cat-title {
  font-family: var(--fd); font-size: 1.05rem; font-style: italic;
  color: var(--terra-d); margin: 1.4rem 0 .75rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid rgba(196,98,45,.15);
  font-weight: 500; letter-spacing: .01em;
}

/* ── ACCORDION SECTIONS ── */
.acc-block {
  margin-bottom: .65rem;
  border: 1px solid rgba(196,98,45,.13);
  border-radius: 10px; overflow: hidden;
  background: var(--white);
  box-shadow: 0 1px 6px rgba(28,19,9,.05);
}
.acc-hd {
  display: flex; align-items: center; gap: .6rem;
  width: 100%; padding: .85rem 1rem;
  background: none; border: none; cursor: pointer;
  text-align: left; -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.acc-hd:active { background: rgba(196,98,45,.04); }
.acc-hd-name {
  flex: 1; font-family: var(--fd); font-size: .98rem; font-style: italic;
  font-weight: 500; color: var(--ink); letter-spacing: .01em;
}
.acc-hd-count {
  font-family: var(--fs); font-size: .72rem; font-weight: 500;
  color: var(--terra-d); background: var(--terra-xl);
  padding: .18rem .55rem; border-radius: 20px;
}
.acc-chev {
  flex-shrink: 0; opacity: .45; stroke: var(--ink);
  transition: transform .22s var(--ease);
}
.acc-block.acc-open .acc-chev { transform: rotate(180deg); }
.acc-body {
  overflow: hidden;
  max-height: 0;
  transition: max-height .3s var(--ease);
}
.acc-inner .items-list {
  border-top: 1px solid rgba(196,98,45,.1);
  padding: .65rem .75rem .75rem;
  opacity: 0;
  transition: opacity .25s var(--ease) .03s;
}
.acc-block.acc-open .acc-inner .items-list { opacity: 1; }

/* ── LISTE ── */
.items-list { display: flex; flex-direction: column; gap: .6rem; }

/* ── CARD (article compact) ── */
.menu-card {
  background: var(--white); border-radius: 10px; overflow: hidden;
  display: flex; align-items: stretch;
  box-shadow: 0 1px 8px rgba(28,19,9,.07);
  transition: transform .18s var(--ease-spring), box-shadow .18s;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer; border: 1px solid rgba(196,98,45,.07);
  position: relative;
}
.menu-card:active { transform: scale(.975); box-shadow: 0 1px 4px rgba(28,19,9,.05); }

/* Indisponible — badge rouge visible */
.menu-card.unavailable { opacity: .6; pointer-events: none; }
.menu-card.unavailable::after {
  content: 'Indisponible';
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(196,98,45,.88); color: #fff;
  font-family: var(--fs); font-size: .68rem; font-weight: 500;
  letter-spacing: .06em; text-transform: uppercase; text-align: center;
  padding: .22rem 0;
}

.menu-card-img {
  width: 88px; min-height: 88px; flex-shrink: 0;
  overflow: hidden; background: rgba(196,98,45,.07);
  display: flex; align-items: center; justify-content: center;
}
.menu-card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.menu-card-img .img-placeholder {
  width: 32px; height: 32px; opacity: .2;
  stroke: var(--terra); fill: none; stroke-width: 1.5;
}

.menu-card-body {
  flex: 1; padding: .85rem .9rem .85rem .85rem;
  display: flex; flex-direction: column; justify-content: center;
  gap: .12rem; min-width: 0;
}
.mc-name {
  font-family: var(--fd); font-size: .95rem; font-style: italic; font-weight: 500;
  color: var(--ink); line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mc-desc {
  font-family: var(--fs); font-size: .75rem; color: var(--ink-s); line-height: 1.45;
  margin-top: .1rem;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.mc-tag {
  margin-top: .35rem; display: inline-block;
  font-family: var(--fs); font-size: .65rem; font-weight: 500;
  letter-spacing: .05em; text-transform: uppercase;
  padding: .18rem .55rem; background: var(--terra-xl);
  color: var(--terra-d); border-radius: 20px; width: fit-content;
}

.menu-card-price {
  padding: .85rem .9rem .85rem .4rem;
  display: flex; align-items: center; flex-shrink: 0;
}
.mc-price {
  font-family: var(--fd); font-size: 1.1rem; font-weight: 700;
  color: var(--terra); white-space: nowrap;
}
.mc-price .dt { font-size: .72rem; font-style: normal; font-weight: 400; opacity: .65; }

/* ── WIDE CARD (formule brunch) ── */
.menu-card-wide {
  background: var(--white); border-radius: 10px; overflow: hidden;
  box-shadow: 0 1px 10px rgba(28,19,9,.08);
  border: 1px solid rgba(196,98,45,.08);
  transition: transform .18s var(--ease-spring);
  -webkit-tap-highlight-color: transparent; cursor: pointer;
  position: relative;
}
.menu-card-wide:active { transform: scale(.975); }
.menu-card-wide.unavailable { opacity: .6; pointer-events: none; }
.menu-card-wide.unavailable::after {
  content: 'Indisponible';
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(196,98,45,.88); color: #fff;
  font-family: var(--fs); font-size: .68rem; font-weight: 500;
  letter-spacing: .06em; text-transform: uppercase; text-align: center;
  padding: .22rem 0;
}
.menu-card-wide-img {
  height: 130px; overflow: hidden;
  background: rgba(196,98,45,.07);
  display: flex; align-items: center; justify-content: center;
}
.menu-card-wide-img img { width: 100%; height: 100%; object-fit: cover; }
.menu-card-wide-img .img-placeholder {
  width: 40px; height: 40px; opacity: .15;
  stroke: var(--terra); fill: none; stroke-width: 1.5;
}
.menu-card-wide-body { padding: .9rem 1rem 1rem; }
.mcw-name   { font-family: var(--fd); font-size: 1.15rem; font-style: italic; font-weight: 600; color: var(--ink); }
.mcw-desc   { font-family: var(--fs); font-size: .79rem; color: var(--ink-s); margin-top: .3rem; line-height: 1.5; }
.mcw-footer { display: flex; align-items: center; justify-content: space-between; margin-top: .75rem; }
.mcw-price  { font-family: var(--fd); font-size: 1.3rem; font-weight: 700; color: var(--terra); }
.mcw-price .dt { font-size: .8rem; font-style: normal; font-weight: 400; opacity: .65; }
.mcw-tag {
  font-family: var(--fs); font-size: .68rem; font-weight: 500;
  letter-spacing: .06em; text-transform: uppercase;
  padding: .28rem .7rem; background: var(--terra-xl);
  color: var(--terra-d); border-radius: 20px;
}

/* ── TAB BAR ── */
.tab-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px));
  background: oklch(0.97 0.008 55 / 0.97);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(196,98,45,.12);
  display: flex; align-items: flex-start;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  /* mobile : scroll horizontal si trop de catégories */
  overflow-x: auto; overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab {
  /* mobile : taille fixe, barre défile */
  flex: none; min-width: 72px; width: 72px;
  height: var(--tab-h);
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 4px; cursor: pointer;
  padding: .4rem .3rem; border: none; background: none;
  transition: all .22s var(--ease);
  -webkit-tap-highlight-color: transparent; position: relative;
}
.tab-icon { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; transition: transform .25s var(--ease-spring); }
.tab-icon svg { width: 22px; height: 22px; stroke: var(--ink-s); fill: none; stroke-width: 1.7; transition: stroke .22s; }
.tab-label { font-size: .6rem; font-weight: 400; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-s); transition: color .22s, font-weight .22s; line-height: 1; }
.tab.active .tab-icon svg { stroke: var(--terra); }
.tab.active .tab-label  { color: var(--terra); font-weight: 600; }
.tab.active .tab-icon   { transform: translateY(-2px) scale(1.12); }
.tab::after {
  content: ''; position: absolute; top: 0; left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 28px; height: 3px;
  background: var(--terra); border-radius: 0 0 3px 3px;
  transition: transform .3s var(--ease-spring);
}
.tab.active::after { transform: translateX(-50%) scaleX(1); }
.tab:active { opacity: .7; }

/* ── ÉTAT CHARGEMENT / ERREUR ── */
#menu-loading {
  display: flex; align-items: center; justify-content: center;
  height: 100%; font-family: var(--fs);
  font-size: .88rem; color: var(--ink-s);
}

/* ── DESKTOP ── */
@media (min-width: 600px) {
  body { overflow: auto; position: static; }
  .app-body { position: static; overflow: auto; height: auto; padding-bottom: 90px; }
  .swipe-wrap { flex-direction: column; transition: none; }
  .swipe-panel { min-width: 100%; height: auto; overflow: visible; padding: 1.5rem; display: none; }
  .swipe-panel.active { display: block; }
  .tab-bar {
    position: fixed;
    /* desktop : onglets distribués uniformément, pas de scroll */
    overflow-x: visible; overflow-y: visible;
  }
  .tab {
    flex: 1; min-width: 0; width: auto;
  }
  .items-list { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
  .menu-card-wide { margin-bottom: 0; }
  .panel-hero { height: 210px; }
}

@media (prefers-reduced-motion: reduce) {
  .swipe-wrap { transition: none; }
  .tab-icon   { transition: none; }
  .tab::after { transition: none; }
}
