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

:root {
  --primary: #ff2d51;
  --primary-dark: #d91a3c;
  --secondary: #6c5ce7;
  --success: #00b894;
  --warning: #fdcb6e;
  --danger: #d63031;
  --dark: #2d3436;
  --gray: #636e72;
  --light-gray: #b2bec3;
  --bg: #f5f6fa;
  --white: #ffffff;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 5px 20px rgba(0, 0, 0, 0.15);
  --radius: 12px;
  --radius-sm: 8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--dark);
  min-height: 100vh;
  line-height: 1.6;
}

.app {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 16px 24px;
}

/* ==================== 头部 ==================== */
.header {
  background: linear-gradient(135deg, var(--primary), #ff6b81);
  color: var(--white);
  padding: 24px 20px;
  margin: 0 -16px 20px;
  text-align: center;
}

.logo {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 4px;
}

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

.sync-status {
  margin-top: 10px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  font-size: 12px;
  display: inline-block;
}

.sync-status .sync-time {
  opacity: 0.95;
}

.sync-status.syncing {
  animation: pulse 1.5s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 0.7;
  }

  50% {
    opacity: 1;
  }
}

/* ==================== 导航标签 ==================== */
.tabs {
  display: flex;
  background: var(--white);
  border-radius: var(--radius);
  padding: 6px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.tab-btn {
  flex: 1;
  padding: 12px 8px;
  border: none;
  background: transparent;
  color: var(--gray);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.3s ease;
}

.tab-btn:hover {
  color: var(--primary);
  background: rgba(255, 45, 81, 0.05);
}

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

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ==================== 搜索框 ==================== */
.search-box {
  background: var(--white);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.search-row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.search-row input {
  flex: 1;
  padding: 14px 16px;
  border: 2px solid #e0e0e0;
  border-radius: var(--radius-sm);
  font-size: 16px;
  transition: border-color 0.3s;
}

.search-row input:focus {
  outline: none;
  border-color: var(--primary);
}

.search-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.search-options label {
  color: var(--gray);
  font-size: 14px;
}

.search-options select {
  padding: 8px 12px;
  border: 1px solid #e0e0e0;
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--white);
}

/* ==================== 按钮 ==================== */
.btn {
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.btn-success {
  background: var(--success);
  color: var(--white);
}

.btn-success:hover:not(:disabled) {
  background: #00a382;
}

.btn-success:disabled {
  background: var(--light-gray);
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--secondary);
  color: var(--white);
}

.btn-secondary:hover {
  background: #5b4cdb;
}

.btn-danger {
  background: var(--danger);
  color: var(--white);
}

.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
}

/* ==================== 商品列表 ==================== */
.goods-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.goods-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 14px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.goods-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.goods-image {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: #f0f0f0;
  flex-shrink: 0;
}

.goods-info {
  flex: 1;
  min-width: 0;
}

.goods-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.goods-brand {
  font-size: 13px;
  color: var(--gray);
  margin-bottom: 6px;
}

.goods-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.goods-price {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
}

.goods-time {
  font-size: 12px;
  color: var(--gray);
  background: var(--bg);
  padding: 4px 8px;
  border-radius: 4px;
}

/* ==================== SKU规格列表 ==================== */
.goods-sku-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #e8e8e8;
}

.sku-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, #f8f9ff, #f0f4ff);
  border: 1px solid #e0e8ff;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
}

.sku-name {
  color: var(--dark);
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sku-price {
  color: var(--primary);
  font-weight: 600;
  white-space: nowrap;
}

.sku-more {
  display: inline-flex;
  align-items: center;
  color: var(--secondary);
  font-size: 12px;
  padding: 4px 10px;
  background: rgba(108, 92, 231, 0.1);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.sku-more:hover {
  background: rgba(108, 92, 231, 0.2);
}

.sku-item.sku-hidden {
  display: none;
}

/* ==================== 监控列表 ==================== */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.section-header h2 {
  font-size: 18px;
  color: var(--dark);
}

/* 未来直播页面 header */
.upcoming-header {
  align-items: flex-start;
}

.upcoming-header .header-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.upcoming-header .header-left h2 {
  margin: 0;
}

.upcoming-header .header-left .stats-info {
  font-size: 13px;
  color: var(--gray);
}

.cart-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  background: linear-gradient(135deg, #ff6600, #ff8800);
  color: var(--white);
  text-decoration: none;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.cart-link:hover {
  background: linear-gradient(135deg, #ff8800, #ffaa00);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 102, 0, 0.3);
}

.monitor-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.monitor-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.monitor-card.monitor-expired {
  background: #fafafa;
  border: 1px dashed #ddd;
  opacity: 0.85;
}

.expired-badge {
  display: inline-block;
  background: #999;
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
}

.monitor-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.monitor-keyword {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
}

.monitor-actions button {
  margin-left: 8px;
}

.monitor-info {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--gray);
}

.monitor-matches {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed #e0e0e0;
}

.monitor-matches-title {
  font-size: 13px;
  color: var(--gray);
  margin-bottom: 8px;
}

.match-tag {
  display: inline-block;
  background: linear-gradient(135deg, var(--success), #00d9a5);
  color: var(--white);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  margin: 2px 4px 2px 0;
}

/* ==================== 空状态 ==================== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray);
}

.empty-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 12px;
}

.loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray);
}

.loading p {
  margin-top: 16px;
  font-size: 14px;
}

/* Loading Spinner */
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e0e0e0;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ==================== 弹窗 ==================== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 500px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  font-size: 24px;
  color: var(--gray);
  cursor: pointer;
}

/* ==================== 关注提示弹窗 ==================== */
.subscribe-modal {
  padding: 10px 0;
}

.subscribe-modal h3 {
  color: var(--primary);
}

.subscribe-modal img {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* ==================== Toast ==================== */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--dark);
  color: var(--white);
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 14px;
  z-index: 2000;
  box-shadow: var(--shadow-lg);
}

.toast.hidden {
  display: none;
}

.toast.success {
  background: var(--success);
}

.toast.error {
  background: var(--danger);
}

/* ==================== 统计信息 ==================== */
.stats-info {
  font-size: 13px;
  color: var(--gray);
}

/* ==================== 日期分组 ==================== */
.date-group {
  margin-bottom: 24px;
}

.date-group-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--secondary);
  margin-bottom: 12px;
  padding-left: 4px;
}

