:root {
  --primary: #3182F6;
  --primary-light: #EBF3FF;
  --primary-dark: #1B64DA;
  --bg: #F5F6F8;
  --card: #FFFFFF;
  --text: #191F28;
  --text2: #4E5968;
  --text3: #8B95A1;
  --border: #E5E8EB;
  --success: #00C073;
  --success-light: #E5F9F0;
  --warning: #FF9500;
  --warning-light: #FFF3E0;
  --danger: #FF3B30;
  --danger-light: #FFF0EF;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 2px 12px rgba(0,0,0,0.07);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html { font-size: 16px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Pretendard', 'Noto Sans KR', 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

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

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.header-title { font-size: 17px; font-weight: 700; flex: 1; }
.header-sub { font-size: 13px; color: var(--text3); }
.btn-back {
  width: 36px; height: 36px;
  background: var(--bg);
  border: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 18px; color: var(--text2);
  flex-shrink: 0;
}

/* Cards */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  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: 14px 20px;
  border: none; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
  text-decoration: none; color: inherit;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--primary-light); color: var(--primary); }
.btn-ghost { background: transparent; color: var(--text2); }
.btn-danger { background: var(--danger-light); color: var(--danger); }
.btn-success { background: var(--success-light); color: var(--success); }
.btn-block { width: 100%; }
.btn-lg { padding: 16px 24px; font-size: 16px; border-radius: var(--radius); }
.btn-sm { padding: 8px 14px; font-size: 13px; }

