/* 全局样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Open Sans', 'Segoe UI', Roboto, sans-serif;
  color: #2c3e50;
  background: linear-gradient(135deg, #f5f7fa 0%, #e9edf5 100%);
  min-height: 100vh;
  padding: 15px;
}

.main {
  max-width: 990px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.title {
  padding: 20px;
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  letter-spacing: 1px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.box {
  margin: 24px;
  padding: 20px;
  background: white;
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
  transition: transform 0.2s ease;
}

.box:hover {
  transform: translateY(-2px);
}

.tit {
  position: relative;
  margin: 0 0 24px 0;
  font-weight: 600;
  padding-left: 16px;
  font-size: 18px;
  color: #2c3e50;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tit:before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 24px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.tit i {
  font-size: 13px;
  font-weight: 400;
  color: #95a5a6;
  font-style: normal;
  background: #f8f9fa;
  padding: 4px 12px;
  border-radius: 20px;
}

/* 公告栏 */
.announcement {
  background: linear-gradient(135deg, #fff6e0, #ffefd0);
  border-left: 4px solid #f39c12;
  margin-top: 16px;
  padding: 12px 20px;
}

.announcement-content {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #e67e22;
  font-weight: 500;
}

.announcement-tag {
  background: #f39c12;
  color: white;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* 商品列表 */
.item-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.item-list.loading {
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #95a5a6;
}

.loading-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 10px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.item {
  padding: 16px;
  border: 2px solid #f1f4fb;
  background: white;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
  position: relative;
  overflow: hidden;
}

.item:before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #667eea, #764ba2);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.item:hover {
  transform: translateY(-4px);
  border-color: #667eea;
  box-shadow: 0 12px 24px rgba(102, 126, 234, 0.15);
}

.item:hover:before {
  opacity: 1;
}

.item.checked {
  border-color: #667eea;
  background: linear-gradient(135deg, #f5f7ff, #ffffff);
}

.item .name {
  font-size: 20px;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 8px;
}

.item .money {
  font-size: 24px;
  color: #667eea;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
}

.item .money:after {
  content: '元';
  font-size: 14px;
  color: #95a5a6;
  font-weight: 400;
}

/* 输入框 */
.input-wrapper {
  position: relative;
}

.input-wrapper input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border: 2px solid #eef2f6;
  background: white;
  border-radius: 12px;
  color: #2c3e50;
  font-size: 15px;
  outline: none;
  transition: all 0.3s ease;
}

.input-wrapper input:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.input-hint {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: #95a5a6;
  background: #f8f9fa;
  padding: 2px 8px;
  border-radius: 12px;
}

/* 支付区域 */
.pay-area {
  margin: 24px;
  padding: 24px;
  background: linear-gradient(135deg, #f8faff, #ffffff);
  border-radius: 20px;
  border: 2px solid #eef2f6;
}

.goods-info {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 2px dashed #eef2f6;
}

.goods-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #667eea10, #764ba210);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.goods-detail {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.goods-name {
  font-size: 18px;
  font-weight: 600;
  color: #2c3e50;
}

.goods-price {
  font-size: 24px;
  font-weight: 700;
  color: #e74c3c;
}

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

.quantity-label {
  font-weight: 500;
  color: #7f8c8d;
}

.quantity-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quantity-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: #f8f9fa;
  border-radius: 12px;
  font-size: 20px;
  font-weight: 600;
  color: #667eea;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.quantity-btn:hover:not(:disabled) {
  background: #667eea;
  color: white;
  transform: scale(1.1);
}

.quantity-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.quantity-input {
  width: 70px;
  height: 40px;
  text-align: center;
  border: 2px solid #eef2f6;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 600;
  color: #2c3e50;
  outline: none;
  -moz-appearance: textfield;
}

.quantity-input::-webkit-outer-spin-button,
.quantity-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.amount-display {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  margin-bottom: 24px;
  padding: 16px;
  background: #f8faff;
  border-radius: 12px;
}

.amount-label {
  font-size: 16px;
  color: #7f8c8d;
}

.amount-value {
  font-size: 32px;
  font-weight: 700;
  color: #e74c3c;
}

.pay-button {
  width: 100%;
  height: 56px;
  border: none;
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-radius: 16px;
  font-size: 18px;
  font-weight: 600;
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 8px 16px rgba(102, 126, 234, 0.3);
}

.pay-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(102, 126, 234, 0.4);
}

.pay-button:active {
  transform: translateY(0);
}

.button-icon {
  transition: transform 0.3s ease;
}

.pay-button:hover .button-icon {
  transform: translateX(4px);
}

