/* =============================================
   MiniMax Design System — QR Order
   ============================================= */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&display=swap');

:root {
  /* Brand Colors */
  --brand-coral:   #e84936;
  --brand-magenta: #e91e8c;
  --brand-blue:    #1d4ed8;
  --brand-cyan:    #38bdf8;
  --brand-purple:  #7c3aed;

  /* Monochrome */
  --primary:       #000000;
  --on-primary:    #ffffff;
  --canvas:        #ffffff;
  --card:          #ffffff;
  --surface:       #f5f5f5;
  --surface-soft:  #fafafa;

  /* Text */
  --ink:           #1a1a1a;
  --ink-strong:    #000000;
  --charcoal:      #333333;
  --slate:         #555555;
  --steel:         #777777;
  --stone:         #999999;
  --muted:         #aaaaaa;
  --on-dark:       #ffffff;

  /* Borders */
  --hairline:      #e5e5e5;
  --hairline-soft: #f0f0f0;

  /* Semantic */
  --success-bg:    #d1fae5;
  --success-text:  #065f46;
  --danger:        #d45656;
  --danger-light:  #fef2f2;
  --warning:       #f59e0b;
  --warning-light: #fffbeb;

  /* Shape */
  --radius-xs:   4px;
  --radius-sm:   6px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-xl:   16px;
  --radius-xxl:  20px;
  --radius-hero: 32px;
  --radius-full: 9999px;

  /* Elevation */
  --shadow-sm:  rgba(0,0,0,0.04) 0px 1px 2px;
  --shadow-md:  rgba(0,0,0,0.08) 0px 4px 6px;
  --shadow-lg:  rgba(0,0,0,0.08) 0px 0px 22px;
  --shadow-xl:  rgba(36,36,36,0.08) 0px 12px 16px -4px;

  /* Legacy compat aliases */
  --bg:          var(--surface);
  --text:        var(--ink);
  --text2:       var(--slate);
  --text3:       var(--steel);
  --border:      var(--hairline);
  --radius:      var(--radius-xl);
  --radius-pill: var(--radius-full);
  --shadow:      var(--shadow-sm);
}

/* ── Reset ────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; }
body {
  font-family: 'DM Sans', Inter, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--surface);
  color: var(--ink);
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
  line-height: 1.5;
}

/* ── Layout ───────────────────────────────── */
.page      { min-height: 100vh; display: flex; flex-direction: column; }
.container { padding: 0 20px; }

/* ── Header (Global Nav) ──────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--canvas);
  border-bottom: 1px solid var(--hairline-soft);
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.header-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);       /* explicit — never inherited white */
  flex: 1;
  margin: 0;               /* h1 default margin reset — same visual as the old div */
}
.header-sub { font-size: 14px; color: var(--steel); }
.btn-back {
  width: 32px; height: 32px;
  background: none;
  border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 20px;
  color: var(--ink);
  flex-shrink: 0;
  text-decoration: none;
}

/* ── Cards ────────────────────────────────── */
.card {
  background: var(--canvas);
  border-radius: var(--radius-xl);
  border: 1px solid var(--hairline);
  overflow: hidden;
}
.card-body { padding: 20px; }
.card + .card { margin-top: 12px; }

/* ── Buttons ──────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 11px 24px;
  border: none;
  border-radius: var(--radius-full);
  font-size: 14px; font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: scale(0.96); }

/* Black pill — primary CTA */
.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
}

/* Outline pill — secondary */
.btn-secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--ink);
}

/* White pill — tertiary */
.btn-ghost {
  background: var(--canvas);
  color: var(--ink);
  border: 1px solid var(--hairline);
}
.btn-danger  { background: var(--danger-light); color: var(--danger); }
.btn-success { background: var(--success-bg); color: var(--success-text); }
.btn-block   { width: 100%; }
.btn-lg      { padding: 13px 28px; font-size: 16px; }
.btn-sm      { padding: 7px 14px; font-size: 13px; }

/* ── Badges ───────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 13px; font-weight: 600;
}
.badge-primary { background: #e8f0fb; color: #1d4ed8; }
.badge-success { background: var(--success-bg); color: var(--success-text); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger  { background: var(--danger-light); color: var(--danger); }
.badge-gray    { background: var(--surface); color: var(--steel); border: 1px solid var(--hairline); }
.badge-new     { background: var(--brand-coral); color: #fff; }

/* ── Forms ────────────────────────────────── */
.form-group  { margin-bottom: 16px; }
.form-label  {
  display: block;
  font-size: 14px; font-weight: 500;
  color: var(--slate);
  margin-bottom: 6px;
}
.form-control {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  font-size: 14px; color: var(--ink);
  background: var(--canvas); outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
  height: 40px;
}
.form-control:focus { border: 2px solid var(--brand-blue); }
.form-control::placeholder { color: var(--steel); }
select.form-control    { cursor: pointer; }
textarea.form-control  { resize: vertical; min-height: 80px; height: auto; }

