/* ==== OringOrder styles — responsive, RTL-aware, kiosk-ready ==== */
:root {
  --green: #0f9d6b;
  --green-dark: #0b7a54;
  --ink: #16241f;
  --muted: #6b7b74;
  --line: #e4eae7;
  --bg: #f5f8f6;
  --card: #ffffff;
  --danger: #d64545;
  --amber: #e0a010;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(20,40,30,.06);
  --shadow-lg: 0 8px 30px rgba(20,40,30,.12);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, "Noto Sans Arabic", "Noto Kufi Arabic", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
[dir="rtl"] body { font-family: "Noto Kufi Arabic", "Segoe UI", system-ui, sans-serif; }

a { color: var(--green); text-decoration: none; }
h1 { font-size: 1.7rem; margin: .4em 0; }
h2 { font-size: 1.3rem; }
img { max-width: 100%; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.error { color: var(--danger); }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.loading { text-align: center; padding: 4rem; font-size: 2rem; color: var(--muted); }

.container { max-width: 1100px; margin: 0 auto; padding: 1rem 1.1rem 4rem; }
.container.narrow { max-width: 640px; }

/* ---- Header ---- */
#header { position: sticky; top: 0; z-index: 50; background: #fff; border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; gap: 1rem; padding: .6rem 1.1rem; max-width: 1100px; margin: 0 auto; }
.brand { font-weight: 800; font-size: 1.2rem; color: var(--ink); display: flex; align-items: center; gap: .5rem; }
.brand-logo { width: 30px; height: 30px; border-radius: 8px; display: block; }
.kiosk-logo { width: 36px; height: 36px; border-radius: 9px; vertical-align: middle; }
.brand span { color: var(--green); }
.nav { display: flex; gap: .3rem; margin-inline-start: .5rem; flex: 1; }
.nav-link { padding: .45rem .7rem; border-radius: 10px; color: var(--ink); font-weight: 600; font-size: .95rem; }
.nav-link:hover { background: var(--bg); }
.cart-link { position: relative; }
.badge { background: var(--green); color: #fff; border-radius: 999px; font-size: .72rem; padding: .05rem .4rem; margin-inline-start: .1rem; }
.header-right { display: flex; align-items: center; gap: .5rem; }
.whoami { font-weight: 600; font-size: .9rem; }
.lang-sel { border: 1px solid var(--line); border-radius: 10px; padding: .35rem .5rem; background: #fff; font-size: .9rem; }

/* ---- Buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; border: none; cursor: pointer;
  font-weight: 700; border-radius: 12px; padding: .6rem 1rem; font-size: .95rem; font-family: inherit; transition: .15s; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--bg); }
.btn-light { background: #fff; color: var(--green); }
.btn-sm { padding: .35rem .7rem; font-size: .85rem; border-radius: 10px; }
.btn-lg { padding: .85rem 1.2rem; font-size: 1.05rem; width: 100%; }
.link-danger { background: none; border: none; color: var(--danger); cursor: pointer; font-weight: 600; font-size: .85rem; font-family: inherit; }
.back { display: inline-block; margin: .5rem 0; font-weight: 600; }

/* ---- Inputs ---- */
.input { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: .7rem .8rem; font-size: 1rem; font-family: inherit; background: #fff; }
.input:focus { outline: 2px solid var(--green); border-color: var(--green); }
textarea.input { min-height: 70px; resize: vertical; }
.form { display: flex; flex-direction: column; gap: .7rem; }
.row { display: flex; gap: .6rem; }
.row .btn { flex: 1; }
.check, .switch { display: flex; align-items: center; gap: .5rem; font-weight: 600; cursor: pointer; }

/* ---- Cards & grid ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card.pad { padding: 1.1rem; margin-bottom: 1rem; }
.grid { display: grid; gap: 1rem; }
.store-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.product-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

/* ---- Hero / filters ---- */
.hero { background: linear-gradient(135deg, var(--green), #12b47c); color: #fff; padding: 1.6rem 0 2rem; }
.hero h1 { color: #fff; font-size: 1.6rem; margin: 0 0 1rem; }
.filters { display: grid; grid-template-columns: 1fr 1fr 2fr; gap: .6rem; }
.filters .input { background: #fff; }

/* ---- Store cards ---- */
.store-card { display: flex; gap: .8rem; align-items: stretch; transition: .15s; }
.store-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.store-card.closed { opacity: .62; }
.store-emoji { font-size: 2.4rem; display: flex; align-items: center; justify-content: center; width: 74px; background: var(--bg); }
.store-emoji.lg { font-size: 3.4rem; width: 100px; border-radius: var(--radius); }
.store-body { padding: .8rem .8rem .8rem 0; flex: 1; }
.store-top { display: flex; justify-content: space-between; align-items: start; gap: .5rem; }
.store-top h3 { margin: 0; font-size: 1.05rem; }
.store-header { display: flex; gap: 1rem; align-items: center; margin: .5rem 0 1.2rem; }

/* ---- Pills ---- */
.pill { font-size: .72rem; font-weight: 700; padding: .18rem .55rem; border-radius: 999px; background: var(--bg); color: var(--muted); white-space: nowrap; }
.pill-open { background: #e3f6ee; color: var(--green-dark); }
.pill-closed { background: #fdeaea; color: var(--danger); }
.status-pending { background: #fff3d6; color: #9a6800; }
.status-accepted { background: #e0edff; color: #14509c; }
.status-preparing { background: #e7e0ff; color: #5a2fb0; }
.status-delivering { background: #ffe8d1; color: #b25600; }
.status-completed { background: #e3f6ee; color: var(--green-dark); }
.status-cancelled { background: #fdeaea; color: var(--danger); }

/* ---- Product cards ---- */
.cat-title { margin: 1.4rem 0 .6rem; border-bottom: 2px solid var(--line); padding-bottom: .3rem; }
.product-card { display: flex; flex-direction: column; }
.product-emoji { font-size: 2.6rem; text-align: center; padding: 1rem 0 .3rem; background: var(--bg); }
.product-body { padding: .7rem .8rem; display: flex; flex-direction: column; flex: 1; }
.product-body h4 { margin: 0 0 .2rem; font-size: 1rem; }
.product-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; padding-top: .6rem; }
.price { font-weight: 800; color: var(--green-dark); }
.banner { background: #fdeaea; color: var(--danger); padding: .7rem 1rem; border-radius: 12px; font-weight: 600; text-align: center; }

/* ---- Cart ---- */
.cart-row { display: flex; align-items: center; gap: .6rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.ci-emoji { font-size: 1.4rem; }
.ci-name { flex: 1; font-weight: 600; }
.ci-price { font-weight: 700; min-width: 64px; text-align: end; }
.qty { display: flex; align-items: center; gap: .5rem; }
.qbtn { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: #fff; font-size: 1.1rem; cursor: pointer; }
.cart-totals { margin-top: .8rem; }
.cart-totals > div, .grand { display: flex; justify-content: space-between; padding: .3rem 0; }
.grand { font-weight: 800; font-size: 1.15rem; border-top: 2px solid var(--line); margin-top: .4rem; padding-top: .6rem; }
.cart-bar { position: fixed; inset-inline: 1rem; bottom: 1rem; max-width: 1060px; margin: 0 auto; background: var(--ink); color: #fff;
  display: none; justify-content: space-between; align-items: center; padding: .7rem 1rem; border-radius: 14px; box-shadow: var(--shadow-lg); z-index: 40; }
.cart-bar.show { display: flex; }
.cart-bar span { font-weight: 700; }

/* ---- Orders / tracking ---- */
.order-card { display: block; }
.order-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .3rem; }
.order-foot { display: flex; justify-content: space-between; align-items: center; margin-top: .6rem; gap: .5rem; flex-wrap: wrap; }
.order-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.track { display: flex; justify-content: space-between; margin: 1.2rem 0; position: relative; }
.track-step { flex: 1; text-align: center; font-size: .8rem; color: var(--muted); position: relative; }
.track-step .dot { display: block; width: 18px; height: 18px; border-radius: 50%; background: var(--line); margin: 0 auto .4rem; }
.track-step.done { color: var(--green-dark); font-weight: 700; }
.track-step.done .dot { background: var(--green); }
.order-items { margin-top: 1rem; }

/* ---- Tabs / tables / dashboard ---- */
.dash-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .6rem; }
.tabs { display: flex; gap: .3rem; border-bottom: 2px solid var(--line); margin: 1rem 0; overflow-x: auto; }
.tab { background: none; border: none; padding: .6rem .9rem; font-weight: 700; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; font-family: inherit; white-space: nowrap; }
.tab.active { color: var(--green-dark); border-bottom-color: var(--green); }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.table th, .table td { padding: .7rem .8rem; text-align: start; border-bottom: 1px solid var(--line); font-size: .92rem; }
.table th { background: var(--bg); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1rem; margin: 1rem 0; }
.stat { padding: 1.1rem; text-align: center; }
.stat-icon { font-size: 1.8rem; }
.stat-val { font-size: 1.8rem; font-weight: 800; color: var(--green-dark); }
.stat-label { color: var(--muted); font-size: .85rem; }
.switch input, .check input { width: 20px; height: 20px; accent-color: var(--green); }
hr { border: none; border-top: 1px solid var(--line); margin: .3rem 0; }

/* ---- Toasts ---- */
#toasts { position: fixed; bottom: 1rem; inset-inline-start: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: .5rem; align-items: center; }
[dir="rtl"] #toasts { transform: translateX(50%); }
.toast { background: var(--ink); color: #fff; padding: .7rem 1.2rem; border-radius: 12px; box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(20px); transition: .3s; font-weight: 600; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { background: var(--green); }
.toast-error { background: var(--danger); }

/* ---- Kiosk mode ---- */
.kiosk { min-height: 100vh; background: linear-gradient(160deg, #0f9d6b, #0b7a54); color: #fff; padding: 1.5rem; }
.kiosk-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.kiosk-brand { font-size: 1.6rem; font-weight: 800; }
.kiosk-h { color: #fff; text-align: center; font-size: 2rem; margin: 1rem 0 2rem; }
.kiosk-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1.4rem; }
.kiosk-store, .kiosk-prod { background: #fff; border: none; border-radius: 20px; padding: 1.6rem 1rem; display: flex; flex-direction: column; align-items: center; gap: .6rem; cursor: pointer; box-shadow: var(--shadow-lg); font-family: inherit; color: var(--ink); transition: .12s; }
.kiosk-store:active, .kiosk-prod:active { transform: scale(.97); }
.kiosk-store.closed { opacity: .55; }
.kiosk-emoji { font-size: 3.2rem; }
.kiosk-name { font-weight: 800; font-size: 1.15rem; text-align: center; }
.kiosk-prod-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1.2rem; }
.kiosk-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 1rem; }
.kiosk-cart { background: #fff; color: var(--ink); border-radius: 20px; padding: 1.6rem; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; display: flex; flex-direction: column; gap: .6rem; }
.big-check { font-size: 4rem; }

/* ---- Mobile bottom navigation (customers/guests) ---- */
#bottomNav { display: none; }
@media (max-width: 720px) {
  #bottomNav {
    position: fixed; inset-inline: 0; bottom: 0; z-index: 45;
    display: flex; justify-content: space-around; align-items: stretch;
    background: #fff; border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom, 0);
    box-shadow: 0 -2px 12px rgba(20,40,30,.06);
  }
  .bn-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; padding: .5rem 0 .55rem; font-size: 1.35rem; color: var(--muted); position: relative;
  }
  .bn-item span:not(.badge) { font-size: .68rem; font-weight: 700; max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bn-item.active { color: var(--green-dark); }
  .bn-badge { position: absolute; top: .3rem; inset-inline-end: 50%; transform: translateX(140%); }
  [dir="rtl"] .bn-badge { transform: translateX(-140%); }
  /* When the bottom nav is present, hide the header's inline nav and give the page room. */
  body.has-bottom-nav .nav { display: none; }
  body.has-bottom-nav #app { padding-bottom: 4.5rem; }
  body.has-bottom-nav .cart-bar { bottom: 4.6rem; }
}

/* ---- Responsive ---- */
@media (max-width: 720px) {
  .filters { grid-template-columns: 1fr; }
  .nav { order: 3; width: 100%; margin: 0; justify-content: space-around; border-top: 1px solid var(--line); padding-top: .4rem; }
  .header-inner { flex-wrap: wrap; row-gap: .4rem; }
  .header-right { margin-inline-start: auto; }
  h1 { font-size: 1.4rem; }
  .hero { padding: 1.2rem 0 1.6rem; }
  .hero h1 { font-size: 1.35rem; }
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: .7rem; }
  .product-emoji { font-size: 2.1rem; }
  .store-emoji.lg { width: 76px; font-size: 2.6rem; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .container { padding: .8rem .9rem 3rem; }
}

/* ---- Tablet (10-inch kiosk / iPad) ---- */
@media (min-width: 721px) and (max-width: 1200px) {
  .store-grid { grid-template-columns: repeat(2, 1fr); }
  .product-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Kiosk / tablet 10-inch: bump up touch targets */
@media (min-width: 768px) and (max-width: 1280px) and (pointer: coarse) {
  .btn { padding: .8rem 1.3rem; }
  .input { padding: .9rem 1rem; }
}
