* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #8B7355;
  --primary-light: #A69076;
  --primary-dark: #6B5B47;
  --bg: #FDF8F3;
  --bg-card: #FFFFFF;
  --text: #333333;
  --text-light: #666666;
  --text-lighter: #999999;
  --border: #E8E0D8;
  --accent: #D4A574;
  --accent-light: #E8C9A8;
  --success: #52C41A;
  --warning: #FAAD14;
  --danger: #FF4D4F;
  --pending: #FAAD14;
  --accepted: #1890FF;
  --making: #722ED1;
  --done: #52C41A;
  --cancelled: #999999;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 100px;
}

/* Header */
.header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 20px 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 4px;
}

.header-table {
  font-size: 14px;
  opacity: 0.9;
}

/* Category Tabs */
.category-tabs {
  display: flex;
  overflow-x: auto;
  gap: 8px;
  padding: 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

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

.category-tab {
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  background: var(--bg);
  color: var(--text-light);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
}

.category-tab.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Product List */
.product-list {
  padding: 16px;
}

.category-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
  padding-left: 4px;
}

.product-item {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.product-item:active {
  transform: scale(0.98);
}

.product-info {
  flex: 1;
}

.product-name {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 4px;
}

.product-desc {
  font-size: 12px;
  color: var(--text-lighter);
  margin-bottom: 8px;
}

.product-price {
  font-size: 18px;
  font-weight: 600;
  color: var(--primary);
}

.product-price::before {
  content: '¥';
  font-size: 14px;
}

/* Cart Button */
.cart-btn {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: white;
  padding: 14px 32px;
  border-radius: 28px;
  font-size: 16px;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(139, 115, 85, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 1000;
  transition: transform 0.2s, box-shadow 0.2s;
}

.cart-btn:active {
  transform: translateX(-50%) scale(0.96);
}

.cart-btn .badge {
  background: var(--danger);
  color: white;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
}

.cart-btn.hidden {
  display: none;
}

/* Options Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 2000;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--bg-card);
  width: 100%;
  max-height: 80vh;
  border-radius: 16px 16px 0 0;
  padding: 20px;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s ease-out;
}

.modal-overlay.show .modal-content {
  transform: translateY(0);
}

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

.modal-title {
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg);
  border: none;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-product {
  text-align: center;
  padding: 16px;
  background: var(--bg);
  border-radius: 12px;
  margin-bottom: 20px;
}

.modal-product-name {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
}

.modal-product-price {
  font-size: 24px;
  font-weight: 600;
  color: var(--primary);
}

.option-group {
  margin-bottom: 20px;
}

.option-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 10px;
}

.option-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg);
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
}

.option-item.selected {
  background: var(--accent-light);
  border: 1px solid var(--accent);
}

.option-item input {
  margin-right: 10px;
}

.multi-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.multi-option {
  padding: 8px 16px;
  background: var(--bg);
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid var(--border);
}

.multi-option.selected {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--primary-dark);
}

.quantity-control {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin: 20px 0;
}

.quantity-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.quantity-num {
  font-size: 24px;
  font-weight: 600;
  min-width: 40px;
  text-align: center;
}

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

/* Cart Panel */
.cart-panel {
  background: var(--bg-card);
  width: 100%;
  max-height: 70vh;
  border-radius: 16px 16px 0 0;
  padding: 20px;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s ease-out;
}

.cart-panel.show {
  transform: translateY(0);
}

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

.cart-title {
  font-size: 18px;
  font-weight: 600;
}

.cart-clear {
  font-size: 14px;
  color: var(--danger);
  background: none;
  border: none;
  cursor: pointer;
}

.cart-item {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.cart-item-info {
  flex: 1;
}

.cart-item-name {
  font-size: 14px;
  font-weight: 500;
}

.cart-item-options {
  font-size: 12px;
  color: var(--text-lighter);
  margin-top: 2px;
}

.cart-item-price {
  font-size: 14px;
  font-weight: 500;
  color: var(--primary);
  margin-right: 12px;
}

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

.cart-qty-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-qty-num {
  font-size: 14px;
  font-weight: 500;
  min-width: 20px;
  text-align: center;
}

.cart-footer {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

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

.cart-total-label {
  font-size: 16px;
  color: var(--text);
}

.cart-total-price {
  font-size: 24px;
  font-weight: 600;
  color: var(--primary);
}

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

.cart-empty {
  text-align: center;
  padding: 40px 0;
  color: var(--text-lighter);
}

/* Orders Page */
.orders-page {
  padding: 16px;
}

.order-card {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

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

.order-no {
  font-size: 14px;
  color: var(--text-light);
}

.order-status {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 500;
}

.order-status.pending {
  background: #FFF7E6;
  color: var(--pending);
}

.order-status.accepted {
  background: #E6F7FF;
  color: var(--accepted);
}

.order-status.making {
  background: #F9F0FF;
  color: var(--making);
}

.order-status.served {
  background: #F6FFED;
  color: var(--done);
}

.order-status.cancelled {
  background: var(--bg);
  color: var(--cancelled);
}

.order-items {
  font-size: 14px;
  color: var(--text);
  margin-bottom: 12px;
}

.order-item-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
}

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

.order-total {
  font-size: 16px;
  font-weight: 600;
  color: var(--primary);
}

.order-time {
  font-size: 12px;
  color: var(--text-lighter);
}

.order-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
}

.order-action-btn {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.order-action-btn.danger {
  color: var(--danger);
  border-color: var(--danger);
}

.order-action-btn.primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Order Detail Page */
.detail-page {
  padding: 16px;
}

.detail-header {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.detail-table {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
}

.detail-status {
  display: inline-block;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 500;
}

.detail-time {
  font-size: 14px;
  color: var(--text-lighter);
  margin-top: 4px;
}

.detail-items {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.detail-items-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
}

.detail-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.detail-item:last-child {
  border-bottom: none;
}

.detail-item-name {
  font-size: 14px;
}

.detail-item-opts {
  font-size: 12px;
  color: var(--text-lighter);
}

.detail-item-price {
  font-size: 14px;
  color: var(--primary);
  font-weight: 500;
}

.detail-total {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.detail-total-label {
  font-size: 16px;
}

.detail-total-price {
  font-size: 24px;
  font-weight: 600;
  color: var(--primary);
}

.detail-actions {
  margin-top: 16px;
  display: flex;
  gap: 8px;
}

.detail-action-btn {
  flex: 1;
  padding: 14px;
  border-radius: 12px;
  font-size: 16px;
  cursor: pointer;
  border: none;
}

.detail-action-btn.danger {
  background: var(--bg-card);
  color: var(--danger);
  border: 1px solid var(--danger);
}

.detail-action-btn.primary {
  background: var(--primary);
  color: white;
}

/* Toast */
.toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(0,0,0,0.8);
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 3000;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* No Table Alert */
.no-table-alert {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 5000;
}

.no-table-alert-icon {
  font-size: 64px;
  margin-bottom: 16px;
}

.no-table-alert-text {
  font-size: 18px;
  color: var(--text-light);
  margin-bottom: 8px;
}

.no-table-alert-hint {
  font-size: 14px;
  color: var(--text-lighter);
}

/* Status Timeline */
.status-timeline {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 16px;
}

.timeline-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}

.timeline-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
}

.timeline-dot.active {
  background: var(--success);
}

.timeline-label {
  font-size: 14px;
  color: var(--text-light);
}

.timeline-time {
  font-size: 12px;
  color: var(--text-lighter);
  margin-left: auto;
}

/* Loading */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-lighter);
}

/* Navigation */
.nav-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 100;
}

.nav-item {
  flex: 1;
  padding: 12px;
  text-align: center;
  font-size: 12px;
  color: var(--text-lighter);
  text-decoration: none;
  cursor: pointer;
}

.nav-item.active {
  color: var(--primary);
}

.nav-item-icon {
  font-size: 20px;
  margin-bottom: 4px;
}
