/* The kitchen display.
 *
 * Read from six feet away, in a room that is hot, loud and bright, by
 * somebody holding a pan. Every choice here follows from that: very large
 * type, few colours, no hover states (nobody hovers on a wall tablet), and
 * touch targets a knuckle can hit.
 *
 * Deliberately its own stylesheet rather than the portal's. The portal is a
 * desk tool with tabs and tables; this is one screen with one job, and
 * sharing components would drag one of them toward the other. */

.kds {
  margin: 0;
  background: #0a0a0d;
  color: #f6f5f8;
  font-family: Inter, system-ui, sans-serif;
  /* No pull-to-refresh: a cook wiping the screen must not reload the wall. */
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
}

.kds-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  background: #15131c;
  border-bottom: 1px solid #2a2635;
}
.kds-brand { font-size: 18px; font-weight: 800; letter-spacing: -0.3px; }
.kds-kitchen { color: #8b6ef5; }
.kds-restaurant { font-size: 15px; color: #b6b1c4; }
.kds-spacer { flex: 1; }
.kds-status { font-size: 14px; color: #8f8a9e; font-variant-numeric: tabular-nums; }
.kds-status.is-stale { color: #ffb020; font-weight: 700; }

.kds-btn {
  min-height: 44px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  border: 1px solid #3a3548;
  border-radius: 10px;
  background: #211d2c;
  color: #f6f5f8;
  font: inherit;
  font-size: 15px;
  text-decoration: none;
  cursor: pointer;
}
.kds-btn[aria-pressed="true"] { border-color: #8b6ef5; color: #cdbcff; }

.kds-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 14px;
  padding: 14px;
  align-items: start;
}

.ticket {
  background: #16141d;
  border: 2px solid #2a2635;
  border-radius: 14px;
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
/* Waiting to be accepted: the only thing on the wall that needs a decision
 * rather than cooking, so it is the only thing that pulses. */
.ticket.is-new { border-color: #8b6ef5; animation: ticket-pulse 1.6s ease-in-out infinite; }
/* Past its promised prep time. Amber, then red - the same escalation the
 * portal uses, so a cook moving between them reads one language. */
.ticket.is-late { border-color: #ffb020; }
.ticket.is-very-late { border-color: #ff5c5c; }

@keyframes ticket-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(139, 110, 245, 0.45); }
  50% { box-shadow: 0 0 0 10px rgba(139, 110, 245, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .ticket.is-new { animation: none; }
}

.ticket-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.ticket-number { font-size: 30px; font-weight: 800; letter-spacing: -0.5px; }
.ticket-age { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; color: #b6b1c4; }
.ticket.is-late .ticket-age { color: #ffb020; }
.ticket.is-very-late .ticket-age { color: #ff5c5c; }

.ticket-meta { display: flex; gap: 8px; flex-wrap: wrap; font-size: 14px; color: #b6b1c4; }
.ticket-tag {
  padding: 2px 10px;
  border-radius: 999px;
  background: #241f30;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.ticket-tag.is-pickup { background: #2c2440; color: #cdbcff; }

.ticket-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ticket-item { display: flex; gap: 10px; font-size: 21px; line-height: 1.25; }
.ticket-qty { font-weight: 800; min-width: 2ch; color: #8b6ef5; }
.ticket-name { font-weight: 600; }
/* Options and a customer's note are the two things a kitchen gets wrong
 * when they are small, so they are not small. */
.ticket-mods { font-size: 17px; color: #cdbcff; }
.ticket-note { font-size: 17px; color: #ffd08a; font-weight: 600; }
.ticket-item.is-unavailable .ticket-name { text-decoration: line-through; opacity: 0.55; }

.ticket-actions { display: flex; gap: 10px; margin-top: 2px; }
.ticket-actions button {
  flex: 1;
  min-height: 62px;
  border-radius: 12px;
  border: none;
  font: inherit;
  font-size: 19px;
  font-weight: 800;
  cursor: pointer;
}
.btn-accept { background: #8b6ef5; color: #fff; }
.btn-ready { background: #2f9e59; color: #fff; }
.btn-print { background: #241f30; color: #f6f5f8; flex: 0 0 72px; font-size: 16px; }
.ticket-actions button:disabled { opacity: 0.5; }

.kds-empty {
  text-align: center;
  /* 3.80 against the wall-tablet black - under AA, on the line that tells
     somebody why the screen is empty. Lifted to clear 4.5. */
  color: #7c7789;
  font-size: 20px;
  margin: 60px auto;
}

/* ---------------------------------------------------------------------------
 * Printing
 * ---------------------------------------------------------------------------
 * A thermal roll is about 80mm wide, monochrome, and has no concept of a
 * background colour. So the print view is black on white, one column, and
 * nothing else on the page goes with it. */
.print-ticket { display: none; }

@media print {
  body.kds > *:not(.print-ticket) { display: none !important; }
  .print-ticket {
    display: block;
    color: #000;
    background: #fff;
    font-family: Inter, system-ui, sans-serif;
    width: 72mm;
    font-size: 12pt;
  }
  .print-ticket h1 { font-size: 20pt; margin: 0 0 2mm; }
  .print-ticket .print-meta { font-size: 11pt; margin-bottom: 3mm; }
  .print-ticket ul { list-style: none; padding: 0; margin: 0 0 3mm; }
  .print-ticket li { margin-bottom: 2mm; font-size: 13pt; }
  .print-ticket .print-mods,
  .print-ticket .print-note { font-size: 11pt; padding-left: 6mm; }
  .print-ticket .print-rule { border-top: 1px dashed #000; margin: 3mm 0; }
  @page { margin: 4mm; }
}
