/* ToGo storefront — mobile-first, RTL-first. Logical properties throughout so
   the layout mirrors automatically on dir=rtl. No inline styles (CSP
   style-src 'self'). Nothing may cause horizontal scroll. */
:root {
  --bg: #f6f1ea;
  --card: #ffffff;
  --ink: #2b1d12;
  --muted: #8a7866;
  --accent: #6f4e37;
  --accent-ink: #fff;
  --line: #e8ddd0;
  --open: #166534;
  --closed: #9a3412;
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; overflow-x: hidden; }
body {
  background: var(--bg); color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  min-height: 100dvh; display: flex; flex-direction: column;
}
img { max-width: 100%; }
.spacer { flex: 1; }

.topbar {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.7rem 1rem; padding-top: max(0.7rem, env(safe-area-inset-top));
  background: var(--card); border-block-end: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.brand-btn { background: none; border: none; cursor: pointer; padding: 0; }
.brand { font-weight: 800; font-size: 1.4rem; letter-spacing: 0.04em; color: var(--accent); }
.lang-toggle {
  background: none; border: 1px solid var(--line); border-radius: 999px;
  padding: 0.35rem 0.9rem; font-size: 0.85rem; color: var(--accent); cursor: pointer;
}

.app { flex: 1; width: 100%; max-width: 40rem; margin-inline: auto; padding: 1rem; }
.footer {
  text-align: center; color: var(--muted); font-size: 0.8rem;
  padding: 1.2rem 1rem calc(1.2rem + env(safe-area-inset-bottom));
}

.section-title { font-size: 1.15rem; margin: 0.2rem 0 1rem; }

/* ── Café list ── */
.cafe-list { display: flex; flex-direction: column; gap: 0.75rem; }
.cafe-card {
  display: flex; align-items: center; gap: 0.85rem; width: 100%;
  text-align: start; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 0.85rem; cursor: pointer; color: inherit;
}
.cafe-card:active { transform: scale(0.99); }
.cafe-logo {
  width: 3.2rem; height: 3.2rem; border-radius: 12px; flex: none;
  background: linear-gradient(135deg, #e9dccb, #d8c3a5);
  display: flex; align-items: center; justify-content: center;
}
.cafe-logo-letter { font-size: 1.5rem; font-weight: 800; color: var(--accent); }
.cafe-body { flex: 1; min-width: 0; }
.cafe-name { font-weight: 700; font-size: 1.02rem; }
.cafe-branch { font-size: 0.85rem; color: var(--muted); }
.cafe-address { font-size: 0.8rem; color: var(--muted); margin-block-start: 0.15rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cafe-status { display: flex; align-items: center; gap: 0.4rem; margin-block-start: 0.4rem; font-size: 0.8rem; }
.status-dot { width: 0.55rem; height: 0.55rem; border-radius: 999px; flex: none; }
.status-dot.open { background: var(--open); }
.status-dot.closed { background: var(--closed); }
.status-text { font-weight: 600; }
.cafe-hours { color: var(--muted); direction: ltr; }
.cafe-chevron { color: var(--muted); font-size: 1.5rem; flex: none; }

/* ── Café menu ── */
.back-link { background: none; border: none; color: var(--accent); font-size: 0.9rem; cursor: pointer; padding: 0.2rem 0; }
.menu-header { margin: 0.4rem 0 1rem; }
.menu-cafe-name { font-size: 1.35rem; margin: 0.2rem 0 0; }
.menu-branch-name { color: var(--muted); font-size: 0.9rem; }
.menu-category { margin-block-end: 1.4rem; }
.cat-title {
  font-size: 1rem; color: var(--accent); margin: 0 0 0.6rem;
  padding-block-end: 0.3rem; border-block-end: 2px solid var(--line);
}
.item {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 0.8rem; margin-block-end: 0.6rem;
}
.item.sold-out { opacity: 0.55; }
.item-head { display: flex; align-items: flex-start; gap: 0.6rem; }
.item-names { flex: 1; min-width: 0; }
.item-name { font-weight: 700; }
.item-desc { font-size: 0.83rem; color: var(--muted); margin-block-start: 0.2rem; }
.item-right { text-align: end; flex: none; }
.item-price { font-weight: 700; color: var(--accent); white-space: nowrap; }
.sold-tag {
  display: inline-block; margin-block-start: 0.3rem; font-size: 0.72rem; font-weight: 700;
  background: #fde2e2; color: var(--closed); border-radius: 6px; padding: 0.1rem 0.45rem;
}
.item-opts { margin-block-start: 0.6rem; display: flex; flex-direction: column; gap: 0.5rem; }
.opt-group-name { font-size: 0.78rem; color: var(--muted); margin-block-end: 0.3rem; }
.opt-choices { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.opt-chip {
  font-size: 0.78rem; background: #f4ece1; border: 1px solid var(--line);
  border-radius: 999px; padding: 0.2rem 0.6rem;
}

/* ── State blocks (loading / empty / error) ── */
.state-block {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 0.8rem; padding: 3.5rem 1.5rem; color: var(--muted);
}
.state-icon { font-size: 2.6rem; }
.state-text { margin: 0; font-size: 0.95rem; max-width: 20rem; }
.spinner {
  width: 2rem; height: 2rem; border-radius: 999px;
  border: 3px solid var(--line); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn { border: none; border-radius: 10px; padding: 0.6rem 1.2rem; font-size: 0.95rem; cursor: pointer; }
.btn.primary { background: var(--accent); color: var(--accent-ink); font-weight: 700; }

@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
