/* style.css - Phase 1 */
:root {
  --brand: #e8590c;
  --brand-dark: #c74a08;
  --brand-soft: #fff1e8;
  --ink: #1b1f2a;
  --ink-2: #2a3040;
  --text: #20242f;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f4f5f7;
  --card: #ffffff;
  --green: #12a150;
  --red: #d92d20;
  --amber: #b54708;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Bengali", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
}
h1 { font-size: 24px; margin: 0; }
h2 { font-size: 17px; margin: 0 0 12px; }
button, input, select { font: inherit; }
.muted { color: var(--muted); }
.small { font-size: 12px; margin: 6px 0 0; }
.num { text-align: right; }

/* layout */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; background: var(--ink); color: #fff;
  display: flex; flex-direction: column; padding: 18px 14px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 18px; }
.brand-logo {
  width: 42px; height: 42px; border-radius: 12px; background: var(--brand);
  display: grid; place-items: center; font-size: 22px; overflow: hidden; flex: none;
}
.brand-logo img { width: 100%; height: 100%; object-fit: cover; }
.brand-name { font-weight: 700; line-height: 1.2; word-break: break-word; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-btn {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px;
  background: transparent; border: 0; color: #c9ced9; border-radius: 10px;
  cursor: pointer; text-align: left;
}
.nav-btn:hover { background: var(--ink-2); color: #fff; }
.nav-btn.active { background: var(--brand); color: #fff; font-weight: 600; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.main { flex: 1; padding: 22px; min-width: 0; }
.view { display: none; }
.view.active { display: block; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }

/* badges */
.badge { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; }
.badge-online { background: #dcfce7; color: #166534; }
.badge-offline { background: #fee2e2; color: #991b1b; }
.badge-muted { background: #374151; color: #e5e7eb; }
.badge-warn { background: #fef3c7; color: #92400e; }
.badge-ok { background: #dcfce7; color: #166534; }

/* cards */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.stat { margin: 0; border-left: 5px solid var(--brand); }
.stat-label { color: var(--muted); font-size: 13px; }
.stat-value { font-size: 26px; font-weight: 800; margin-top: 4px; }

/* buttons & inputs */
.btn {
  display: inline-block; border: 0; border-radius: 10px; padding: 10px 16px;
  font-weight: 600; cursor: pointer; text-align: center;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-primary:disabled { opacity: .6; cursor: wait; }
.btn-ghost { background: #fff; color: var(--text); border: 1px solid var(--line); }
.btn-block { width: 100%; }
.btn-lg { padding: 14px 16px; font-size: 17px; }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn-danger { background: #fff; color: var(--red); border: 1px solid #fecdca; }
.link-btn { background: none; border: 0; color: var(--brand-dark); cursor: pointer; font-weight: 600; padding: 4px; }
.input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--text);
}
.input:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
label { display: block; font-size: 13px; color: var(--muted); font-weight: 600; }
label .input { margin-top: 4px; font-weight: 400; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0; }
.span2 { grid-column: span 2; }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; margin: 10px 0; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.field-label { font-size: 13px; color: var(--muted); font-weight: 600; margin-top: 12px; }

/* tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th.num, .table td.num { text-align: right; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover { background: var(--brand-soft); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.empty { text-align: center; padding: 16px 0 4px; }

/* order screen */
.order-layout { display: grid; grid-template-columns: 1fr 400px; gap: 16px; align-items: start; }
.cart-pane { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 12px 0; }
.chip {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 7px 14px; cursor: pointer; white-space: nowrap; font-weight: 600; color: var(--text);
}
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.menu-card {
  background: #fff; border: 2px solid transparent; border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px 12px; text-align: left; cursor: pointer; min-height: 96px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 8px;
}
.menu-card:hover { border-color: var(--brand); }
.menu-card:active { transform: scale(.98); }
.menu-card:disabled { opacity: .5; cursor: not-allowed; border-color: transparent; }
.mc-name { font-weight: 700; }
.mc-foot { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.mc-price { color: var(--brand-dark); font-weight: 800; }
.mc-cat { font-size: 11px; color: var(--muted); }
.mc-off { font-size: 11px; color: var(--red); font-weight: 700; }

.cart-head { display: flex; justify-content: space-between; align-items: center; }
.cart-list { display: flex; flex-direction: column; gap: 8px; }
.cart-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
.cr-name { font-weight: 600; }
.cr-unit { color: var(--muted); font-size: 12px; }
.cr-total { font-weight: 800; text-align: right; }
.cr-controls { display: flex; align-items: center; gap: 6px; }
.qty-btn { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: #fff; font-size: 18px; cursor: pointer; }
.qty-btn:hover { background: var(--brand-soft); }
.qty-input { width: 52px; text-align: center; padding: 6px; border: 1px solid var(--line); border-radius: 8px; }
.cr-remove { background: none; border: 0; color: var(--red); cursor: pointer; font-size: 18px; }

.pills { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.pill input { position: absolute; opacity: 0; pointer-events: none; }
.pill span {
  display: inline-block; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px;
  cursor: pointer; font-weight: 600; color: var(--text); background: #fff;
}
.pill input:checked + span { background: var(--brand); color: #fff; border-color: var(--brand); }
.pill input:focus-visible + span { outline: 2px solid var(--ink); }

.totals { background: #fafafa; border-radius: 10px; padding: 12px; margin: 12px 0; }
.totals > div { display: flex; justify-content: space-between; padding: 3px 0; }
.totals .grand { border-top: 1px dashed #c8ccd4; margin-top: 6px; padding-top: 8px; font-size: 20px; font-weight: 800; color: var(--brand-dark); }

/* settings */
.logo-row { display: flex; align-items: center; gap: 14px; }
.logo-preview { width: 64px; height: 64px; border-radius: 14px; background: var(--brand); display: grid; place-items: center; font-size: 30px; overflow: hidden; }
.logo-preview img { width: 100%; height: 100%; object-fit: cover; }

/* dialogs */
.dialog { border: 0; border-radius: 16px; padding: 22px; width: min(440px, 94vw); box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.dialog::backdrop { background: rgba(15, 20, 30, .55); }
.dialog label { margin-top: 12px; }
.dialog-wide { width: min(420px, 96vw); max-height: 92vh; overflow-y: auto; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* receipt preview (final print styles come in Phase 2) */
.receipt { font-family: "Courier New", monospace; font-size: 13px; color: #000; }
.receipt .r-center { text-align: center; }
.receipt .r-logo { width: 54px; height: 54px; object-fit: cover; border-radius: 8px; }
.receipt .r-shop { font-size: 18px; font-weight: 700; }
.receipt hr { border: 0; border-top: 1px dashed #000; margin: 8px 0; }
.receipt table { width: 100%; border-collapse: collapse; }
.receipt th { text-align: left; border-bottom: 1px dashed #000; padding: 3px 0; }
.receipt td { padding: 3px 0; vertical-align: top; }
.receipt .rn { text-align: right; }
.receipt .r-line { display: flex; justify-content: space-between; }
.receipt .r-grand { font-weight: 700; font-size: 16px; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px;
  opacity: 0; pointer-events: none; transition: .25s; z-index: 50; max-width: 92vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.warn { background: var(--red); }
.toast.ok { background: var(--green); }

.cart-jump { display: none; }

/* tablet */
@media (max-width: 1100px) {
  .order-layout { grid-template-columns: 1fr 340px; }
  .cards { grid-template-columns: repeat(2, 1fr); }
}

/* phone / small tablet: bottom navigation, stacked order screen */
@media (max-width: 800px) {
  .app { flex-direction: column; }
  .sidebar {
    position: fixed; bottom: 0; left: 0; right: 0; top: auto; width: 100%; height: auto;
    flex-direction: row; padding: 6px; z-index: 20; align-items: center;
  }
  .brand, .side-foot { display: none; }
  .nav { flex-direction: row; width: 100%; justify-content: space-around; }
  .nav-btn { flex-direction: column; gap: 2px; font-size: 11px; padding: 6px 8px; align-items: center; flex: 1; }
  .main { padding: 14px 12px 90px; }
  .order-layout { grid-template-columns: 1fr; }
  .cart-pane { position: static; max-height: none; }
  .cart-jump { display: inline-block; }
  .form-grid { grid-template-columns: 1fr; }
  .span2 { grid-column: span 1; }
  .menu-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-value { font-size: 21px; }
}