/* ── Menu Items ───────────────────────────── */
.menu-section { margin-bottom: 8px; }
.section-title {
  font-size: 20px; font-weight: 600;
  color: var(--ink);
  padding: 20px 20px 12px;
}
.menu-item {
  background: var(--canvas);
  display: flex; align-items: center; gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--hairline-soft);
  cursor: pointer;
  transition: background 0.1s;
}
.menu-item:last-child { border-bottom: none; }
.menu-item:active { background: var(--surface); }
.menu-item.unavailable { opacity: 0.4; pointer-events: none; }
.item-info { flex: 1; min-width: 0; }
.item-name {
  font-size: 16px; font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}
.item-desc {
  font-size: 13px; color: var(--steel);
  margin-bottom: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.item-price {
  font-size: 16px; font-weight: 600;
  color: var(--ink);
}
.item-img {
  width: 80px; height: 80px;
  border-radius: var(--radius-lg);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}
.item-img-placeholder {
  width: 80px; height: 80px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
}

/* ── Quantity Controls ───────────────────── */
.qty-control {
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}
.qty-btn {
  width: 30px; height: 30px;
  border: 1px solid var(--hairline);
  border-radius: 50%;
  background: var(--canvas);
  color: var(--ink);
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.qty-btn:active { background: var(--surface); transform: scale(0.95); }
.qty-num { font-size: 16px; font-weight: 600; min-width: 20px; text-align: center; }

/* ── Cart Bar (floating pill) ─────────────── */
.cart-bar {
  position: fixed;
  bottom: 20px; left: 50%; transform: translateX(-50%);
  width: calc(100% - 40px); max-width: 440px;
  z-index: 200;
}
.cart-bar-inner {
  background: var(--primary);
  border-radius: var(--radius-full);
  padding: 14px 22px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: var(--shadow-xl);
  cursor: pointer; color: var(--on-dark);
}
.cart-bar-count {
  background: var(--brand-coral);
  color: #fff;
  border-radius: 50%;
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
}
.cart-bar-label { font-size: 14px; font-weight: 600; flex: 1; margin-left: 10px; }
.cart-bar-total { font-size: 14px; font-weight: 600; }

/* ── Kitchen Order Cards ─────────────────── */
.order-card {
  background: var(--canvas);
  border-radius: var(--radius-xl);
  border: 1px solid var(--hairline);
  overflow: hidden;
  margin-bottom: 12px;
  animation: slideIn 0.3s ease;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.order-header {
  padding: 14px 16px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--hairline-soft);
}
.order-num  { font-size: 16px; font-weight: 600; }
.order-time { font-size: 12px; color: var(--steel); }
.order-table {
  font-size: 13px; font-weight: 600;
  color: var(--brand-blue);
  background: #e8f0fb;
  padding: 3px 10px;
  border-radius: var(--radius-full);
}
.order-items   { padding: 12px 16px; }
.order-item-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0; font-size: 14px;
}
.order-item-row:not(:last-child) { border-bottom: 1px solid var(--hairline-soft); }
.order-item-name { font-weight: 600; }
.order-item-qty  { font-weight: 600; color: var(--brand-blue); }
.order-actions   { padding: 12px 16px; display: flex; gap: 8px; }
.order-notes     { padding: 8px 16px; font-size: 13px; color: var(--steel); background: var(--surface); }

/* ── Status ───────────────────────────────── */
.status-pending   { color: var(--warning); }
.status-confirmed { color: var(--brand-blue); }
.status-cooking   { color: var(--brand-coral); }
.status-ready     { color: var(--success-text); }
.status-completed { color: var(--steel); }

/* ── Category Tabs (pill-tab style) ─────── */
.tabs {
  display: flex;
  background: var(--canvas);
  border-bottom: 1px solid var(--hairline-soft);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  position: sticky; top: 56px; z-index: 90;
  padding: 10px 12px;
  gap: 6px;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 7px 14px;
  font-size: 14px; font-weight: 500;
  color: var(--steel);
  cursor: pointer;
  border-radius: var(--radius-full);
  border: 1px solid var(--hairline);
  background: var(--canvas);
  white-space: nowrap; flex-shrink: 0;
  transition: all 0.15s;
}
.tab.active {
  background: var(--primary);
  color: var(--on-dark);
  border-color: var(--primary);
  font-weight: 600;
}

/* ── Modal ────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 300;
  display: flex; align-items: flex-end;
  animation: fadeIn 0.2s;
}
.modal-overlay.hidden { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--canvas);
  border-radius: var(--radius-hero) var(--radius-hero) 0 0;
  width: 100%; max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.25s ease;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.modal-header {
  padding: 20px 20px 0;
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 20px; font-weight: 600; }
.modal-close {
  font-size: 20px; color: var(--steel);
  cursor: pointer; background: none; border: none;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-full);
  border: 1px solid var(--hairline);
}
.modal-body { padding: 16px 20px 32px; }

/* ── Toast ────────────────────────────────── */
.toast {
  position: fixed; top: 72px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff;
  padding: 11px 20px;
  border-radius: var(--radius-full);
  font-size: 14px; font-weight: 500;
  z-index: 999; white-space: nowrap;
  animation: toastIn 0.3s ease;
  pointer-events: none;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Divider ──────────────────────────────── */
.divider { height: 8px; background: var(--surface); }

/* ── List Rows ────────────────────────────── */
.list-row {
  display: flex; align-items: center;
  padding: 16px 20px;
  background: var(--canvas);
  border-bottom: 1px solid var(--hairline-soft);
  gap: 12px;
}
.list-row:last-child { border-bottom: none; }
.list-row-icon {
  font-size: 18px; width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface);
  border-radius: var(--radius-md);
  flex-shrink: 0;
}
.list-row-info  { flex: 1; }
.list-row-title { font-size: 16px; font-weight: 600; }
.list-row-sub   { font-size: 13px; color: var(--steel); margin-top: 2px; }
.list-row-arrow { color: var(--hairline); font-size: 18px; }

/* ── Empty State ──────────────────────────── */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 20px; gap: 12px; text-align: center;
}
.empty-icon  { font-size: 48px; }
.empty-title { font-size: 18px; font-weight: 600; }
.empty-sub   { font-size: 14px; color: var(--steel); }

