/* ===================================================================
   QuickKitchen Kiosk — styles
   Light, appetizing, touch-first. Brand color injected via --brand.
   =================================================================== */
:root {
  --brand: #f5a623;
  --brand-dark: #e0941a;
  --accent: #42c891;
  --bg: #f7f7f5;
  --surface: #ffffff;
  --text: #1a1a1a;
  --text2: #6b6b6b;
  --border: #e8e8e4;
  --danger: #e0533d;
  --radius: 16px;
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.18);
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  user-select: none;
  -webkit-user-select: none;
}

/* ---------- Screens ---------- */
.screen { display: none; position: fixed; inset: 0; }
.screen.active { display: flex; align-items: center; justify-content: center; flex-direction: column; }

/* Loading */
.spinner {
  width: 56px; height: 56px; border: 5px solid var(--border);
  border-top-color: var(--brand); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { margin-top: 20px; color: var(--text2); font-size: 1.1rem; }

/* Error */
.error-box { text-align: center; padding: 40px; max-width: 480px; }
.error-icon { font-size: 56px; margin-bottom: 16px; }
.error-box h2 { font-size: 1.6rem; margin-bottom: 8px; }
.error-box p { color: var(--text2); margin-bottom: 24px; }

/* ---------- Attract ---------- */
#screen-attract {
  background: linear-gradient(160deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff; cursor: pointer; z-index: 100;
}
.attract-inner { text-align: center; padding: 40px; }
.attract-logo {
  width: 120px; height: 120px; background: rgba(255,255,255,0.2);
  border-radius: 30px; display: flex; align-items: center; justify-content: center;
  font-size: 56px; font-weight: 800; margin: 0 auto 28px; backdrop-filter: blur(8px);
}
#attract-name { font-size: 3.5rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 12px; }
.attract-sub { font-size: 1.4rem; opacity: 0.9; margin-bottom: 36px; }
.attract-pulse {
  width: 14px; height: 14px; background: #fff; border-radius: 50%;
  margin: 40px auto 0; animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{opacity:1;transform:scale(1);} 50%{opacity:0.4;transform:scale(1.4);} }
.lang-row { display: flex; gap: 12px; justify-content: center; }
.lang-row button {
  padding: 12px 28px; font-size: 1.1rem; font-weight: 700; border: 2px solid rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.12); color: #fff; border-radius: 999px; cursor: pointer;
}
.lang-row button.active { background: #fff; color: var(--brand-dark); border-color: #fff; }

/* ---------- App shell ---------- */
.app-shell { display: none; flex-direction: column; height: 100vh; }
.app-shell.active { display: flex; }

.kx-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; background: var(--surface); border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow); z-index: 10;
}
.kx-header-left, .kx-header-right { display: flex; align-items: center; gap: 14px; }
.kx-back {
  width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); font-size: 28px; color: var(--text); cursor: pointer; line-height: 1;
}
.kx-brand { font-size: 1.5rem; font-weight: 800; color: var(--brand); }
.lang-switch { display: flex; gap: 4px; background: var(--bg); border-radius: 999px; padding: 4px; }
.lang-switch button {
  padding: 8px 14px; border: none; background: transparent; border-radius: 999px;
  font-weight: 700; font-size: 0.85rem; color: var(--text2); cursor: pointer;
}
.lang-switch button.active { background: var(--brand); color: #fff; }
.kx-cart-btn {
  position: relative; display: flex; align-items: center; gap: 8px;
  padding: 10px 18px; background: var(--brand); color: #fff; border: none;
  border-radius: 999px; font-size: 1rem; font-weight: 700; cursor: pointer;
}
.cart-emoji { font-size: 1.2rem; }
.cart-count {
  background: #fff; color: var(--brand-dark); border-radius: 999px;
  min-width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 800; padding: 0 6px;
}

/* Categories rail */
.kx-cats {
  display: flex; gap: 10px; padding: 14px 22px; overflow-x: auto; background: var(--surface);
  border-bottom: 1px solid var(--border); -webkit-overflow-scrolling: touch;
}
.kx-cats::-webkit-scrollbar { display: none; }
.cat-chip {
  flex: 0 0 auto; padding: 12px 22px; border-radius: 999px; border: 2px solid var(--border);
  background: var(--surface); font-size: 1rem; font-weight: 700; color: var(--text2);
  cursor: pointer; white-space: nowrap; transition: all 0.15s;
}
.cat-chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* Main grid */
.kx-main { flex: 1; overflow-y: auto; padding: 22px; -webkit-overflow-scrolling: touch; }
.items-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px;
}
.item-card {
  background: var(--surface); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); cursor: pointer; transition: transform 0.12s, box-shadow 0.12s;
  display: flex; flex-direction: column;
}
.item-card:active { transform: scale(0.98); }
.item-photo {
  width: 100%; aspect-ratio: 4/3; object-fit: cover; background: var(--bg);
  display: block;
}
.item-photo-ph {
  width: 100%; aspect-ratio: 4/3; background: linear-gradient(135deg,#f0f0ec,#e4e4de);
  display: flex; align-items: center; justify-content: center; font-size: 40px; opacity: 0.4;
}
.item-body { padding: 16px; flex: 1; display: flex; flex-direction: column; }
.item-name { font-size: 1.15rem; font-weight: 700; margin-bottom: 4px; }
.item-desc { font-size: 0.85rem; color: var(--text2); line-height: 1.4; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item-price { margin-top: 12px; font-size: 1.25rem; font-weight: 800; color: var(--brand-dark); }
.item-soldout { opacity: 0.5; pointer-events: none; position: relative; }
.item-soldout::after {
  content: attr(data-soldout); position: absolute; top: 50%; left: 50%;
  transform: translate(-50%,-50%) rotate(-8deg); background: var(--danger); color: #fff;
  padding: 6px 18px; border-radius: 8px; font-weight: 800; font-size: 1rem;
}

.section-title { font-size: 1.4rem; font-weight: 800; margin: 6px 0 18px; }

/* ---------- Modals ---------- */
.modal {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  align-items: flex-end; justify-content: center; z-index: 200; backdrop-filter: blur(2px);
}
.modal.active { display: flex; }
.modal-card {
  background: var(--surface); width: 100%; max-width: 640px; max-height: 92vh;
  border-radius: 24px 24px 0 0; overflow-y: auto; box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s ease;
}
@keyframes slideUp { from { transform: translateY(40px); opacity: 0.6; } to { transform: translateY(0); opacity: 1; } }
@media (min-width: 700px) {
  .modal { align-items: center; }
  .modal-card { border-radius: 24px; }
}

.detail-photo { width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.detail-photo-ph { width:100%; aspect-ratio:16/9; background:linear-gradient(135deg,#f0f0ec,#e4e4de);
  display:flex;align-items:center;justify-content:center;font-size:54px;opacity:0.4; }
.detail-head { padding: 20px 24px 8px; }
.detail-head h2 { font-size: 1.7rem; font-weight: 800; }
.detail-head .d-price { font-size: 1.4rem; font-weight: 800; color: var(--brand-dark); margin-top: 4px; }
.detail-head .d-desc { color: var(--text2); margin-top: 8px; line-height: 1.5; }

.mod-group { padding: 16px 24px; border-top: 1px solid var(--border); }
.mod-group-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.mod-group-title { font-size: 1.1rem; font-weight: 700; }
.mod-group-rule { font-size: 0.78rem; color: var(--text2); }
.mod-group-rule.required { color: var(--danger); font-weight: 700; }
.mod-list { display: flex; flex-wrap: wrap; gap: 10px; }
.mod-chip {
  padding: 12px 18px; border-radius: 12px; border: 2px solid var(--border);
  background: var(--surface); cursor: pointer; font-size: 0.95rem; font-weight: 600;
  display: flex; align-items: center; gap: 8px; transition: all 0.12s;
}
.mod-chip.selected { border-color: var(--brand); background: rgba(245,166,35,0.1); color: var(--brand-dark); }
.mod-chip .m-price { font-size: 0.82rem; color: var(--text2); font-weight: 700; }
.mod-chip.selected .m-price { color: var(--brand-dark); }
.mod-chip .m-check { color: var(--brand); font-weight: 800; display: none; }
.mod-chip.selected .m-check { display: inline; }
.mod-chip.unavailable { opacity: 0.4; pointer-events: none; text-decoration: line-through; }

.detail-foot {
  position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--border);
  padding: 16px 24px; display: flex; gap: 12px; align-items: center;
}
.qty-stepper { display: flex; align-items: center; gap: 14px; }
.qty-stepper button {
  width: 44px; height: 44px; border-radius: 12px; border: 2px solid var(--border);
  background: var(--surface); font-size: 24px; cursor: pointer; line-height: 1; color: var(--text);
}
.qty-stepper .qty-val { font-size: 1.3rem; font-weight: 800; min-width: 28px; text-align: center; }

.btn-primary {
  flex: 1; padding: 16px; border: none; background: var(--brand); color: #fff;
  border-radius: 14px; font-size: 1.1rem; font-weight: 800; cursor: pointer;
}
.btn-primary:disabled { background: var(--border); color: var(--text2); cursor: not-allowed; }
.btn-ghost {
  padding: 16px 22px; border: 2px solid var(--border); background: var(--surface);
  border-radius: 14px; font-size: 1rem; font-weight: 700; cursor: pointer; color: var(--text);
}

/* Cart */
.cart-head { padding: 20px 24px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.cart-head h2 { font-size: 1.6rem; font-weight: 800; }
.cart-close { width: 40px; height: 40px; border: none; background: var(--bg); border-radius: 10px; font-size: 22px; cursor: pointer; }
.cart-items { padding: 8px 24px; }
.cart-empty { padding: 60px 24px; text-align: center; color: var(--text2); }
.cart-line { display: flex; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.cart-line-body { flex: 1; }
.cart-line-name { font-weight: 700; font-size: 1.05rem; }
.cart-line-mods { font-size: 0.82rem; color: var(--text2); margin-top: 4px; line-height: 1.4; }
.cart-line-right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.cart-line-price { font-weight: 800; color: var(--brand-dark); }
.cart-line-qty { display: flex; align-items: center; gap: 10px; }
.cart-line-qty button { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); font-size: 18px; cursor: pointer; }
.cart-totals { padding: 16px 24px; border-top: 2px solid var(--border); }
.cart-total-row { display: flex; justify-content: space-between; padding: 4px 0; color: var(--text2); }
.cart-total-row.grand { font-size: 1.3rem; font-weight: 800; color: var(--text); padding-top: 10px; }
.cart-foot { padding: 16px 24px 24px; display: flex; gap: 12px; }

/* Confirm */
.confirm-card { text-align: center; padding: 50px 30px; max-width: 460px; }
.confirm-icon { font-size: 72px; margin-bottom: 16px; }
.confirm-card h2 { font-size: 2rem; font-weight: 800; margin-bottom: 8px; }
.confirm-num { font-size: 3rem; font-weight: 800; color: var(--brand); margin: 12px 0; }
.confirm-card p { color: var(--text2); font-size: 1.1rem; margin-bottom: 28px; }
