/* ==========================================================================
   Cloudflare QR POS - Style System
   ========================================================================== */

:root {
  --primary: #d97706;        /* Vàng hổ phách cà phê */
  --primary-hover: #b45309;
  --primary-light: #fef3c7;
  --bg-color: #f8fafc;
  --surface: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --success: #16a34a;
  --danger: #dc2626;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius: 12px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  padding-bottom: 90px; /* Chừa khoảng trống cho thanh giỏ hàng đáy */
  -webkit-font-smoothing: antialiased;
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  font-size: 26px;
  background: var(--primary-light);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
}

.brand-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.table-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: var(--primary-light);
  color: var(--primary-hover);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid rgba(217, 119, 6, 0.2);
}

.badge-dot {
  width: 8px;
  height: 8px;
  background-color: var(--success);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(22, 163, 74, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

/* Banner */
.welcome-banner {
  background: linear-gradient(135deg, #fef3c7 0%, #fffbeb 100%);
  margin: 12px 16px;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid #fde68a;
  font-size: 13px;
  color: #92400e;
}

/* Category Filter Bar */
.category-nav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 16px 12px 16px;
  scrollbar-width: none;
}

.category-nav::-webkit-scrollbar {
  display: none;
}

.cat-btn {
  white-space: nowrap;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.cat-btn.active, .cat-btn:hover {
  background-color: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Menu Grid */
.menu-container {
  padding: 0 16px;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.food-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.food-card:active {
  transform: scale(0.98);
}

.food-img-wrap {
  width: 100%;
  height: 120px;
  background: #f1f5f9;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
}

.food-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  font-size: 10px;
  padding: 3px 6px;
  border-radius: 6px;
  backdrop-filter: blur(4px);
}

.food-info {
  padding: 10px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  justify-content: space-between;
}

.food-name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 4px;
}

.food-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.food-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}

.food-price {
  font-weight: 700;
  color: var(--primary-hover);
  font-size: 14px;
}

.btn-add {
  background: var(--primary);
  color: white;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.btn-add:hover {
  background: var(--primary-hover);
}

/* Bottom Cart Bar */
.cart-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 -4px 15px rgba(0,0,0,0.06);
  z-index: 50;
}

.cart-info {
  display: flex;
  flex-direction: column;
}

.cart-count-badge {
  font-size: 12px;
  color: var(--text-muted);
}

.cart-total-price {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary-hover);
}

.btn-checkout {
  background: var(--primary);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

/* Modal System */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: white;
  width: 100%;
  max-width: 500px;
  border-radius: 20px 20px 0 0;
  padding: 20px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.25s ease-out;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.btn-close {
  background: none;
  border: none;
  font-size: 28px;
  color: var(--text-muted);
  cursor: pointer;
}

.cart-items-list {
  overflow-y: auto;
  margin: 12px 0;
  max-height: 280px;
}

.cart-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
}

.item-qty-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qty-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  background: #f8fafc;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
}

.modal-summary {
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 14px;
}

.summary-row.font-bold {
  font-weight: 700;
  font-size: 16px;
}

.total-highlight {
  color: var(--primary-hover);
  font-size: 20px;
}

.btn-primary {
  width: 100%;
  background: var(--primary);
  color: white;
  border: none;
  padding: 14px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.text-center {
  text-align: center;
}

.success-icon {
  font-size: 50px;
  margin-bottom: 10px;
}

/* ==========================================================================
   Kitchen Screen (KDS) Styles
   ========================================================================== */

.kitchen-body {
  padding-bottom: 30px;
  background-color: #0f172a;
  color: #f8fafc;
}

.kitchen-header {
  background: #1e293b;
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #334155;
}

.kitchen-header .brand-title {
  color: white;
  font-size: 18px;
}

.kitchen-header .brand-sub {
  color: #94a3b8;
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #064e3b;
  color: #34d399;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid #059669;
}

.blink-dot {
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

.btn-clear-history {
  background: #334155;
  color: #cbd5e1;
  border: none;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  margin-left: 10px;
}

.kitchen-dashboard-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  padding: 20px 24px;
}

.stat-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.stat-num {
  font-size: 28px;
  font-weight: 800;
  color: #38bdf8;
}

.stat-num.highlight {
  color: #4ade80;
}

.stat-label {
  font-size: 13px;
  color: #94a3b8;
  margin-top: 4px;
}

.kitchen-container {
  padding: 0 24px;
}

.orders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.order-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.order-card-header {
  background: #334155;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.order-table-title {
  font-size: 18px;
  font-weight: 700;
  color: #fbbf24;
}

.order-time {
  font-size: 12px;
  color: #94a3b8;
}

.order-items-box {
  padding: 16px;
  flex-grow: 1;
}

.order-dish-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 14px;
  border-bottom: 1px dashed #475569;
  padding-bottom: 6px;
}

.order-card-footer {
  padding: 12px 16px;
  background: #0f172a;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-done {
  background: #16a34a;
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  font-size: 13px;
}

.btn-done:hover {
  background: #15803d;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #64748b;
}

.empty-icon {
  font-size: 54px;
  margin-bottom: 12px;
}