/* 安全提示 */
.security-note {
  text-align: center;
  padding: 16px 24px 24px;
  color: #95a5a6;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-top: 1px solid #eef2f6;
}

/* 响应式设计 */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }
  
  .box {
    margin: 16px;
    padding: 16px;
  }
  
  .pay-area {
    margin: 16px;
    padding: 16px;
  }
  
  .goods-detail {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  
  .item-list {
    grid-template-columns: 1fr;
  }
  
  .amount-value {
    font-size: 28px;
  }
  
  .tit i {
    display: none;
  }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
  body {
    background: linear-gradient(135deg, #1a1e2c, #2d3349);
  }
  
  .main {
    background: rgba(40, 44, 62, 0.98);
  }
  
  .box, .pay-area {
    background: #2d3349;
  }
  
  .tit, .goods-name, .quantity-label, .amount-label {
    color: #ecf0f1;
  }
  
  .item {
    background: #353b50;
    border-color: #40465c;
  }
  
  .item .name {
    color: #ecf0f1;
  }
  
  .input-wrapper input,
  .quantity-input {
    background: #353b50;
    border-color: #40465c;
    color: #ecf0f1;
  }
  
  .security-note {
    color: #7f8c8d;
    border-top-color: #40465c;
  }
}
/* 加载状态 */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #95a5a6;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

.loading-spinner-small {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
    margin-right: 6px;
}

/* 错误状态 */
.error-state {
    text-align: center;
    padding: 40px 20px;
    color: #e74c3c;
}

.error-state svg {
    margin-bottom: 10px;
}

.error-state p {
    margin-bottom: 15px;
    color: #7f8c8d;
}

.retry-btn {
    padding: 8px 24px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.retry-btn:hover {
    background: #764ba2;
    transform: translateY(-2px);
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #95a5a6;
}

.empty-state svg {
    margin-bottom: 10px;
    opacity: 0.5;
}

.empty-state p {
    color: #7f8c8d;
}

/* 商品价格显示 */
.item .money {
    font-size: 24px;
    color: #667eea;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 4px;
}

.item .money:before {
    content: '￥';
    font-size: 16px;
    color: #95a5a6;
}

/* 商品名称显示 */
.goods-price {
    font-size: 24px;
    font-weight: 700;
    color: #e74c3c;
}

.goods-price:before {
    content: '￥';
    font-size: 16px;
    margin-right: 2px;
}

/* 输入框错误状态 */
.input-wrapper input.error {
    border-color: #e74c3c;
    background: #fff5f5;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
/* 加载状态（确保存在） */
.loading-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: #95a5a6;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 10px;
}

.loading-spinner-small {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
  margin-right: 6px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 空状态和错误状态 */
.empty-state, .error-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
}

.empty-state {
  color: #95a5a6;
}

.error-state {
  color: #e74c3c;
}

.retry-btn {
  margin-top: 15px;
  padding: 8px 24px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s ease;
}

.retry-btn:hover {
  background: #764ba2;
  transform: translateY(-2px);
}
/* 在 style.css 中添加 */
.tit i.required {
  background: #e74c3c;
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  margin-left: 10px;
}

.input-tip {
  margin-top: 8px;
  font-size: 12px;
  color: #e74c3c;
  padding-left: 5px;
}

.input-wrapper input:invalid {
  border-color: #ff6b6b;
}

.input-wrapper input:focus:invalid {
  border-color: #ff6b6b;
  box-shadow: 0 0 0 4px rgba(231, 76, 60, 0.1);
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
  .input-tip {
    color: #ff9999;
  }
}
/* 必填项样式 */
.tit i.required {
  background: #e74c3c;
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  margin-left: 10px;
}

.input-tip {
  margin-top: 8px;
  font-size: 12px;
  color: #e74c3c;
  padding-left: 5px;
}

.input-wrapper input.error {
  border-color: #e74c3c;
  background: #fff5f5;
}

.input-wrapper input:invalid {
  border-color: #ff6b6b;
}

.input-wrapper input:focus:invalid {
  border-color: #ff6b6b;
  box-shadow: 0 0 0 4px rgba(231, 76, 60, 0.1);
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
  .input-tip {
    color: #ff9999;
  }
  
  .input-wrapper input.error {
    border-color: #e74c3c;
    background: #3d2a2a;
  }
}
/* 查询链接样式 */
.query-link {
  display: inline-flex;
  align-items: center;
  color: #95a5a6;
  text-decoration: none;
  font-size: 13px;
  transition: all 0.3s ease;
  padding: 8px 16px;
  border-radius: 20px;
  background: #f8f9fa;
}

.query-link:hover {
  color: #667eea;
  background: #eef2f6;
  transform: translateY(-2px);
}