/* ==========================================================================
   Ezapps tablette — visual identity layer.
   Same token vocabulary as ezapps-admin (static/css/ezapps-theme.css) for
   brand consistency, tuned for a tablet used on the restaurant floor: bigger
   touch targets, higher-contrast state colors (free/occupied), primarily
   light (this device lives in a lit dining room, not a back office).
   ========================================================================== */

@import url("https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700;800&display=swap");

:root {
  --ez-page:        #f7f5f0;
  --ez-surface:     #ffffff;
  --ez-surface-2:   #fbf9f5;
  --ez-ink:         #211b15;
  --ez-ink-dim:     #6b6156;
  --ez-ink-mute:    #9a9082;
  --ez-line:        rgba(33,27,21,0.10);
  --ez-accent:      #c2621a;
  --ez-accent-ink:  #ffffff;
  --ez-accent-soft: #f7e6d5;
  --ez-good:        #0ca30c; --ez-good-bg: #e5f6e1;
  --ez-warning:     #b3790a; --ez-warning-bg: #fbf0d8;
  --ez-serious:     #c85a30; --ez-serious-bg: #fbe6dc;
  --ez-critical:    #d03b3b; --ez-critical-bg: #fbe2e2;
  --ez-grey:        #6b6156; --ez-grey-bg: #ece7de;
  --ez-radius: 14px;
  --ez-radius-lg: 20px;
  --ez-nav-w: 92px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ez-page:        #100e0b;
    --ez-surface:     #1b1712;
    --ez-surface-2:   #221d17;
    --ez-ink:         #f4efe6;
    --ez-ink-dim:     #b3a99b;
    --ez-ink-mute:    #837a6d;
    --ez-line:        rgba(244,239,230,0.10);
    --ez-accent:      #e08a3c;
    --ez-accent-ink:  #1b1712;
    --ez-accent-soft: #3a2a1a;
    --ez-good-bg: #16260f; --ez-warning-bg: #2e2410; --ez-serious-bg: #2f1c11; --ez-critical-bg: #301414;
    --ez-grey-bg: #262119;
  }
}

* { box-sizing: border-box; }
html, body, #__nuxt, #__layout { height: 100%; }
body {
  margin: 0;
  background: var(--ez-page);
  color: var(--ez-ink);
  font-family: "Sora", -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
input, textarea { user-select: text; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ---------------- app shell ---------------- */
.ez-shell { display: flex; height: 100vh; overflow: hidden; }
.ez-main { flex: 1; display: flex; flex-direction: column; min-width: 0; height: 100vh; }
.ez-view { flex: 1; overflow-y: auto; padding: 1.4rem; }

/* ---------------- side nav (tablet: icon + label, generous targets) ---------------- */
.ez-nav {
  width: var(--ez-nav-w);
  flex-shrink: 0;
  background: var(--ez-surface);
  border-right: 1px solid var(--ez-line);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem 0;
  gap: 0.3rem;
}
.ez-nav-mark {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 1rem; overflow: hidden;
}
.ez-nav-mark img { width: 100%; height: 100%; object-fit: cover; }
.ez-nav-item {
  width: 76px; padding: 0.6rem 0.3rem; border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 0.3rem;
  color: var(--ez-ink-dim); font-size: 0.68rem; font-weight: 600; text-align: center;
}
.ez-nav-item svg { width: 26px; height: 26px; }
.ez-nav-item.active { background: var(--ez-accent-soft); color: var(--ez-accent); }
.ez-nav-item:active { transform: scale(0.96); }
.ez-nav-spacer { flex: 1; }
.ez-nav-item.logout { color: var(--ez-critical); }

/* ---------------- top context bar ---------------- */
.ez-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.9rem 1.4rem; background: var(--ez-surface); border-bottom: 1px solid var(--ez-line);
  gap: 1rem; flex-wrap: wrap;
}
.ez-topbar-title { font-size: 1.05rem; font-weight: 700; }
.ez-topbar-sub { font-size: 0.8rem; color: var(--ez-ink-dim); }
.ez-topbar-right { display: flex; align-items: center; gap: 0.8rem; }

/* connectivity/sync badge */
.ez-sync-badge { display: flex; align-items: center; gap: 0.45rem; font-size: 0.76rem; font-weight: 600; padding: 0.35rem 0.7rem; border-radius: 999px; }
.ez-sync-badge .dot { width: 8px; height: 8px; border-radius: 50%; }
.ez-sync-badge.online { background: var(--ez-good-bg); color: var(--ez-good); }
.ez-sync-badge.online .dot { background: var(--ez-good); }
.ez-sync-badge.offline { background: var(--ez-warning-bg); color: var(--ez-warning); }
.ez-sync-badge.offline .dot { background: var(--ez-warning); animation: ez-pulse 1.4s infinite; }
.ez-sync-badge.syncing .dot { background: var(--ez-accent); animation: ez-pulse 0.8s infinite; }
@keyframes ez-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

.ez-user-chip { display: flex; align-items: center; gap: 0.6rem; }
.ez-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--ez-accent-soft); color: var(--ez-accent); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.85rem; }

