@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@500;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --griddle: #2b2320;
  --griddle-light: #3d322c;
  --batter: #fff8e7;
  --batter-dim: #f3ead2;
  --maple: #a3620c;
  --maple-dark: #7a4708;
  --blueberry: #4a6fa5;
  --choc: #4a3728;
  --cream-line: #e8dcc0;
  --ok-green: #4f7942;
  --warn-red: #b3492f;
  --radius: 14px;
  --shadow: 0 4px 14px rgba(43, 35, 32, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  background: var(--batter);
  color: var(--griddle);
  min-height: 100vh;
}

h1, h2, h3, .display {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  letter-spacing: -0.01em;
}

a { color: var(--maple-dark); }

.site-header {
  background: var(--griddle);
  color: var(--batter);
  padding: 22px 24px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.site-header .brand {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--batter);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
}

.site-header .brand .brand-hat {
  width: 32px;
  height: 32px;
  transform: rotate(-15deg);
  display: inline-block;
}

.site-header .tag {
  color: #cbb99a;
  font-size: 0.9rem;
}

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

.wrap.wide { max-width: 960px; }

.card {
  background: #fff;
  border: 1px solid var(--cream-line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.field { margin-bottom: 20px; }

.field label,
.field .field-label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.field input[type="text"],
.field input[type="number"],
.field input[type="password"],
.field input[type="email"],
.field textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--cream-line);
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--batter-dim);
  color: var(--griddle);
}

.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--maple);
  background: #fff;
}

.topping-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.topping-list li {
  background: var(--batter-dim);
  border: 1.5px solid var(--cream-line);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.9rem;
  font-weight: 500;
}

.mixin-qty-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mixin-qty-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1.5px solid var(--cream-line);
  border-radius: 10px;
  padding: 10px 14px;
  background: var(--batter-dim);
}

.mixin-qty-row .name {
  font-weight: 500;
}

.mixin-qty-row .stepper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mixin-qty-row .stepper button {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1.5px solid var(--cream-line);
  background: #fff;
  font-family: 'Fredoka', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--maple-dark);
  cursor: pointer;
  line-height: 1;
}

.mixin-qty-row .stepper button:hover { background: var(--batter-dim); }
.mixin-qty-row .stepper button:disabled { opacity: 0.35; cursor: not-allowed; }

.mixin-qty-row .stepper .count {
  min-width: 20px;
  text-align: center;
  font-weight: 600;
  font-family: 'Fredoka', sans-serif;
}

.mixin-qty-row.has-qty {
  border-color: var(--maple);
  background: #fbeed8;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.choice-card {
  border: 1.5px solid var(--cream-line);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  background: var(--batter-dim);
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  transition: border-color 0.15s, background 0.15s;
}

.choice-card:has(input:checked) {
  border-color: var(--maple);
  background: #fbeed8;
}

.choice-card input { accent-color: var(--maple); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 10px;
  border: none;
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  background: var(--maple);
  color: #fff;
  transition: background 0.15s, transform 0.1s;
}

