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

html {
  overflow-y: scroll;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f7fa;
  color: #333;
  line-height: 1.6;
}

/* 顶部导航 */
.header {
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header .logo {
  font-size: 18px;
  font-weight: 600;
  color: #1a73e8;
  flex: 1;
}

.header nav {
  flex: 0 0 auto;
  display: flex;
  gap: 4px;
}

.header nav a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  padding: 6px 16px;
  color: #555;
  text-decoration: none;
  font-size: 14px;
  border-radius: 4px;
  transition: color .15s, background .15s;
}

.header nav a:hover {
  color: #1a73e8;
  background: #f0f5ff;
}

.header nav a.active {
  color: #1a73e8;
  font-weight: 600;
  background: #e6f0ff;
}

#auth-status {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: flex-end;
}

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

.auth-avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1a73e8;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

.auth-user-link {
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: #333;
}

.auth-username {
  font-size: 14px;
}

.auth-login-btn,
.auth-logout-btn {
  padding: 6px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}

.auth-login-btn {
  background: #1a73e8;
  color: #fff;
}

.auth-logout-btn {
  background: #f0f0f0;
  color: #666;
}

/* 主内容区 */
.container {
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 16px;
}

/* 内容卡片（文章/报告） */
.content-section {
  margin-bottom: 32px;
}

.content-section h2 {
  font-size: 20px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid #1a73e8;
}