/* ── Admin Table ──────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th {
  text-align: left; padding: 10px 12px;
  font-size: 13px; font-weight: 600; color: var(--steel);
  background: var(--surface);
  border-bottom: 1px solid var(--hairline);
}
.data-table td { padding: 12px; border-bottom: 1px solid var(--hairline-soft); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface-soft); }

/* ── Summary Row ──────────────────────────── */
.summary-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--hairline-soft);
  font-size: 14px;
}
.summary-row:last-child { border-bottom: none; }
.summary-row.total { font-size: 16px; font-weight: 600; }

/* ── Sticky Bottom ────────────────────────── */
.sticky-bottom {
  position: sticky; bottom: 0;
  background: var(--canvas);
  padding: 16px 20px;
  border-top: 1px solid var(--hairline-soft);
}

/* ── Landing Hero ─────────────────────────── */
.hero { padding: 48px 20px 32px; text-align: center; }
.hero-icon  { font-size: 64px; margin-bottom: 16px; }
.hero-title {
  font-size: 40px; font-weight: 600;
  color: var(--ink-strong);
  letter-spacing: -1px;
  line-height: 1.2;
  margin-bottom: 12px;
}
.hero-sub { font-size: 16px; color: var(--slate); line-height: 1.5; }

/* Favorites */
.favorites-list { padding: 0 20px; }
.fav-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--canvas);
  border-radius: var(--radius-xl);
  border: 1px solid var(--hairline);
  padding: 14px 16px;
  margin-bottom: 10px;
  text-decoration: none; color: var(--ink);
  position: relative;
}
.fav-icon {
  font-size: 20px; width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface);
  border-radius: var(--radius-md);
}
.fav-info  { flex: 1; }
.fav-name  { font-size: 16px; font-weight: 600; }
.fav-addr  { font-size: 13px; color: var(--steel); margin-top: 2px; }
.fav-remove {
  position: absolute; right: 14px; top: 14px;
  font-size: 14px; color: var(--stone);
  background: none; border: none; cursor: pointer;
}

/* ── Switch Toggle ────────────────────────── */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0;
  background: var(--hairline);
  border-radius: 24px; cursor: pointer; transition: 0.2s;
}
.slider:before {
  content: '';
  position: absolute; left: 3px; top: 3px;
  width: 18px; height: 18px;
  background: #fff; border-radius: 50%; transition: 0.2s;
}
input:checked + .slider { background: var(--primary); }
input:checked + .slider:before { transform: translateX(20px); }

