/* 全局样式 */
* {
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 自定义滚动条 */
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 2px;
}

/* Toast 样式 */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 12px 24px;
  border-radius: 10px;
  color: white;
  font-size: 14px;
  z-index: 99999;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  transition: opacity 0.3s ease;
  max-width: 80%;
  text-align: center;
  line-height: 1.5;
}

.toast.success {
  background: rgba(22, 163, 74, 0.95);
}

.toast.error {
  background: rgba(220, 38, 38, 0.95);
}

.toast.info {
  background: rgba(37, 99, 235, 0.95);
}

.toast.show {
  opacity: 1;
}

.toast.hide {
  opacity: 0;
}

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

.animate-fadeIn {
  animation: fadeIn 0.3s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-slideUp {
  animation: slideUp 0.3s ease;
}

/* 页面过渡 */
.page-enter {
  animation: fadeIn 0.3s ease;
}

/* 卡片样式 */
.card {
  background: white;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

/* 按钮样式 */
.btn-primary {
  background: linear-gradient(135deg, #e94560 0%, #c23352 100%);
  color: white;
  border-radius: 24px;
  padding: 12px 32px;
  font-weight: 600;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(233, 69, 96, 0.3);
}

.btn-primary:active {
  transform: scale(0.98);
  box-shadow: 0 2px 6px rgba(233, 69, 96, 0.3);
}

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

/* 输入框样式 */
.input-field {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  font-size: 16px;
  transition: border-color 0.2s ease;
  background: #f9fafb;
}

.input-field:focus {
  outline: none;
  border-color: #e94560;
  background: white;
}

/* 商品卡片 */
.product-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

/* 标签样式 */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
}

.tag-primary {
  background: #e94560;
  color: white;
}

.tag-secondary {
  background: #f3f4f6;
  color: #6b7280;
}

/* 导航栏 */
.nav-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: white;
  border-bottom: 1px solid #f3f4f6;
}

/* 底部按钮 */
.bottom-btn {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 750px;
  padding: 12px 16px;
  background: white;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
  z-index: 100;
}

/* 价格样式 */
.price-free {
  color: #e94560;
  font-weight: 700;
}

.price-origin {
  color: #9ca3af;
  text-decoration: line-through;
  font-size: 12px;
}

/* 加载动画 */
.loading-dots {
  display: inline-flex;
  gap: 4px;
}

.loading-dots::after {
  content: '';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%, 20% { content: ''; }
  40% { content: '.'; }
  60% { content: '..'; }
  80%, 100% { content: '...'; }
}

/* 隐藏滚动条但保留滚动功能 */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}

.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* 售罄样式 - 参考3.0版本 */
.product-item.sell-out .sold-out-img {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0.8;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  z-index: 10;
}

.product-item.sell-out {
  position: relative;
}

.product-item.sell-out img:first-child {
  filter: grayscale(60%) brightness(0.7);
}

.product-item.sell-out .product-info,
.product-item.sell-out h3,
.product-item.sell-out p {
  color: #999 !important;
}

/* 售罄按钮样式 */
.btn-sold-out {
  background: #ccc !important;
  color: #fff !important;
  cursor: not-allowed !important;
  pointer-events: none;
}
