/* ---------------------------------------------------------------------
   Jasmine POS — shared styles
   Colours sampled from Jasmine's own logo: teal #5D7776, gold #DFA36D.
   Counter screen = light and tappable. Kitchen screen = dark and glanceable.
--------------------------------------------------------------------- */

:root {
  --teal: #5D7776;
  --teal-dark: #3E5352;
  --teal-deep: #2C3E3D;
  --gold: #DFA36D;
  --gold-deep: #B97D46;
  --sage: #7C9070;
  --paper: #F7F3EC;
  --card: #FFFFFF;
  --ink: #2B2420;
  --ink-soft: #6B6259;
  --line: #E4DCCC;
  --danger: #A13327;

  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'Work Sans', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
}

h1, h2, h3 { font-family: var(--font-display); margin: 0; }
button { font-family: var(--font-body); cursor: pointer; border: none; }
input { font-family: var(--font-body); }

button:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 3px solid var(--gold-deep);
  outline-offset: 2px;
}

.hidden { display: none !important; }

/* ---------------- Top bar (order screen) ---------------- */

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  padding: 10px 24px;
  background: var(--teal);
  color: white;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 14px; }
.brand-logo { height: 46px; width: auto; display: block; border-radius: 4px; }
.brand p { margin: 0; font-size: 13px; color: #DCE7E5; }

.order-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.order-type-toggle { display: flex; align-items: center; gap: 8px; }

.type-btn {
  padding: 10px 18px;
  border-radius: 8px;
  background: rgba(255,255,255,0.14);
  color: white;
  font-size: 15px;
  font-weight: 600;
}
.type-btn.active { background: var(--gold); color: var(--teal-deep); }

.dinein-fields { display: flex; gap: 8px; }
.small-input {
  padding: 10px 12px;
  border-radius: 8px;
  border: none;
  font-size: 15px;
  width: 92px;
}

/* ---------------- Order layout ---------------- */

.order-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  height: calc(100vh - 66px);
}

.menu-panel { display: flex; flex-direction: column; overflow: hidden; }

.category-tabs { display: flex; gap: 8px; padding: 14px 20px 0; overflow-x: auto; }
.category-tab {
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.category-tab.active { background: var(--teal); border-color: var(--teal); color: white; }

.menu-grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
  padding: 16px 20px 24px;
  align-content: start;
}

.menu-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  min-height: 84px;
}
.menu-item:active { transform: scale(0.98); }
.menu-item-name { font-weight: 600; font-size: 15px; line-height: 1.3; }
.menu-item-meta { display: flex; align-items: center; justify-content: space-between; font-size: 14px; color: var(--ink-soft); }
.veg-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--sage); display: inline-block; }

/* ---------------- Cart panel ---------------- */

.cart-panel {
  background: var(--card);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 20px;
  overflow-y: auto;
}
.cart-panel h2 { font-size: 22px; margin-bottom: 12px; }

