:root {
  --primary: #10b981;
  --primary-dark: #059669;
  --primary-light: #d1fae5;
  --secondary: #f59e0b;
  --dark: #0f172a;
  --gray-light: #f8fafc;
  --gray-border: #e2e8f0;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --radius: 16px;
  --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.02);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: #f1f5f9;
  color: var(--text-main);
  padding-bottom: 90px;
}

.app-container {
  max-width: 500px;
  margin: 0 auto;
  background: #ffffff;
  min-height: 100vh;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
  position: relative;
}

/* Header */
.app-header {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  color: white;
  padding: 20px 18px 16px;
  border-bottom-left-radius: 24px;
  border-bottom-right-radius: 24px;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.2);
}

.user-badge {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.avatar {
  background: rgba(255, 255, 255, 0.25);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.greeting-text h2 {
  font-size: 16px;
  font-weight: 700;
}

.greeting-text p {
  font-size: 13px;
  opacity: 0.9;
}

.history-btn {
  background: rgba(255, 255, 255, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.history-btn:hover {
  background: rgba(255, 255, 255, 0.4);
}

.logout-btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
}

/* Collapsible History Cards */
.history-card {
  background: #fff;
  border: 1px solid var(--gray-border);
  border-radius: 14px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.03);
  overflow: hidden;
  transition: all 0.2s ease;
}

.history-card:hover {
  border-color: #cbd5e1;
}

.history-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  cursor: pointer;
  user-select: none;
  background: #fff;
  transition: background 0.15s;
}

.history-card-header:hover {
  background: #f8fafc;
}

.history-toggle-icon {
  font-size: 11px;
  color: var(--text-muted);
  transition: transform 0.25s ease;
  display: inline-block;
  margin-left: 6px;
}

.history-card.open .history-toggle-icon {
  transform: rotate(180deg);
}

.history-card-body {
  display: none;
  padding: 0 14px 12px;
  border-top: 1px dashed var(--gray-border);
  background: #fafafa;
  animation: fadeInDown 0.2s ease-out;
}

.history-card.open .history-card-body {
  display: block;
}

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

.history-card-items {
  font-size: 13px;
  color: var(--text-main);
  line-height: 1.6;
  padding-top: 8px;
  margin-bottom: 8px;
}

.history-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  padding-top: 8px;
  border-top: 1px solid var(--gray-border);
}

/* Pagination Styling */
.history-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--gray-border);
}

.page-btn {
  padding: 6px 12px;
  border: 1px solid var(--gray-border);
  background: #fff;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-main);
  transition: all 0.2s;
}

.page-btn:hover:not(:disabled) {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary-dark);
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.page-info {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.hero-question {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  padding: 12px 14px;
  border-radius: 14px;
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.hero-question span {
  font-size: 24px;
}

.hero-question strong {
  font-size: 14px;
  line-height: 1.4;
}

/* Category Tabs */
.tab-container {
  display: flex;
  padding: 14px 18px 6px;
  gap: 10px;
}

.tab-btn {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--gray-border);
  background: #fff;
  border-radius: 12px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
}

.tab-btn.active {
  background: var(--primary-light);
  color: var(--primary-dark);
  border-color: var(--primary);
}

/* Notice Bar */
.delivery-notice {
  margin: 8px 18px;
  padding: 8px 12px;
  background: #fffbeb;
  border: 1px solid #fef3c7;
  border-radius: 10px;
  font-size: 12px;
  color: #b45309;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Product Cards */
.product-grid {
  padding: 10px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.product-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #fff;
  border: 1px solid var(--gray-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.prod-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.prod-icon {
  width: 44px;
  height: 44px;
  background: var(--gray-light);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.prod-meta h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 2px;
}

.prod-unit {
  font-size: 12px;
  color: var(--text-muted);
}

.prod-price {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-dark);
  margin-top: 2px;
}

/* Quantity Controls & Animations */
.qty-control {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--gray-light);
  padding: 4px;
  border-radius: 20px;
  border: 1px solid var(--gray-border);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.qty-control:hover {
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.12);
}

.qty-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #fff;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.08);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  user-select: none;
  position: relative;
  overflow: hidden;
}

.qty-btn:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 10px rgba(0,0,0,0.12);
}

.qty-btn:active {
  transform: scale(0.85);
  opacity: 0.75;
}

.qty-btn.plus {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
}

.qty-btn.plus:hover {
  box-shadow: 0 6px 14px rgba(16, 185, 129, 0.4);
}

.qty-btn.minus {
  color: #64748b;
  background: #fff;
}

.qty-btn.minus:hover {
  color: #ef4444;
  background: #fef2f2;
}

/* Ripple click effect */
.qty-btn::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background: radial-gradient(circle, rgba(255,255,255,0.7) 10%, transparent 10.01%);
  background-size: 1000% 1000%;
  background-position: 50% 50%;
  opacity: 0;
  transition: background-size 0.4s, opacity 0.4s;
}

.qty-btn:active::after {
  background-size: 0% 0%;
  opacity: 0.8;
  transition: 0s;
}

/* Con số số lượng: Zoom Fade In/Out khi bấm cộng trừ */
.qty-val {
  min-width: 24px;
  text-align: center;
  font-weight: 800;
  font-size: 15px;
  color: var(--text-main);
  display: inline-block;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease;
}

.qty-val.animate-zoom-fade {
  animation: zoomFadePulse 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes zoomFadePulse {
  0% {
    transform: scale(0.6);
    opacity: 0.2;
  }
  50% {
    transform: scale(1.4);
    opacity: 1;
    color: var(--primary);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Hiệu ứng rung nhẹ giỏ hàng khi thêm sản phẩm */
.cart-total.animate-bounce, .cart-count.animate-bounce {
  animation: cartPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes cartPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.18); color: var(--primary); }
  100% { transform: scale(1); }
}

/* Card sản phẩm active khi có chọn món */
.product-card {
  transition: all 0.25s ease;
}

.product-card.has-items {
  border-color: var(--primary);
  background: linear-gradient(to right, #ffffff, #f0fdf4);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.12);
}

/* Sticky Bottom Cart Bar */
.cart-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 500px;
  background: #fff;
  padding: 12px 18px;
  border-top: 1px solid var(--gray-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 -4px 15px rgba(0,0,0,0.06);
  z-index: 100;
}

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

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

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

.checkout-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 12px 22px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}

.checkout-btn:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
}

/* Modal Styling */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  align-items: flex-end;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: #fff;
  width: 100%;
  max-width: 500px;
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  padding: 24px 20px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease-out;
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
}

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

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-main);
}

.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--gray-border);
  border-radius: 10px;
  font-size: 14px;
  outline: none;
}

.form-group input:focus, .form-group select:focus {
  border-color: var(--primary);
}

.btn-primary {
  width: 100%;
  background: var(--primary);
  color: white;
  border: none;
  padding: 13px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

/* QR Code Section */
.qr-container {
  text-align: center;
  padding: 10px 0;
}

.qr-img {
  width: 220px;
  height: 220px;
  margin: 10px auto;
  border-radius: 12px;
  border: 1px solid var(--gray-border);
  padding: 6px;
  background: #fff;
}

.timer-box {
  background: #fff1f2;
  color: #e11d48;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  display: inline-block;
  margin: 8px 0;
}

.pay-guide {
  background: var(--gray-light);
  padding: 10px;
  border-radius: 10px;
  font-size: 13px;
  text-align: left;
  margin-top: 10px;
  line-height: 1.5;
}