/* ---------------- cards / grids ---------------- */
.ez-card { background: var(--ez-surface); border: 1px solid var(--ez-line); border-radius: var(--ez-radius); padding: 1.1rem; }
.ez-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.9rem; margin-bottom: 1.2rem; }
.ez-stat { background: var(--ez-surface); border: 1px solid var(--ez-line); border-radius: var(--ez-radius); padding: 1.1rem; }
.ez-stat .value { font-size: 1.7rem; font-weight: 800; }
.ez-stat .label { font-size: 0.8rem; color: var(--ez-ink-dim); margin-top: 0.2rem; }

.ez-shortcuts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }
.ez-shortcut {
  background: var(--ez-surface); border: 1px solid var(--ez-line); border-radius: var(--ez-radius-lg);
  padding: 1.4rem 1.2rem; display: flex; flex-direction: column; gap: 0.6rem; align-items: flex-start;
  min-height: 120px;
}
.ez-shortcut svg { width: 30px; height: 30px; color: var(--ez-accent); }
.ez-shortcut .title { font-weight: 700; font-size: 1rem; }
.ez-shortcut:active { transform: scale(0.98); }

/* ---------------- tables grid ---------------- */
.ez-hall-tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.ez-hall-tab { padding: 0.55rem 1.1rem; border-radius: 999px; background: var(--ez-surface); border: 1px solid var(--ez-line); font-weight: 600; font-size: 0.85rem; color: var(--ez-ink-dim); }
.ez-hall-tab.active { background: var(--ez-accent); color: var(--ez-accent-ink); border-color: var(--ez-accent); }

.ez-table-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 1rem; }
.ez-table-tile {
  aspect-ratio: 1 / 1; border-radius: var(--ez-radius-lg); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 0.3rem; border: 2px solid transparent;
  font-weight: 700; color: #fff; text-align: center; padding: 0.5rem;
}
.ez-table-tile.free { background: var(--ez-good); }
.ez-table-tile.occupied { background: var(--ez-critical); }
.ez-table-tile.ready { background: var(--ez-warning); }
.ez-table-tile .name { font-size: 1.15rem; }
.ez-table-tile .meta { font-size: 0.72rem; opacity: 0.9; font-weight: 500; }
.ez-table-tile:active { transform: scale(0.97); }

/* ---------------- order-taking (commande) ---------------- */
.ez-order-context {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  background: var(--ez-surface); border: 1px solid var(--ez-line); border-radius: var(--ez-radius);
  padding: 0.9rem 1.2rem; margin-bottom: 1rem; position: sticky; top: 0; z-index: 5;
}
.ez-order-context .field { display: flex; flex-direction: column; }
.ez-order-context .field b { font-size: 0.95rem; }
.ez-order-context .field span { font-size: 0.72rem; color: var(--ez-ink-mute); text-transform: uppercase; letter-spacing: 0.03em; }
.ez-order-context .total { font-size: 1.3rem; font-weight: 800; color: var(--ez-accent); }