.cart-lines { flex: 1; min-height: 80px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.empty-cart { color: var(--ink-soft); font-size: 14px; margin: 0; }

.cart-line { border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.cart-line-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.cart-line-name { font-weight: 600; font-size: 14px; flex: 1; }
.cart-line-price { font-size: 14px; color: var(--ink-soft); white-space: nowrap; }

.qty-controls { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.qty-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--paper);
  border: 1px solid var(--line);
  font-size: 18px;
  line-height: 1;
}
.qty-value { font-weight: 600; min-width: 20px; text-align: center; }
.remove-line { margin-left: auto; background: none; color: var(--danger); font-size: 13px; text-decoration: underline; }

.note-input {
  width: 100%;
  margin-top: 6px;
  padding: 7px 8px;
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.totals { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 10px; }
.totals-row { display: flex; justify-content: space-between; font-size: 14px; padding: 3px 0; }
.service-row { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 3px 0; cursor: pointer; }
.service-row input { width: 18px; height: 18px; }
.service-row .service-label { flex: 1; }
.totals-row.total { font-family: var(--font-display); font-size: 24px; font-weight: 700; padding-top: 6px; }
.totals-note { font-size: 12px; color: var(--ink-soft); text-align: right; min-height: 16px; padding-bottom: 8px; }

.till-details { font-size: 13px; color: var(--ink-soft); margin-bottom: 10px; }
.till-details summary { cursor: pointer; padding: 4px 0; }
.till-details label { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0; }
.till-details input { width: 160px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; }
.till-details a { color: var(--ink-soft); }

.place-order-btn {
  background: var(--gold);
  color: var(--teal-deep);
  font-size: 16px;
  font-weight: 700;
  padding: 16px;
  border-radius: 10px;
}
.place-order-btn:disabled { background: var(--line); color: var(--ink-soft); cursor: not-allowed; }

.secondary-btn {
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  padding: 14px;
  border-radius: 10px;
}

.error-banner { background: #F8E3DF; color: var(--danger); font-size: 13px; padding: 8px 10px; border-radius: 8px; margin-bottom: 8px; }

/* ---------------- Receipt (laid out like the existing till receipt) ---------------- */

.receipt-overlay {
  position: fixed;
  inset: 0;
  background: rgba(43, 36, 32, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 20;
}
.receipt {
  background: white;
  width: 100%;
  max-width: 400px;
  border-radius: 14px;
  padding: 22px 20px;
  max-height: 94vh;
  overflow-y: auto;
}

.rc { font-size: 13px; color: #111; }
.rc-logo { display: block; height: 42px; margin: 0 auto 8px; border-radius: 4px; }
.rc-name { text-align: center; font-weight: 700; font-size: 19px; }
.rc-addr { text-align: center; color: #555; font-size: 12px; line-height: 1.5; margin-top: 4px; }
.rc-ticket { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-top: 14px; }
.rc-right { text-align: right; }
.rc-k { font-size: 11px; font-weight: 700; color: #333; }
.rc-big { font-size: 22px; font-weight: 800; line-height: 1.1; }
.rc-rule { border-top: 1px dashed #999; margin: 10px 0; }
.rc-row { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; }
.rc-qty { font-weight: 700; }
.rc-due { font-size: 24px; font-weight: 800; align-items: baseline; padding: 4px 0; }
.rc-center { text-align: center; margin-top: 8px; color: #333; }
.rc-foot { text-align: center; font-size: 12px; line-height: 1.5; color: #333; }
.rc-foot .b { font-weight: 700; color: #111; }

.rc-lines { display: grid; grid-template-columns: 1fr auto auto auto; column-gap: 10px; row-gap: 3px; align-items: baseline; }
.rc-lines .h { font-weight: 700; font-size: 11px; border-bottom: 1px dashed #999; padding-bottom: 4px; margin-bottom: 2px; }
.rc-lines .num, .rc-tax .num { text-align: right; font-variant-numeric: tabular-nums; }
.rc-note { grid-column: 1 / -1; font-size: 11px; font-style: italic; color: #444; padding-left: 8px; }

.rc-tax { display: grid; grid-template-columns: 1fr 1fr auto; column-gap: 10px; row-gap: 2px; }
.rc-tax .mid { text-align: center; }

.receipt-actions { display: flex; gap: 10px; margin-top: 18px; }
.receipt-actions .place-order-btn, .receipt-actions .secondary-btn { flex: 1; }

@media print {
  body * { visibility: hidden; }
  .receipt, .receipt * { visibility: visible; }
  .receipt { position: absolute; inset: 0; max-width: none; border-radius: 0; max-height: none; overflow: visible; }
  .receipt-actions { display: none; }
}

/* ---------------- Kitchen screen ---------------- */

.kitchen { background: var(--teal-deep); color: #F1ECE2; min-height: 100vh; }

.kitchen-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 28px;
  border-bottom: 1px solid #445957;
}
.kitchen-bar .brand-logo { height: 40px; }
.kitchen-clock { font-family: var(--font-display); font-size: 24px; color: var(--gold); }

.status-banner {
  background: #7A2E24;
  color: #fff;
  text-align: center;
  padding: 10px 16px;
  font-weight: 600;
}
.sound-chip {
  display: block;
  margin: 14px auto 0;
  background: var(--gold);
  color: var(--teal-deep);
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 999px;
}

.kitchen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
  padding: 24px 28px;
}
.empty-state { grid-column: 1 / -1; text-align: center; color: #A9BAB7; font-size: 18px; margin-top: 60px; }

.order-card {
  background: #33473F;
  border: 1px solid #445957;
  border-radius: 14px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.order-card.is-new { animation: cardArrive 0.6s ease; border-color: var(--gold); }
.order-card.late { border-color: #D9695B; }
@keyframes cardArrive {
  from { transform: scale(0.96); box-shadow: 0 0 0 4px var(--gold); }
  to   { transform: scale(1); box-shadow: 0 0 0 0 transparent; }
}
@media (prefers-reduced-motion: reduce) { .order-card.is-new { animation: none; } }

.order-card-top { display: flex; justify-content: space-between; align-items: baseline; }
.order-number { font-family: var(--font-display); font-size: 30px; font-weight: 700; color: var(--gold); }
.order-elapsed { font-size: 14px; color: #A9BAB7; }
.order-card.late .order-elapsed { color: #F2A79C; font-weight: 600; }
.order-type-line { font-size: 15px; color: #DDE7E4; }
.order-items { display: flex; flex-direction: column; gap: 6px; margin: 4px 0; }
.order-item-row { display: flex; gap: 8px; font-size: 17px; }
.order-item-qty { font-weight: 700; color: var(--gold); min-width: 28px; }
.order-item-note { font-size: 14px; color: #F3D9A8; padding-left: 36px; font-style: italic; }

.ready-btn {
  margin-top: auto;
  background: var(--sage);
  color: white;
  font-size: 17px;
  font-weight: 700;
  padding: 15px;
  border-radius: 10px;
}

/* ---------------- Past orders ---------------- */

a.type-btn { text-decoration: none; display: inline-block; }
.history { max-width: 900px; margin: 0 auto; padding: 18px 20px 40px; }
.history-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.history-controls label { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink-soft); }
.history-controls input[type="date"], .history-search {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 15px; background: var(--card);
}
.history-search { flex: 1; min-width: 200px; }
.history-controls .secondary-btn { text-decoration: none; padding: 10px 14px; font-size: 14px; }
.history-summary { display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 14px 0; font-size: 14px; color: var(--ink-soft); border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.history-summary b { color: var(--ink); }
.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-row {
  display: grid; grid-template-columns: 90px 1fr 110px 80px 84px; gap: 10px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; text-align: left; font-size: 14px;
}
.h-ticket { font-weight: 700; }
.h-total { text-align: right; font-weight: 600; }
.h-status { text-align: right; font-size: 12px; font-weight: 600; }
.h-status.ready { color: var(--sage); }
.h-status.cooking { color: var(--gold-deep); }
@media (max-width: 760px) {
  .history { padding: 14px; }
  .history-row { grid-template-columns: 1fr auto; row-gap: 2px; }
  .h-when { grid-column: 1; color: var(--ink-soft); }
  .h-staff { grid-column: 1; color: var(--ink-soft); font-size: 12px; }
  .h-total { grid-row: 1; grid-column: 2; }
  .h-status { grid-row: 2; grid-column: 2; }
}

/* ---------------- Login ---------------- */

.login-page { background: var(--teal); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { background: white; border-radius: 16px; padding: 28px 24px; width: 100%; max-width: 360px; text-align: center; }
.login-card img { height: 54px; border-radius: 4px; margin-bottom: 14px; }
.login-card h1 { font-size: 26px; margin-bottom: 6px; }
.login-card p { color: var(--ink-soft); font-size: 14px; margin: 0 0 16px; }
.login-card input[type="password"] { width: 100%; padding: 14px; font-size: 17px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; }
.login-card .place-order-btn { width: 100%; }
.login-error { color: var(--danger); font-size: 14px; margin-bottom: 12px; }

/* ---------------- Phones ---------------- */

@media (max-width: 760px) {
  .top-bar { padding: 10px 14px; }
  .order-layout { grid-template-columns: 1fr; height: auto; }
  .menu-grid { max-height: 52vh; grid-template-columns: repeat(2, 1fr); padding: 12px 14px 16px; }
  .category-tabs { padding: 12px 14px 0; }
  .cart-panel { border-left: none; border-top: 1px solid var(--line); padding: 16px 14px 28px; }
  .kitchen-grid { padding: 16px 14px; }
  .kitchen-bar { padding: 10px 14px; }
}