/* Badges */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 8px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
}
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-gray { background: var(--border); color: var(--text3); }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text2); margin-bottom: 8px; }
.form-control {
  width: 100%; padding: 13px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px; color: var(--text);
  background: #fff; outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}
.form-control:focus { border-color: var(--primary); }
.form-control::placeholder { color: var(--text3); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

/* Menu items */
.menu-section { margin-bottom: 8px; }
.section-title {
  font-size: 18px; font-weight: 700;
  padding: 20px 20px 12px;
}
.menu-item {
  background: var(--card);
  display: flex; align-items: center; gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
}
.menu-item:last-child { border-bottom: none; }
.menu-item:active { background: var(--bg); }
.menu-item.unavailable { opacity: 0.4; pointer-events: none; }
.item-info { flex: 1; min-width: 0; }
.item-name { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.item-desc { font-size: 13px; color: var(--text3); margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-price { font-size: 15px; font-weight: 700; color: var(--text); }
.item-img {
  width: 80px; height: 80px;
  border-radius: 12px; object-fit: cover;
  flex-shrink: 0; background: var(--bg);
}
.item-img-placeholder {
  width: 80px; height: 80px;
  border-radius: 12px; background: var(--border);
  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: 28px; height: 28px;
  border: 1.5px solid var(--primary);
  border-radius: 50%; background: #fff;
  color: var(--primary); font-size: 18px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; line-height: 1;
}
.qty-num { font-size: 15px; font-weight: 700; min-width: 20px; text-align: center; }

/* Cart bar */
.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(--text);
  border-radius: var(--radius);
  padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: var(--shadow-lg);
  cursor: pointer; color: #fff;
}
.cart-bar-count { background: var(--primary); color: #fff; border-radius: 50%; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.cart-bar-label { font-size: 15px; font-weight: 600; flex: 1; margin-left: 10px; }
.cart-bar-total { font-size: 15px; font-weight: 700; }

/* Order list (kitchen) */
.order-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 12px;
  animation: slideIn 0.3s ease;
}
@keyframes slideIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.order-header {
  padding: 14px 16px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--border);
}
.order-num { font-size: 16px; font-weight: 800; }
.order-time { font-size: 12px; color: var(--text3); }
.order-table { font-size: 13px; font-weight: 600; color: var(--primary); background: var(--primary-light); padding: 3px 8px; border-radius: 6px; }
.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(--border); }
.order-item-name { font-weight: 500; }
.order-item-qty { font-weight: 700; color: var(--primary); }
.order-actions { padding: 12px 16px; display: flex; gap: 8px; }
.order-notes { padding: 8px 16px; font-size: 13px; color: var(--text3); background: var(--bg); }

/* Status colors */
.status-pending { color: var(--warning); }
.status-confirmed { color: var(--primary); }
.status-cooking { color: #FF6B35; }
.status-ready { color: var(--success); }
.status-completed { color: var(--text3); }

/* Tabs */
.tabs {
  display: flex;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  position: sticky; top: 65px; z-index: 90;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 14px 18px;
  font-size: 14px; font-weight: 600;
  color: var(--text3); cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap; flex-shrink: 0;
  transition: all 0.15s;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  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(--card);
  border-radius: var(--radius) var(--radius) 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: 18px; font-weight: 700; }
.modal-close { font-size: 22px; color: var(--text3); cursor: pointer; background: none; border: none; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; }
.modal-body { padding: 16px 20px 32px; }

/* Toast */
.toast {
  position: fixed; top: 80px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: #fff;
  padding: 12px 20px; border-radius: 100px;
  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(-10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* Divider */
.divider { height: 8px; background: var(--bg); margin: 0 -0px; }

/* List rows */
.list-row {
  display: flex; align-items: center;
  padding: 16px 20px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.list-row:last-child { border-bottom: none; }
.list-row-icon { font-size: 22px; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; background: var(--bg); border-radius: 12px; flex-shrink: 0; }
.list-row-info { flex: 1; }
.list-row-title { font-size: 15px; font-weight: 600; }
.list-row-sub { font-size: 13px; color: var(--text3); margin-top: 2px; }
.list-row-arrow { color: var(--border); 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: 17px; font-weight: 700; }
.empty-sub { font-size: 14px; color: var(--text3); }

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

/* Summary row */
.summary-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 15px; }
.summary-row:last-child { border-bottom: none; }
.summary-row.total { font-size: 17px; font-weight: 700; }

/* Sticky bottom */
.sticky-bottom {
  position: sticky; bottom: 0;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

/* Landing */
.hero { padding: 48px 20px 32px; text-align: center; }
.hero-icon { font-size: 64px; margin-bottom: 16px; }
.hero-title { font-size: 26px; font-weight: 800; margin-bottom: 10px; }
.hero-sub { font-size: 15px; color: var(--text2); line-height: 1.6; }
.favorites-list { padding: 0 20px; }
.fav-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  text-decoration: none; color: var(--text);
  box-shadow: var(--shadow);
  position: relative;
}
.fav-icon { font-size: 28px; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; background: var(--bg); border-radius: 14px; }
.fav-info { flex: 1; }
.fav-name { font-size: 15px; font-weight: 700; }
.fav-addr { font-size: 13px; color: var(--text3); margin-top: 2px; }
.fav-remove { position: absolute; right: 14px; top: 14px; font-size: 18px; color: var(--border); 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(--border); 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: 32px 0 16px; }
.confirm-title { font-size: 22px; font-weight: 800; text-align: center; margin-bottom: 8px; }
.confirm-sub { font-size: 15px; color: var(--text2); text-align: center; margin-bottom: 32px; }
.order-number-display {
  font-size: 32px; font-weight: 900; color: var(--primary);
  text-align: center; letter-spacing: 2px;
  padding: 20px; background: var(--primary-light);
  border-radius: var(--radius); margin-bottom: 24px;
}

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; padding: 16px; }
.stat-card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stat-label { font-size: 12px; color: var(--text3); font-weight: 600; margin-bottom: 6px; }
.stat-value { font-size: 22px; font-weight: 800; }
.stat-value.primary { color: var(--primary); }
.stat-value.success { color: var(--success); }

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

/* Responsive tweaks */
@media (prefers-color-scheme: dark) {
  /* Can add dark mode later */
}

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