:root {
  --bg: #1b1b1f;
  --panel: #26262c;
  --text: #f2f2f4;
  --muted: #9a9aa2;
  --border: #38383f;

  --cat-bieres: #d98b2f;
  --cat-vins: #8b2f5e;
  --cat-cocktails: #c0396b;
  --cat-softs: #2f8bd9;
  --cat-miam: #3f9142;
  --cat-consigne: #4a4a52;

  --danger: #c0392b;
  --danger-strong: #7a1f16;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
}

body {
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

.app-header {
  flex: 0 0 auto;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.app-header h1 {
  margin: 0;
  font-size: 1.3rem;
}

#menu {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 12px;
  -webkit-overflow-scrolling: touch;
}

.category-block {
  margin-bottom: 18px;
}

.category-title {
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 8px 4px;
  color: var(--muted);
}

.item-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.item-btn {
  border: none;
  border-radius: 10px;
  padding: 14px 10px;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  min-height: 64px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  transition: transform 0.06s ease;
}

.item-btn:active {
  transform: scale(0.96);
  filter: brightness(0.9);
}

.item-btn .price {
  font-size: 0.85rem;
  font-weight: 500;
  opacity: 0.9;
}

.item-btn[data-cat="Bières"]    { background: var(--cat-bieres); }
.item-btn[data-cat="Vins"]      { background: var(--cat-vins); }
.item-btn[data-cat="Cocktails"] { background: var(--cat-cocktails); }
.item-btn[data-cat="Softs"]     { background: var(--cat-softs); }
.item-btn[data-cat="Miam Miam"] { background: var(--cat-miam); }
.item-btn[data-cat="Consigne"]  { background: var(--cat-consigne); }

.order-panel {
  flex: 0 0 auto;
  border-top: 1px solid var(--border);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  max-height: 45vh;
}

.order-list {
  overflow-y: auto;
  padding: 8px 16px;
  flex: 1 1 auto;
}

.empty-hint {
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
  margin: 12px 0;
}

.order-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}

.order-line:last-child {
  border-bottom: none;
}

.order-line .line-price {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.order-footer {
  flex: 0 0 auto;
  padding: 10px 16px 14px;
  border-top: 1px solid var(--border);
}

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 10px;
}

#total {
  font-variant-numeric: tabular-nums;
}

.order-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn-action {
  border: none;
  border-radius: 10px;
  padding: 14px;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn-action:active {
  transform: scale(0.97);
}

.btn-clear {
  background: var(--danger);
}

.btn-clear-all {
  background: var(--danger-strong);
}

.hidden {
  display: none !important;
}

.btn-cash {
  width: 100%;
  border: none;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 8px;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  background: #2f9142;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn-cash:active {
  transform: scale(0.98);
}

/* Pop up paiement espèces */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}

.modal-box {
  width: 100%;
  max-width: 360px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.15rem;
}

.modal-close {
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 1.3rem;
  line-height: 1;
  padding: 6px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.modal-row {
  display: flex;
  justify-content: space-between;
  font-size: 1rem;
  color: var(--muted);
  margin-bottom: 16px;
}

.modal-label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 6px;
}

.modal-input {
  width: 100%;
  font-size: 1.2rem;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  margin-bottom: 18px;
}

.modal-change {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 1.3rem;
  font-weight: 700;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

#cash-change.negative {
  color: var(--danger);
}