/* Only commande.vue uses this class — categories sidebar | menu items | cart.
   Three real breakpoints, not one: wide desktop gets all three side by side;
   tablet-landscape-ish widths keep the sidebar full-height but stack content
   above cart (three columns would leave each one too cramped); tablet
   portrait stacks everything, sidebar becoming a horizontal strip. */
.ez-order-layout {
  display: grid;
  grid-template-columns: 150px 1.4fr 1fr;
  grid-template-areas: "sidebar content cart";
  gap: 1rem;
  align-items: start;
}
.ez-order-content { grid-area: content; }
.ez-order-layout > .ez-cart { grid-area: cart; }
@media (max-width: 1200px) {
  .ez-order-layout {
    grid-template-columns: 130px 1fr;
    grid-template-areas: "sidebar content" "sidebar cart";
  }
}
@media (max-width: 900px) {
  .ez-order-layout {
    grid-template-columns: 1fr;
    grid-template-areas: "sidebar" "content" "cart";
  }
}

.ez-cat-sidebar { grid-area: sidebar; display: flex; flex-direction: column; gap: 0.5rem; }
@media (max-width: 900px) { .ez-cat-sidebar { flex-direction: row; overflow-x: auto; padding-bottom: 0.3rem; } }
.ez-cat-btn {
  position: relative; padding: 0.75rem 1.4rem 0.75rem 0.7rem; border-radius: 10px; border: 1px solid var(--ez-line); background: var(--ez-surface);
  color: var(--ez-ink); font-weight: 700; font-size: 0.85rem; text-align: left; white-space: nowrap; flex-shrink: 0;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
/* The category's own assigned color (if any) always shows via the inline
   style — active state layers on top rather than replacing the background,
   so the currently-viewed category never loses its own color. A double-ring
   (white gap + dark ring) reads clearly against ANY fill color, light or
   dark; the scale-up + shadow + checkmark badge make it unmistakable even
   at a glance, not just "a slightly different border". */
.ez-cat-btn.active {
  transform: scale(1.06);
  box-shadow: 0 0 0 2px var(--ez-surface), 0 0 0 5px var(--ez-ink), 0 6px 16px rgba(0,0,0,0.28);
  z-index: 1;
}
.ez-cat-btn.active::after {
  content: "✓"; position: absolute; top: 3px; right: 6px;
  font-size: 0.72rem; font-weight: 900; line-height: 1;
}
@media (max-width: 900px) { .ez-cat-btn.active { transform: scale(1.08); } }

.ez-submenu-filters { display: flex; gap: 0.5rem; overflow-x: auto; margin-bottom: 0.9rem; padding-bottom: 0.3rem; }
.ez-filter-chip {
  padding: 0.5rem 1rem; border-radius: 999px; border: 1px solid var(--ez-line); background: var(--ez-surface);
  color: var(--ez-ink); font-weight: 600; font-size: 0.82rem; white-space: nowrap; flex-shrink: 0;
}
.ez-filter-chip.active { background: var(--ez-accent); color: var(--ez-accent-ink); border-color: var(--ez-accent); }

.ez-tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.8rem; }
.ez-tile {
  border-radius: var(--ez-radius); padding: 1rem 0.9rem; min-height: 84px;
  display: flex; align-items: center; justify-content: center; text-align: center;
  font-weight: 700; font-size: 0.9rem; border: 1px solid var(--ez-line); background: var(--ez-surface); color: var(--ez-ink);
}
.ez-tile:active { transform: scale(0.97); }
.ez-tile.menu-item { flex-direction: column; gap: 0.3rem; }
.ez-tile.menu-item .price { font-weight: 600; font-size: 0.78rem; color: var(--ez-ink-dim); }
.ez-tile.selected { outline: 3px solid var(--ez-accent); }

