/* ── Design tokens ─────────────────────────────────────────────────────────── */
:root {
  --green-dark:   #1b4332;
  --green-mid:    #2d6a4f;
  --green-light:  #52b788;
  --orange:       #e76f51;
  --orange-dark:  #c1440e;
  --bg:           #f2f5f3;
  --card:         #ffffff;
  --text:         #1a2e1e;
  --muted:        #607068;
  --border:       #d4ddd8;
  --error:        #c62828;
  --radius:       14px;
  --shadow:       0 2px 12px rgba(0,0,0,0.08);
}

/* ── Reset ──────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 18px;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

/* ── Screen containers ──────────────────────────────────────────────────────── */
.screen {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}
.hidden { display: none !important; }

/* ── Loading ────────────────────────────────────────────────────────────────── */
#loading {
  align-items: center;
  justify-content: center;
  gap: 20px;
  background: var(--green-dark);
  color: #fff;
  text-align: center;
  padding: 40px;
}
.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255,255,255,0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }
#loading p { font-size: 17px; opacity: 0.85; }

/* ── App header ─────────────────────────────────────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--green-dark);
  color: #fff;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);
}
.header-left { display: flex; flex-direction: column; gap: 2px; }
.course-name  { font-size: 18px; font-weight: 700; letter-spacing: -0.2px; }
.cart-label   { font-size: 13px; opacity: 0.75; }
.header-right { position: relative; }
.cart-icon    { font-size: 26px; line-height: 1; }
.cart-badge {
  position: absolute;
  top: -8px; right: -10px;
  background: var(--orange);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  border-radius: 50%;
  width: 22px; height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--green-dark);
}

/* ── Customer info strip ─────────────────────────────────────────────────────── */
.customer-section {
  background: var(--card);
  padding: 16px 20px;
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 14px;
  border-bottom: 1px solid var(--border);
}
.field-group { display: flex; flex-direction: column; gap: 6px; }
.field-group label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.7px;
}
.field-group input {
  width: 100%;
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color 0.18s;
  -webkit-appearance: none;
}
.field-group input:focus { border-color: var(--green-light); background: #fff; }
.field-group input.error { border-color: var(--error); }

/* ── Menu container ──────────────────────────────────────────────────────────── */
.menu-container { flex: 1; padding-bottom: 16px; }

.menu-section { padding: 20px 20px 4px; }

.category-title {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--green-mid);
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 2px solid var(--green-light);
}

/* ── Item card ───────────────────────────────────────────────────────────────── */
.item-card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  box-shadow: var(--shadow);
  transition: border-color 0.18s, box-shadow 0.18s;
}
.item-card.in-cart {
  border-color: var(--green-light);
  box-shadow: 0 0 0 3px rgba(82,183,136,0.2), var(--shadow);
}

.item-info   { flex: 1; min-width: 0; }
.item-name   { display: block; font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.item-price  { display: block; font-size: 15px; font-weight: 500; color: var(--green-mid); }

.item-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.qty-btn {
  width: 40px; height: 40px;
  border-radius: 10px;
  border: 2px solid var(--green-light);
  background: #fff;
  color: var(--green-dark);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.qty-btn.plus  { background: var(--green-dark); color: #fff; border-color: var(--green-dark); }
.qty-btn:active { filter: brightness(0.88); }
.qty-btn:disabled { opacity: 0.28; pointer-events: none; }
.qty-display {
  font-size: 20px;
  font-weight: 800;
  min-width: 28px;
  text-align: center;
  color: var(--text);
}

/* ── Notes section ───────────────────────────────────────────────────────────── */
.notes-section {
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.notes-section label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.7px;
}
.notes-section textarea {
  width: 100%;
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  resize: none;
  outline: none;
  transition: border-color 0.18s;
}
.notes-section textarea:focus { border-color: var(--green-light); background: #fff; }

/* ── Order bar (sticky bottom) ───────────────────────────────────────────────── */
.order-bar {
  position: sticky;
  bottom: 0;
  z-index: 200;
  background: #fff;
  border-top: 2px solid var(--border);
  padding: 14px 20px;
  padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
}
.order-total        { font-size: 16px; color: var(--muted); white-space: nowrap; }
.order-total strong { font-size: 22px; color: var(--text); font-weight: 800; }
.place-order-btn {
  flex: 1;
  background: var(--orange);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 15px 20px;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  letter-spacing: 0.2px;
  transition: background 0.12s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.place-order-btn:active   { background: var(--orange-dark); transform: scale(0.98); }
.place-order-btn:disabled { background: var(--border); color: var(--muted); cursor: not-allowed; transform: none; }

/* ── Confirmation screen ─────────────────────────────────────────────────────── */
#confirmation {
  align-items: center;
  justify-content: center;
  padding: 48px 28px;
  background: var(--green-dark);
  color: #fff;
  text-align: center;
}
.confirm-inner { max-width: 380px; }

.confirm-check {
  width: 100px; height: 100px;
  border-radius: 50%;
  background: var(--green-light);
  color: var(--green-dark);
  font-size: 52px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 28px;
  animation: pop 0.35s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes pop { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }

#confirmation h1  { font-size: 34px; margin-bottom: 10px; }
#confirmation p   { font-size: 17px; opacity: 0.88; margin-bottom: 8px; }
.order-id-block {
  margin: 24px auto;
  padding: 16px 28px;
  background: rgba(255,255,255,0.14);
  border-radius: var(--radius);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 3px;
  display: inline-block;
}
.confirm-note { font-size: 14px; opacity: 0.55; margin-bottom: 36px; }
.new-order-btn {
  background: var(--orange);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 16px 36px;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.new-order-btn:active { background: var(--orange-dark); }