/* ── Kitchen Grid ─────────────────────────── */
.kitchen-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 16px;
}
@media (min-width: 600px) {
  .kitchen-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ── Confirm Page ─────────────────────────── */
.confirm-icon  { font-size: 64px; text-align: center; padding: 40px 0 16px; }
.confirm-title { font-size: 28px; font-weight: 600; letter-spacing: -0.5px; text-align: center; margin-bottom: 8px; }
.confirm-sub   { font-size: 16px; color: var(--slate); text-align: center; margin-bottom: 32px; }
.order-number-display {
  font-size: 32px; font-weight: 700;
  color: var(--ink-strong);
  text-align: center; letter-spacing: 2px;
  padding: 20px;
  background: var(--surface);
  border-radius: var(--radius-xl);
  border: 1px solid var(--hairline);
  margin-bottom: 24px;
}

/* ── Stats ────────────────────────────────── */
.stats-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 12px; padding: 16px;
}
.stat-card {
  background: var(--canvas);
  border-radius: var(--radius-xl);
  border: 1px solid var(--hairline);
  padding: 16px;
}
.stat-label { font-size: 12px; color: var(--steel); font-weight: 500; margin-bottom: 6px; }
.stat-value { font-size: 22px; font-weight: 600; }
.stat-value.primary { color: var(--primary); }
.stat-value.success { color: var(--success-text); }

/* ── Scrollbar ────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--hairline); border-radius: 4px; }

/* ── Print ────────────────────────────────── */
@media print { .no-print { display: none !important; } }

/* ── 접근성 ───────────────────────────────── */
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }

/* ── QR 스캐너 (스플래시 / 고객 홈 공용) ───── */
.scan-fab {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%);
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 14px 28px;
  font-size: 16px;
  font-weight: 700;
  display: flex; align-items: center; gap: 8px;
  box-shadow: 0 4px 20px rgba(49,130,246,.45);
  cursor: pointer;
  z-index: 100;
  transition: transform .15s, box-shadow .15s;
  white-space: nowrap;
}
.scan-fab:active { transform: translateX(-50%) scale(.96); }

.scan-modal {
  position: fixed; inset: 0;
  background: #000;
  z-index: 999;
  display: flex; flex-direction: column;
  transition: opacity .2s;
}
.scan-modal.hidden { display: none; }
.scan-header {
  position: absolute; top: 0; left: 0; right: 0;
  padding: 16px 16px;
  padding-top: calc(16px + env(safe-area-inset-top));
  display: flex; align-items: center; gap: 12px;
  z-index: 10;
  background: linear-gradient(to bottom, rgba(0,0,0,.7) 0%, transparent 100%);
}
.scan-back {
  background: rgba(255,255,255,.15);
  border: none; border-radius: 50%;
  width: 40px; height: 40px;
  color: #fff; font-size: 20px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.scan-title { color: #fff; font-size: 17px; font-weight: 700; }
#scan-video {
  width: 100%; height: 100%;
  object-fit: cover;
}
.scan-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  pointer-events: none;
}
.scan-frame {
  width: min(72vw, 280px);
  height: min(72vw, 280px);
  position: relative;
}
.scan-frame::before, .scan-frame::after,
.scan-frame > span::before, .scan-frame > span::after {
  content: '';
  position: absolute;
  width: 32px; height: 32px;
  border-color: #fff;
  border-style: solid;
}
.scan-frame::before  { top: 0;    left: 0;   border-width: 3px 0 0 3px; border-radius: 6px 0 0 0; }
.scan-frame::after   { top: 0;    right: 0;  border-width: 3px 3px 0 0; border-radius: 0 6px 0 0; }
.scan-frame > span::before { bottom: 0; left: 0;   border-width: 0 0 3px 3px; border-radius: 0 0 0 6px; }
.scan-frame > span::after  { bottom: 0; right: 0;  border-width: 0 3px 3px 0; border-radius: 0 0 6px 0; }
.scan-line {
  position: absolute; left: 4px; right: 4px; height: 2px;
  background: linear-gradient(to right, transparent, #3182F6, transparent);
  animation: scan-sweep 2s ease-in-out infinite;
  top: 0;
}
@keyframes scan-sweep {
  0%   { top: 8px; opacity: 1; }
  90%  { top: calc(100% - 8px); opacity: 1; }
  100% { top: calc(100% - 8px); opacity: 0; }
}
.scan-hint {
  color: rgba(255,255,255,.8);
  font-size: 14px;
  margin-top: 24px;
  text-align: center;
  line-height: 1.6;
}
.scan-result-toast {
  position: absolute;
  bottom: calc(40px + env(safe-area-inset-bottom));
  left: 16px; right: 16px;
  background: rgba(49,130,246,.95);
  color: #fff;
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  backdrop-filter: blur(8px);
  display: none;
}