/* ==================== 添加监控框 ==================== */
.add-monitor-box {
  background: linear-gradient(135deg, #fff, #f8f9ff);
  border: 2px solid var(--secondary);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

.add-monitor-box h3 {
  font-size: 16px;
  color: var(--secondary);
  margin-bottom: 6px;
}

.add-monitor-box .hint {
  font-size: 13px;
  color: var(--gray);
  margin-bottom: 14px;
}

.add-monitor-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.add-monitor-row input {
  flex: 1;
  min-width: 200px;
  padding: 12px 16px;
  border: 2px solid #e0e0e0;
  border-radius: var(--radius-sm);
  font-size: 15px;
  transition: border-color 0.3s;
}

.add-monitor-row input:focus {
  outline: none;
  border-color: var(--secondary);
}

.add-monitor-row select {
  padding: 12px 14px;
  border: 2px solid #e0e0e0;
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--white);
}

/* ==================== 日期切换标签 ==================== */
.date-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
  padding: 12px 16px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
}

/* 吸顶效果 */
.date-tabs.sticky {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  max-width: 800px;
  margin: 0 auto;
  border-radius: 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

/* 吸顶时的占位符，防止内容跳动 */
.date-tabs-placeholder {
  display: none;
  height: 60px;
  margin-bottom: 16px;
}

.date-tabs-placeholder.visible {
  display: block;
}

.date-tab {
  padding: 10px 18px;
  background: var(--white);
  border: 2px solid #e0e0e0;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--gray);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.3s;
}

.date-tab:hover {
  border-color: var(--secondary);
  color: var(--secondary);
}

.date-tab.active {
  background: var(--secondary);
  border-color: var(--secondary);
  color: var(--white);
}

.date-tab .count {
  font-size: 12px;
  opacity: 0.8;
  margin-left: 4px;
}

/* ==================== 匹配时间信息 ==================== */
.match-time-info {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #fff3e0, #fff8e1);
  border: 1px solid #ffcc80;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-top: 8px;
  font-size: 13px;
}

.match-time-info .date {
  font-weight: 600;
  color: var(--warning);
}

.match-time-info .time {
  color: var(--dark);
}

/* ==================== 加购按钮 ==================== */
.btn-add-cart {
  width: 100%;
  margin-top: 10px;
  padding: 10px 16px;
  background: linear-gradient(135deg, #ff6600, #ff8800);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn-add-cart:hover {
  background: linear-gradient(135deg, #ff8800, #ffaa00);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 102, 0, 0.3);
}

.btn-add-cart:active {
  transform: translateY(0);
}

.btn-add-cart.copied {
  background: linear-gradient(135deg, var(--success), #00d9a5);
}

/* ==================== 回到顶部按钮 ==================== */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 20px;
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, var(--primary), #ff6b81);
  color: var(--white);
  border: none;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(255, 45, 81, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.3s ease;
  z-index: 999;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(255, 45, 81, 0.5);
}

.back-to-top:active {
  transform: translateY(0);
}

/* ==================== 用户区域 ==================== */
.header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.logo-area {
  text-align: left;
}

.user-area {
  flex-shrink: 0;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.2);
  padding: 6px 12px;
  border-radius: 20px;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.user-avatar-placeholder {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  font-size: 14px;
}

.user-name {
  font-size: 13px;
  max-width: 80px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-logout {
  background: rgba(255, 255, 255, 0.2) !important;
  color: white !important;
  padding: 4px 10px !important;
  font-size: 12px !important;
}

.btn-logout:hover {
  background: rgba(255, 255, 255, 0.3) !important;
}

.btn-login {
  background: rgba(255, 255, 255, 0.95) !important;
  color: var(--primary) !important;
  font-size: 13px !important;
  padding: 8px 16px !important;
}

.btn-login:hover {
  background: white !important;
}

/* ==================== 响应式 ==================== */
@media (max-width: 600px) {
  .search-row {
    flex-direction: column;
  }

  .search-options {
    flex-direction: column;
    align-items: stretch;
  }

  .goods-card {
    flex-direction: column;
  }

  .goods-image {
    width: 100%;
    height: 160px;
  }

  .tabs {
    flex-wrap: wrap;
  }

  .tab-btn {
    font-size: 13px;
    padding: 10px 6px;
  }
}