.btn:hover { background: var(--maple-dark); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.secondary { background: var(--griddle); }
.btn.secondary:hover { background: var(--griddle-light); }
.btn.ghost { background: transparent; color: var(--maple-dark); border: 1.5px solid var(--cream-line); }
.btn.danger { background: var(--warn-red); }
.btn.block { width: 100%; }
.btn.small { padding: 7px 14px; font-size: 0.85rem; }

.error-msg {
  background: #fbe4dd;
  border: 1px solid var(--warn-red);
  color: var(--warn-red);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.help-text { color: #7a6b58; font-size: 0.85rem; margin-top: 6px; }

.char-counter { text-align: right; font-size: 0.78rem; color: #9a8b76; margin-top: 4px; }
.char-counter.near-limit { color: var(--warn-red); font-weight: 600; }

/* Griddle tracker (signature element) */
.griddle-track {
  background: var(--griddle);
  border-radius: var(--radius);
  padding: 28px 20px;
  display: flex;
  justify-content: space-between;
  position: relative;
  margin: 8px 0 6px;
}

.griddle-track::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 40px;
  right: 40px;
  height: 3px;
  background: #4a3d34;
  transform: translateY(-50%);
  z-index: 0;
}

.track-step {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.track-step .pancake {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--griddle-light);
  border: 3px solid #4a3d34;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: all 0.25s;
}

.track-step.done .pancake {
  background: var(--maple);
  border-color: var(--maple-dark);
}

.track-step.current .pancake {
  background: #f0b429;
  border-color: #d99a1f;
  box-shadow: 0 0 0 5px rgba(240, 180, 41, 0.25);
}

.track-step .label {
  color: #cbb99a;
  font-size: 0.78rem;
  text-align: center;
  font-weight: 500;
}

.track-step.done .label, .track-step.current .label { color: var(--batter); font-weight: 600; }

.status-banner {
  text-align: center;
  padding: 14px;
  border-radius: 10px;
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  margin-bottom: 20px;
}

.status-banner.placed { background: #eee0c8; color: var(--maple-dark); }
.status-banner.cooking { background: #fbe9c4; color: #8a5a00; }
.status-banner.ready { background: #dceedb; color: var(--ok-green); }
.status-banner.picked_up { background: #e2e2e2; color: #555; }
.status-banner.cancelled { background: #f5e0e0; color: #933; }

.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--cream-line);
  font-size: 0.95rem;
}
.summary-row:last-child { border-bottom: none; }
.summary-row .k { color: #7a6b58; }
.summary-row .v { font-weight: 600; text-align: right; overflow-wrap: break-word; min-width: 0; }
.orig-qty { font-weight: 400; color: #9a8b76; font-size: 0.88em; }

table.orders {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
table.orders th, table.orders td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--cream-line);
  vertical-align: top;
}
table.orders td:nth-child(3), table.orders td:nth-child(5) {
  overflow-wrap: break-word;
  max-width: 360px;
}
table.orders th { color: #7a6b58; font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }

.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}
.pill.placed { background: #eee0c8; color: var(--maple-dark); }
.pill.cooking { background: #fbe9c4; color: #8a5a00; }
.pill.ready { background: #dceedb; color: var(--ok-green); }
.pill.picked_up { background: #e2e2e2; color: #555; }
.pill.cancelled { background: #f5e0e0; color: #933; text-decoration: line-through; }

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--cream-line);
}
.toggle-row:last-child { border-bottom: none; }

.switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; cursor: pointer; inset: 0;
  background: #d8cbb0; border-radius: 999px; transition: 0.2s;
}
.switch .slider::before {
  content: ''; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px;
  background: white; border-radius: 50%; transition: 0.2s;
}
.switch input:checked + .slider { background: var(--maple); }
.switch input:checked + .slider::before { transform: translateX(18px); }

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--cream-line);
}
.tab-btn {
  padding: 10px 16px;
  border: none;
  background: none;
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  color: #9a8b76;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
}
.tab-btn.active { color: var(--griddle); border-bottom-color: var(--maple); }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #9a8b76;
}

.inline-form {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.inline-form input { flex: 1; }

/* Queue position */
.queue-info {
  text-align: center;
  margin: 14px 0 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--griddle);
}
.queue-info.queue-next {
  color: var(--maple-dark);
  font-weight: 700;
}

/* Face rating (review form) */
.face-rating {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 16px 0 20px;
}

.face-btn {
  font-size: 2.2rem;
  background: none;
  border: 3px solid transparent;
  border-radius: 50%;
  width: 58px;
  height: 58px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
  padding: 0;
  line-height: 1;
}

.face-btn:hover { transform: scale(1.18); }
.face-btn.selected {
  border-color: var(--face-color, var(--maple));
  background: var(--batter-dim);
  transform: scale(1.18);
}

/* Opening soon */
@keyframes hat-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.chef-hat-spin {
  width: 120px;
  height: 120px;
  display: inline-block;
  animation: hat-spin 2.5s linear infinite;
}

.opening-soon-card {
  text-align: center;
  padding: 48px 24px;
}

.opening-countdown {
  font-family: 'Fredoka', sans-serif;
  font-size: 2.8rem;
  font-weight: 700;
  color: var(--maple);
  margin: 12px 0 4px;
  letter-spacing: 0.04em;
}

/* Closing soon banner */
.closing-soon-banner {
  background: #fbe4dd;
  border: 1.5px solid var(--warn-red);
  color: var(--warn-red);
  padding: 12px 16px;
  border-radius: 10px;
  font-weight: 600;
  text-align: center;
  font-size: 0.95rem;
  margin-bottom: 16px;
}

/* Order lookup */
.lookup-toggle {
  background: none;
  border: none;
  color: var(--maple-dark);
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.lookup-toggle:hover { color: var(--griddle); }
.lookup-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border: 1.5px solid var(--cream-line);
  border-radius: 10px;
  background: var(--batter-dim);
  text-decoration: none;
  color: var(--griddle);
  margin-bottom: 8px;
  transition: border-color 0.15s, background 0.15s;
}
.lookup-result:hover { border-color: var(--maple); background: #fbeed8; }
.lookup-name { font-weight: 600; }

@media (max-width: 480px) {
  .wrap { padding: 20px 14px 48px; }
  .card { padding: 18px; }
}

/* Review entries in session stats */
.review-entry {
  padding: 10px 0;
  border-top: 1px solid var(--cream-line);
  margin-top: 4px;
}
.review-entry-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 0.92rem;
}
.review-entry-comment {
  margin: 6px 0 0;
  font-size: 0.9rem;
  color: #5a4e42;
  font-style: italic;
}

/* Order row action cell */
.action-cell {
  position: relative;
  white-space: nowrap;
  text-align: right;
}

/* Hamburger (⋮) menu button */
.menu-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 7px;
  font-size: 1.15rem;
  color: #9a8b76;
  border-radius: 5px;
  line-height: 1;
  vertical-align: middle;
  margin-left: 4px;
}
.menu-btn:hover { background: var(--cream-line); color: var(--griddle); }

/* Order action dropdown */
.order-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  background: white;
  border: 1px solid var(--cream-line);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  min-width: 150px;
  z-index: 100;
  overflow: hidden;
}
.order-dropdown.open { display: block; }
.dropdown-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Fredoka', sans-serif;
  font-size: 0.92rem;
  color: var(--griddle);
  text-decoration: none;
}
.dropdown-item:hover { background: #f5efe3; }
.dropdown-item.danger { color: var(--warn-red); }
.dropdown-item.danger:hover { background: #fde8e4; }

/* Edit order modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(43,35,32,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.modal-card {
  background: white;
  border-radius: 16px;
  padding: 28px;
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

/* Mix-in qty rows inside the edit modal */
.modal-card .mixin-qty-row {
  padding: 7px 0;
  border: none;
  border-bottom: 1px solid var(--cream-line);
  border-radius: 0;
  background: none;
  font-size: 0.92rem;
}
.modal-card .mixin-qty-row:last-child { border-bottom: none; }
.modal-card .mixin-qty-row input[type="number"] {
  width: 64px;
  text-align: center;
}
