/* The look of the page of the simulated waiter. The colours are those of the
   application (specification, section 8.3), so that the demo looks like one whole. */
:root {
  --page: #f5f2eb;
  --card: #fbfaf6;
  --border: #e6e0d4;
  --muted: #ebe6dc;
  --text: #2b2b2b;
  --text-2: #6b6b6b;
  --primary: #2563c0;
  --selected: #dae5f5;
  --success: #27734a;
  --danger: #b3372b;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--page);
  color: var(--text);
  font-family: Inter, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  padding: 24px;
  max-width: 1000px;
  margin: 0 auto;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 16px;
}

h1 {
  font-size: 18px;
}

h2 {
  font-size: 18px;
  margin-bottom: 4px;
}

h3 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-2);
  margin: 20px 0 8px;
}

header p,
.note {
  font-size: 14px;
  color: var(--text-2);
}

select,
button {
  font: inherit;
  color: inherit;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  padding: 8px 12px;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
  background: var(--muted);
  color: var(--text-2);
}

#message {
  min-height: 24px;
  margin-bottom: 8px;
  font-size: 14px;
}

#message.ok {
  color: var(--success);
}

#message.problem {
  color: var(--danger);
}

main {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 24px;
  align-items: start;
}

/* The floor plan: round tables in groups of three, one group under another. */
#tables {
  display: grid;
  gap: 28px;
}

#tables .group {
  display: flex;
  gap: 12px;
}

#tables .table {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  padding: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-align: center;
}

#tables .table .name {
  font-size: 14px;
  font-weight: 600;
  /* A long table code breaks into two lines and stays inside the circle. */
  overflow-wrap: anywhere;
  line-height: 1.2;
}

#tables .table .state {
  font-size: 12px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

/* A table with an open bill: a red line around it. Its state is also written
   as text, the amount of the bill. */
#tables .table.taken {
  background: var(--muted);
  border: 2px solid var(--danger);
}

/* The table the waiter is writing a bill for: a blue ring around it. */
#tables .table[aria-pressed='true'] {
  background: var(--selected);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary);
}

#tables .table[aria-pressed='true'] .state {
  color: var(--text);
}

/* The bill of the chosen table */
#panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px;
}

.menu {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 8px;
}

.menu button {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
}

.lines {
  list-style: none;
}

.lines li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--muted);
}

.lines .name {
  flex: 1;
}

.amount {
  font-variant-numeric: tabular-nums;
  text-align: right;
  /* "3,00 €" stays on one line. */
  white-space: nowrap;
}

.total {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  padding: 10px 0;
}

.actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

button.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  font-weight: 600;
}

button.primary:disabled {
  background: var(--muted);
  border-color: var(--border);
  color: var(--text-2);
}

button.danger {
  border-color: var(--danger);
  color: var(--danger);
  font-weight: 600;
}

button.small {
  padding: 2px 10px;
}

@media (max-width: 700px) {
  main {
    grid-template-columns: 1fr;
  }
}
