/* ===== 基础重置 ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #f5f6fa;
  color: #333;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 0 12px 24px;
}

/* ===== 头部 ===== */
.header {
  text-align: center;
  padding: 24px 0 16px;
}

.header h1 {
  font-size: 1.5rem;
  color: #2c3e50;
  font-weight: 700;
}

.subtitle {
  font-size: 0.85rem;
  color: #888;
  margin-top: 4px;
}

/* ===== 搜索框 ===== */
.search-box {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.search-box input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 20px;
  font-size: 0.9rem;
  outline: none;
  background: #fff;
  transition: border-color 0.2s;
}

.search-box input:focus {
  border-color: #3498db;
}

.search-box button {
  width: 40px;
  height: 40px;
  border: none;
  background: #3498db;
  color: #fff;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== 商家标签 ===== */
.shop-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 16px;
  scrollbar-width: none;
}

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

.shop-tab {
  flex-shrink: 0;
  padding: 6px 16px;
  border: 1px solid #e0e0e0;
  background: #fff;
  border-radius: 16px;
  font-size: 0.85rem;
  color: #666;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.shop-tab.active {
  background: #3498db;
  color: #fff;
  border-color: #3498db;
}

/* ===== 商品卡片 ===== */
.products-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.product-card {
  background: #fff;
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
}

.product-card:active {
  transform: scale(0.97);
}

.product-card .icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

.product-card .name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #333;
  line-height: 1.3;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card .desc {
  font-size: 0.75rem;
  color: #999;
  margin-bottom: 8px;
}

.product-card .price-row {
  margin-top: auto;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.product-card .price {
  font-size: 1.1rem;
  font-weight: 700;
  color: #e74c3c;
}

.product-card .original-price {
  font-size: 0.75rem;
  color: #bbb;
  text-decoration: line-through;
}

/* ===== 空状态 ===== */
.empty-state {
  text-align: center;
  padding: 48px 0;
  color: #999;
}

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

/* ===== 页脚 ===== */
.footer {
  text-align: center;
  padding: 24px 0;
  font-size: 0.75rem;
  color: #bbb;
}

/* ===== 弹窗 ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s;
}

.modal {
  background: #fff;
  width: 100%;
  max-width: 600px;
  border-radius: 20px 20px 0 0;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s;
}

.modal-small {
  border-radius: 16px;
  margin: auto 20px;
  max-height: none;
  padding: 24px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #f0f0f0;
}

.modal-header h3 {
  font-size: 1.1rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #999;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-body {
  padding: 20px;
}

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

.modal-footer {
  padding: 0 20px 20px;
}

/* ===== 商品信息 ===== */
.product-info {
  display: flex;
  gap: 14px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f5f5f5;
}

.product-icon {
  font-size: 2.5rem;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8f9fa;
  border-radius: 12px;
  flex-shrink: 0;
}

.product-detail {
  flex: 1;
}

.product-name {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.product-price .price {
  font-size: 1.3rem;
  font-weight: 700;
  color: #e74c3c;
}

.product-price .original-price {
  font-size: 0.8rem;
  color: #bbb;
  text-decoration: line-through;
  margin-left: 6px;
}

/* ===== 表单 ===== */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 6px;
}

.form-group input[type="text"] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #ddd;
  border-radius: 10px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input[type="text"]:focus {
  border-color: #3498db;
}

.form-tip {
  font-size: 0.75rem;
  color: #e67e22;
  margin-top: 4px;
}

/* ===== 数量选择器 ===== */
.quantity-selector {
  display: inline-flex;
  align-items: center;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
}

.qty-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: #f5f5f5;
  font-size: 1.2rem;
  color: #666;
  cursor: pointer;
}

.quantity-selector input {
  width: 50px;
  height: 36px;
  border: none;
  text-align: center;
  font-size: 1rem;
  outline: none;
}

/* ===== 合计 ===== */
.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 16px;
  border-top: 1px solid #f5f5f5;
  font-size: 1rem;
}

.total-price {
  font-size: 1.4rem;
  font-weight: 700;
  color: #e74c3c;
}

/* ===== 按钮 ===== */
.btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn:active {
  opacity: 0.85;
}

.btn-primary {
  background: #07c160;
  color: #fff;
}

/* ===== 支付提示 ===== */
.loading-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  animation: pulse 1.5s infinite;
}

.result-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

/* ===== 动画 ===== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* ===== 响应式 ===== */
@media (min-width: 480px) {
  .products-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