.ez-cart { background: var(--ez-surface); border: 1px solid var(--ez-line); border-radius: var(--ez-radius); padding: 1rem; }
.ez-cart-group + .ez-cart-group { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--ez-line); }
.ez-cart-group-title { font-weight: 700; font-size: 0.85rem; margin-bottom: 0.5rem; color: var(--ez-ink-dim); text-transform: uppercase; letter-spacing: 0.03em; }
.ez-cart-item { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; padding: 0.6rem 0; border-bottom: 1px dashed var(--ez-line); }
.ez-cart-item:last-child { border-bottom: none; }
.ez-cart-item-name { font-weight: 600; font-size: 0.88rem; }
.ez-cart-item-detail { font-size: 0.72rem; color: var(--ez-ink-mute); margin-top: 0.15rem; }
.ez-qty { display: flex; align-items: center; gap: 0.5rem; }
.ez-qty button { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--ez-line); background: var(--ez-surface-2); font-size: 1.1rem; line-height: 1; }
.ez-cart-total { display: flex; justify-content: space-between; align-items: center; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--ez-line); font-weight: 800; font-size: 1.1rem; }
.ez-cart-empty { color: var(--ez-ink-mute); font-size: 0.85rem; text-align: center; padding: 2rem 0; }

/* buttons */
.ez-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.85rem 1.3rem; border-radius: 12px; font-weight: 700; font-size: 0.92rem;
  border: none; background: var(--ez-surface-2); color: var(--ez-ink);
}
.ez-btn-primary { background: var(--ez-accent); color: var(--ez-accent-ink); }
.ez-btn-primary:disabled { opacity: 0.5; }
.ez-btn-block { width: 100%; }
.ez-btn:active { transform: scale(0.98); }

/* keypad (couverts) */
.ez-keypad-screen { font-size: 1.4rem; font-weight: 700; text-align: center; margin-bottom: 1rem; }
.ez-keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; }
.ez-keypad button { padding: 1.1rem; border-radius: 12px; border: 1px solid var(--ez-line); background: var(--ez-surface-2); font-size: 1.2rem; font-weight: 700; }

/* modal/popup */
.ez-modal-backdrop { position: fixed; inset: 0; background: rgba(20,16,12,0.45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 1rem; }
.ez-modal { background: var(--ez-surface); border-radius: var(--ez-radius-lg); padding: 1.4rem; width: 100%; max-width: 460px; max-height: 90vh; overflow-y: auto; }
.ez-modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.ez-modal-head h3 { margin: 0; font-size: 1.05rem; }
.ez-modal-close { width: 34px; height: 34px; border-radius: 50%; background: var(--ez-surface-2); display: flex; align-items: center; justify-content: center; }

/* option chips (formule/extras) */
.ez-chip-group { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.ez-chip { padding: 0.5rem 0.9rem; border-radius: 999px; border: 1px solid var(--ez-line); background: var(--ez-surface-2); font-size: 0.82rem; font-weight: 600; }
.ez-chip.selected { background: var(--ez-accent); border-color: var(--ez-accent); color: var(--ez-accent-ink); }
.ez-chip:disabled { opacity: 0.4; }
.ez-section-label { font-size: 0.78rem; font-weight: 700; color: var(--ez-ink-dim); text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 0.5rem; }

/* misc */
.ez-empty { color: var(--ez-ink-mute); font-size: 0.9rem; text-align: center; padding: 2.4rem 1rem; }
.ez-offline-note { font-size: 0.76rem; color: var(--ez-warning); background: var(--ez-warning-bg); padding: 0.5rem 0.8rem; border-radius: 8px; margin-bottom: 0.8rem; }