.article-card {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.article-card h3 {
  font-size: 16px;
  margin-bottom: 8px;
}

.article-card .article-content {
  font-size: 14px;
  color: #555;
  margin-bottom: 12px;
  white-space: pre-wrap;
}

.article-card .locked-content {
  color: #999;
  font-style: italic;
}

.article-card .unlock-btn {
  display: inline-block;
  padding: 6px 14px;
  background: #ff6b35;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}

.article-card .unlock-btn:hover {
  background: #e55a2b;
}

.renew-btn {
  display: inline-block;
  padding: 6px 14px;
  background: #1a73e8;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}

.renew-btn:hover {
  background: #1557b0;
}

/* 商品区域 */
.products-section {
  margin-bottom: 32px;
}

.products-section h2 {
  font-size: 20px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid #1a73e8;
}

.product-group {
  margin-bottom: 20px;
  background: #fff;
  border-radius: 10px;
  padding: 16px 20px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.product-group h3 {
  font-size: 15px;
  color: #333;
  margin: 0 0 12px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.group-subtitle {
  font-size: 12px;
  color: #999;
  font-weight: 400;
}

.product-subgroup {
  margin-bottom: 12px;
}

.product-subgroup h4 {
  font-size: 13px;
  color: #888;
  margin: 6px 0;
  padding-left: 4px;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.product-card {
  background: #f9fafb;
  border: 1px solid #eef0f2;
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  transition: box-shadow .2s, transform .2s, border-color .2s;
}

.product-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
  border-color: #d0d7de;
}

.product-card.owned-card {
  background: #f0fdf4;
  border-color: #86efac;
}

.product-card.owned-card:hover {
  border-color: #4ade80;
}

.product-card.expired-card {
  background: #fefce8;
  border-color: #fde047;
}

.product-card.expired-card:hover {
  border-color: #facc15;
}

.owned-badge {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  background: #dcfce7;
  color: #16a34a;
  font-weight: 600;
}

.product-card .buy-btn.owned-btn {
  background: #16a34a;
}

.product-card .buy-btn.owned-btn:hover {
  background: #15803d;
}

.expired-badge {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  background: #fef9c3;
  color: #a16207;
  font-weight: 600;
}

.purchased-badge {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  background: #dcfce7;
  color: #16a34a;
  font-weight: 600;
}

.product-card.purchased-card {
  background: #f0fdf4;
  border-color: #86efac;
}

.product-card.purchased-card:hover {
  border-color: #4ade80;
}

.product-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 2px;
}

.product-type-badge {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
}

.product-type-badge.type-1 {
  background: #e6f4ff;
  color: #1677ff;
}

.product-type-badge.type-2 {
  background: #fff7e6;
  color: #d46b08;
}

.product-type-badge.type-3 {
  background: #f6ffed;
  color: #389e0d;
}

.product-type-badge.type-4 {
  background: #f9f0ff;
  color: #722ed1;
}

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

.product-card .product-desc {
  font-size: 12px;
  color: #777;
  flex: 1;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-price-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 8px;
}

.product-card .product-price {
  font-size: 18px;
  color: #e53935;
  font-weight: 700;
}

.product-extra {
  font-size: 11px;
  color: #999;
}

/* 订阅产品权益 */
.product-benefits {
  margin-bottom: 8px;
}

.benefits-title {
  font-size: 10px;
  color: #999;
  margin-bottom: 3px;
}

.benefits-list {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.benefit-item {
  display: inline-block;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #c8e6c9;
}

.product-gifts {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 8px;
}

.gift-tag {
  display: inline-block;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  background: #fff8e1;
  color: #f57c00;
  border: 1px solid #ffe082;
}

.product-card .buy-btn {
  padding: 6px 0;
  background: #1a73e8;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  text-align: center;
}

.product-card .buy-btn:hover {
  background: #1557b0;
}

/* 权益状态 */
.status-section {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 32px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.status-section h2 {
  font-size: 18px;
  margin-bottom: 16px;
}

.status-item {
  display: flex;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
}

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

.status-label {
  font-size: 14px;
  color: #666;
  width: 100px;
}

.status-value {
  font-size: 14px;
  font-weight: 500;
}

.status-value.active {
  color: #4caf50;
}

.status-value.inactive {
  color: #999;
}

/* 订单页面 */
.filter-bar {
  margin-bottom: 16px;
  display: flex;
  gap: 8px;
}

.filter-bar button {
  padding: 6px 14px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
}

.filter-bar button.active {
  background: #1a73e8;
  color: #fff;
  border-color: #1a73e8;
}

.order-table {
  width: 100%;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.order-table table {
  width: 100%;
  border-collapse: collapse;
}

.order-table th,
.order-table td {
  padding: 12px 16px;
  text-align: left;
  font-size: 13px;
  border-bottom: 1px solid #f0f0f0;
}

.order-table th {
  background: #fafafa;
  font-weight: 600;
  color: #555;
}

.product-link {
  color: #1a73e8;
  text-decoration: none;
}

.product-link:hover {
  text-decoration: underline;
}

.order-status-paid {
  color: #4caf50;
}

.order-status-pending {
  color: #ff9800;
}

.order-status-closed {
  color: #999;
}

.btn-continue-pay {
  display: inline-block;
  padding: 4px 12px;
  font-size: 13px;
  color: #fff;
  background: #f97316;
  border-radius: 4px;
  text-decoration: none;
  white-space: nowrap;
  transition: background .2s;
}
.btn-continue-pay:hover {
  background: #ea580c;
}
.btn-cancel-order {
  display: inline-block;
  padding: 4px 12px;
  font-size: 13px;
  color: #fff;
  background: #6b7280;
  border-radius: 4px;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background .2s;
}
.btn-cancel-order:hover {
  background: #4b5563;
}

/* 提示信息 */
.tip {
  text-align: center;
  color: #999;
  padding: 40px;
  font-size: 14px;
}

/* 科技感加载动画 */
.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
}
.loading-spinner .spinner {
  width: 40px;
  height: 40px;
  position: relative;
  margin-bottom: 16px;
}
.loading-spinner .spinner::before,
.loading-spinner .spinner::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid transparent;
}
.loading-spinner .spinner::before {
  border-top-color: #1a73e8;
  border-right-color: #1a73e8;
  animation: spin-outer 1s linear infinite;
}
.loading-spinner .spinner::after {
  inset: 6px;
  border-bottom-color: #64b5f6;
  border-left-color: #64b5f6;
  animation: spin-inner 0.8s linear infinite reverse;
}
.loading-spinner .loading-text {
  font-size: 13px;
  color: #888;
  letter-spacing: 1px;
}
.loading-spinner .loading-dots::after {
  content: '';
  animation: dots 1.4s steps(4, end) infinite;
}
@keyframes spin-outer {
  to { transform: rotate(360deg); }
}
@keyframes spin-inner {
  to { transform: rotate(360deg); }
}
@keyframes dots {
  0%  { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
}

/* ─── 统一弹窗 ─── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,.4);
  justify-content: center;
  align-items: center;
}
.modal-overlay.modal-visible {
  display: flex;
}
.modal-box {
  background: #fff;
  border-radius: 12px;
  padding: 32px 28px 24px;
  min-width: 320px;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  animation: modal-in .2s ease;
}
@keyframes modal-in {
  from { opacity: 0; transform: scale(.92); }
  to   { opacity: 1; transform: scale(1); }
}
.modal-icon {
  margin-bottom: 16px;
}
.modal-body {
  font-size: 15px;
  color: #333;
  line-height: 1.6;
  margin-bottom: 24px;
  word-break: break-word;
}
.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.modal-btn {
  padding: 8px 28px;
  font-size: 14px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background .2s;
}
.modal-btn-primary {
  color: #fff;
  background: #1a73e8;
}
.modal-btn-primary:hover {
  background: #1557b0;
}
.modal-btn-cancel {
  color: #555;
  background: #f0f0f0;
}
.modal-btn-cancel:hover {
  background: #e0e0e0;
}

/* ─── H5 移动端适配 ─── */
@media (max-width: 768px) {
  /* 顶部导航 */
  .header {
    padding: 10px 12px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .header .logo {
    font-size: 16px;
    flex: 0 0 auto;
  }
  .header nav {
    order: 3;
    width: 100%;
    justify-content: center;
    gap: 2px;
    border-top: 1px solid #f0f0f0;
    padding-top: 8px;
  }
  .header nav a {
    font-size: 12px;
    min-width: auto;
    padding: 5px 10px;
  }
  #auth-status {
    flex: 0 0 auto;
  }
  .auth-login-btn,
  .auth-logout-btn {
    padding: 5px 10px;
    font-size: 12px;
  }
  .auth-username {
    font-size: 12px;
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* 主内容区 */
  .container {
    margin: 12px auto;
    padding: 0 10px;
  }

  /* 商品网格：小屏单列 */
  .product-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .product-group {
    padding: 12px 14px;
  }

  /* 内容卡片 */
  .article-card {
    padding: 14px;
  }
  .content-section h2,
  .products-section h2 {
    font-size: 17px;
  }

  /* 订单表格转为卡片布局 */
  .order-table table,
  .order-table thead,
  .order-table tbody,
  .order-table th,
  .order-table td,
  .order-table tr {
    display: block;
  }
  .order-table thead {
    display: none;
  }
  .order-table tr {
    margin-bottom: 12px;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 12px;
    background: #fff;
  }
  .order-table td {
    padding: 4px 0;
    border-bottom: none;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .order-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #555;
    margin-right: 8px;
    flex-shrink: 0;
  }

  /* 筛选栏 */
  .filter-bar {
    flex-wrap: wrap;
  }
  .filter-bar button {
    font-size: 12px;
    padding: 5px 10px;
  }

  /* 权益状态区 */
  .status-section {
    padding: 14px;
  }
  .status-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
  .status-label {
    width: auto;
    font-size: 12px;
  }

  /* 弹窗适配 */
  .modal-box {
    min-width: auto;
    width: calc(100vw - 40px);
    max-width: 360px;
    padding: 24px 20px 20px;
  }
}
