/* ========================================
   全平台内容订阅 - 前端样式
   移动端优先，单 HTML SPA
   ======================================== */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --text-xs: 12px;
  --text-sm: 13px;
  --text-base: 14px;
  --text-lg: 16px;
  --text-xl: 18px;
  --bg: #f5f6fa;
  --card: #ffffff;
  --text: #2d3436;
  --text-secondary: #636e72;
  --border: #e8e8e8;
  --success: #00b894;
  --warning: #fdcb6e;
  --danger: #e17055;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --max-width: 480px;
  --tab-height: 56px;
  --bottom-safe: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; word-break: break-word; overflow-wrap: break-word; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--tab-height) + var(--bottom-safe));
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 16px 16px calc(var(--tab-height) + 20px);
  min-height: 100vh;
}

/* ===== Login Page ===== */
.login-page {
  max-width: 360px;
  margin: 40px auto 0;
  padding: 32px 24px;
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
  text-align: center;
}
.login-logo {
  font-size: 48px;
  margin-bottom: 8px;
  line-height: 1;
}
.login-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}
.login-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 28px;
  line-height: 1.4;
}
.login-page .form-group {
  text-align: left;
  margin-bottom: 14px;
}
.login-page .form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.login-page .form-group input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fafafa;
}
.login-page .form-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
  background: #fff;
}
.login-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 13px;
}
.login-link {
  color: var(--primary);
  text-decoration: none;
  cursor: pointer;
}
.login-link:hover { text-decoration: underline; }
.login-sep { color: var(--border); }
.login-trial {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 14px;
}

/* ===== Bottom Tab Bar ===== */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--tab-height) + var(--bottom-safe));
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 12px;
  padding: 6px 4px var(--bottom-safe);
  z-index: 50;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
}
.tab-item {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 12px;
  border: none;
  background: none;
  padding: 2px 0;
  transition: color 0.2s;
}
.tab-item .tab-icon { font-size: 18px; line-height: 1.2; }
.tab-item.active { color: var(--primary); font-weight: 500; }
.tab-item:active { opacity: 0.6; }
.version-tag {
  position: fixed;
  bottom: 2px;
  right: 8px;
  font-size: 12px;
  color: #bbb;
  z-index: 51;
  pointer-events: none;
  user-select: none;
}

/* ===== Header ===== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  margin-bottom: 16px;
}
.header h1 {
  font-size: 18px;
  font-weight: 600;
}
.header .user-info {
  font-size: 13px;
  color: var(--text-secondary);
}
.header .btn-logout {
  font-size: 12px;
  color: var(--danger);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  transition: opacity 0.2s;
}
.header .btn-logout:hover { opacity: 0.6; }

/* ===== Plan Badge ===== */
.plan-badge {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 10px;
  background: #eff6ff;
  color: var(--primary);
  font-weight: 500;
  white-space: nowrap;
}

/* ===== Buttons ===== */
.btn {
  display: block;
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37,99,235,0.3); }
.btn:active:not(:disabled) { transform: translateY(0); }

.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
}
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37,99,235,0.3); }
.btn-primary:active:not(:disabled) { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-outline {
  background: white;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); background: #eff6ff; }

.btn-secondary {
  background: #e0e0e0;
  color: var(--text);
}
.btn-secondary:hover:not(:disabled) { background: #d0d0d0; }

/* ===== Empty State ===== */
.empty-state { text-align: center; padding: 40px 20px; }
.empty-state .icon { font-size: 72px; margin-bottom: 12px; display: block; animation: float 3s ease-in-out infinite; }
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* ===== Forms ===== */
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-secondary);
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus {
  border-color: var(--primary);
}

/* ===== Cards ===== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 12px;
}
.card-question {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ===== Content Cards ===== */
.content-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 12px;
}

.content-card .platform-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 8px;
}
.tag-xhs { background: #fff0f3; color: #ff6b81; }
.tag-dy { background: #f0f8ff; color: #1e90ff; }
.tag-gzh { background: #f5f0ff; color: #7c3aed; }
.tag-pyq { background: #fffbeb; color: #d97706; }

/* ===== Product Badge ===== */
.product-badge {
  display: inline-block;
  font-size: 12px;
  padding: 2px 7px;
  border-radius: 4px;
  background: #e8f5e9;
  color: #2e7d32;
  margin-right: 4px;
  margin-bottom: 4px;
}
.product-badge.real-img {
  background: #fff3e0;
  color: #e65100;
}
.hot-badge {
  display: inline-block;
  font-size: 12px;
  padding: 2px 7px;
  border-radius: 4px;
  background: #fff3e0;
  color: #e65100;
  margin-left: 4px;
  margin-bottom: 4px;
  border: 1px solid #ffcc80;
}
.content-card h3 { font-size: 16px; margin-bottom: 8px; }
.content-card p { font-size: 14px; color: var(--text-secondary); margin-bottom: 8px; }
.content-card .tags { font-size: 12px; color: #999; }
.content-card .actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.content-card .actions button {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  font-size: 13px;
  cursor: pointer;
}
.content-card .cover-img {
  width: 100%;
  aspect-ratio: 3 / 4;
  max-height: 240px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 8px;
  background: #f0f4f8;
}

/* ===== Feedback Buttons ===== */
.feedback-row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.fb-btn {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
}
.fb-btn:active { transform: scale(0.88); }
.fb-btn.active-like {
  background: #e8f8f5;
  border-color: var(--success);
  box-shadow: 0 0 0 1px var(--success);
}
.fb-btn.active-dislike {
  background: #fce4e4;
  border-color: var(--danger);
  box-shadow: 0 0 0 1px var(--danger);
}

/* ===== Memory Panel ===== */
.memory-panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  overflow: hidden;
}
.memory-header {
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-size: 14px;
}
.memory-content {
  padding: 0 16px 16px;
  display: none;
}
.memory-content.open { display: block; }
.memory-tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
  margin: 2px;
}
.memory-tag.liked { background: #e8f8f5; color: var(--success); }
.memory-tag.disliked { background: #fce4e4; color: var(--danger); }

/* ===== Progress ===== */
.progress-bar {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin: 8px 0;
}
.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.3s;
}

/* ===== Error State ===== */
.error-state {
  text-align: center;
  padding: 40px 16px;
}
.error-state .icon { font-size: 36px; margin-bottom: 12px; }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-content {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  max-width: var(--max-width);
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
}
.modal-content h3 { margin-bottom: 12px; }
.modal-content .close-btn {
  float: right;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
}
/* 移动端弹窗溢出修复 */
@media (max-width: 420px) {
  .modal-content { max-width: 100% !important; padding: 16px; }
  .modal-content input, .modal-content select, .modal-content textarea { font-size: 14px; }
}

/* 卡片内文字和按钮溢出修复 */
.card, .content-card, .cat-card, .memory-panel { overflow-wrap: break-word; }
.cat-card button { white-space: nowrap; }
.form-group { overflow: hidden; }

/* ===== Pricing ===== */
.pricing-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}
.pricing-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  transition: all 0.25s ease;
}
.pricing-card:first-child { opacity: 0.8; }
.pricing-card:nth-child(2) {
  border: 2px solid var(--primary);
  box-shadow: 0 6px 24px rgba(37,99,235,0.15);
  transform: scale(1.02);
}
.pricing-card h3 { font-size: 18px; margin-bottom: 4px; font-weight: 600; }
.pricing-card .price { font-size: 28px; font-weight: 700; color: var(--text); }
.pricing-card .price span { font-size: 14px; color: var(--text-secondary); font-weight: 400; }
.pricing-card ul { list-style: none; margin: 12px 0; }
.pricing-card li { font-size: 14px; padding: 4px 0; color: var(--text-secondary); }

/* Feature comparison table */
.feature-table-wrap {
  margin-top: 20px;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #eee;
}
.feature-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.feature-table th {
  padding: 10px 12px;
  font-weight: 600;
  background: #f8f9ff;
  border-bottom: 1px solid #eee;
}
.feature-table th .th-sub { font-size: 11px; font-weight: 400; color: #999; display: block; margin-top: 2px; }
.feature-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #f0f0f0;
  text-align: center;
}
.feature-table td:first-child { text-align: left; color: #555; font-weight: 500; }
.feature-table tr:nth-child(even) { background: #fafbfc; }
.feature-table .cell-check { color: #00b894; font-weight: 600; }
.feature-table .cell-cross { color: #ccc; }

/* Subscribe page */
.sub-status-body {
  text-align: center;
  padding: 24px 20px;
  background: #fff;
  border-radius: 12px;
  margin-bottom: 16px;
  border: 1px solid #eee;
}
.sub-status-body .icon { font-size: 40px; margin-bottom: 8px; }
.sub-status-body h2 { font-size: 20px; margin-bottom: 6px; }
.sub-status-body p { font-size: 14px; color: var(--text-secondary); line-height: 1.6; }
.sub-account-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  color: #fff;
}
.sub-account-card .row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.sub-account-card h3 { margin: 0; font-size: 16px; color: #fff; }
.sub-account-card .status-badge {
  font-size: 12px; padding: 4px 12px; border-radius: 20px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 4px;
}
.sub-account-card .status-badge.trial { background: rgba(255,255,255,0.2); color: #fff; }
.sub-account-card .status-badge.active { background: #00b894; color: #fff; }
.sub-account-card .status-badge.free { background: rgba(255,255,255,0.15); color: #fff; }
.sub-account-card .status-badge.expired { background: rgba(255,255,255,0.15); color: rgba(255,255,255,0.6); }
.sub-account-card .info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font-size: 13px; opacity: 0.9; }
.sub-account-card .info-grid .label { opacity: 0.7; }
.sub-account-card .info-grid .value { font-weight: 500; }
.sub-account-card .sub-stats { margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,0.15); font-size: 13px; }
.sub-account-card .sub-stats .stat-row { margin-bottom: 4px; }
.sub-account-card .sub-stats .platform-icons { display: flex; gap: 8px; margin-top: 4px; }
.sub-account-card .sub-stats .platform-icons span {
  padding: 2px 10px; background: rgba(255,255,255,0.12); border-radius: 8px; font-size: 12px;
}

/* Payment section */
.payment-section {
  margin-top: 16px;
  background: #fafbfc;
  border-radius: 12px;
  padding: 16px;
  border: 1px solid #eee;
  text-align: center;
}
.payment-section h4 { font-size: 14px; margin-bottom: 10px; font-weight: 600; }
.payment-section .steps { font-size: 13px; color: var(--text-secondary); line-height: 1.8; margin-bottom: 12px; text-align: left; max-width: 260px; margin: 0 auto 12px; }
.payment-section .qr-row { display: flex; gap: 12px; justify-content: center; }
.payment-section .qr-box { background: #fff; border-radius: 10px; padding: 12px; width: 130px; text-align: center; border: 1px solid #eee; }
.payment-section .qr-box .label { font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.payment-section .qr-box .qr-placeholder { width: 110px; height: 110px; background: #f5f6fa; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #ccc; font-size: 11px; margin: 0 auto; }
.payment-section .hint { font-size: 11px; color: #bbb; margin-top: 8px; }

/* ===== Subscribe Page Visual Enhancement ===== */

/* Account card - override inline styles via !important */
#app > div > div[style*="background:#fff"]:first-child {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  border: none !important;
  color: #fff !important;
  box-shadow: 0 4px 20px rgba(102,126,234,0.25) !important;
}
/* Account card - header row */
#app > div > div[style*="background:#fff"]:first-child h3 { color: #fff !important; }
#app > div > div[style*="background:#fff"]:first-child > div:first-child span {
  background: rgba(255,255,255,0.2) !important;
  color: #fff !important;
  border-radius: 20px !important;
  padding: 4px 12px !important;
  font-size: 12px !important;
}
/* Account card - info text */
#app > div > div[style*="background:#fff"]:first-child > div:nth-child(2) {
  color: rgba(255,255,255,0.85) !important;
  line-height: 1.8 !important;
}
#app > div > div[style*="background:#fff"]:first-child > div:nth-child(2) span:first-child {
  display: inline-block;
  width: 70px;
  opacity: 0.7;
}

/* Pricing cards - 3-card visual hierarchy */
.pricing-cards { gap: 14px; }
.pricing-card { 
  border-radius: 14px; 
  position: relative;
  overflow: hidden;
}
/* Basic card - left accent bar */
.pricing-card:first-child::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  background: #b2bec3;
  border-radius: 0 2px 2px 0;
}
.pricing-card:first-child h3 { color: #636e72; }
.pricing-card:first-child .price { color: #636e72; }

/* Pro card - top accent bar + badge */
.pricing-card:nth-child(2) {
  border-color: var(--primary);
  box-shadow: 0 6px 24px rgba(37,99,235,0.15);
  transform: scale(1.02);
}
.pricing-card:nth-child(2)::before {
  content: '🔥 推荐';
  position: absolute;
  top: 12px; right: -28px;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  padding: 2px 32px;
  transform: rotate(45deg);
  font-weight: 500;
}

/* Flagship card - gold top border */
.pricing-card:nth-child(3) {
  border: 1px solid #f6d365;
}
.pricing-card:nth-child(3)::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, #f6d365, #fda085);
}
.pricing-card:nth-child(3) h3 { color: #d4a017; }
.pricing-card:nth-child(3) .price { color: #d4a017; }

/* Price number larger */
.pricing-card .price { font-size: 32px !important; font-weight: 800 !important; }
.pricing-card .price span { font-size: 14px !important; font-weight: 400 !important; color: #999 !important; }

/* Feature list items */
.pricing-card li { font-size: 13px; padding: 5px 0; }
.pricing-card li strong { color: var(--text); }

/* Payment section - override inline styles */
#app > div > div[style*="background:#f5f6fa"] {
  background: #fafbfc !important;
  border-radius: 14px !important;
  padding: 20px 16px !important;
  border: 1px solid #eee !important;
}
#app > div > div[style*="background:#f5f6fa"] p:first-child {
  font-size: 14px !important;
  font-weight: 600 !important;
  margin-bottom: 10px !important;
}
#app > div > div[style*="background:#f5f6fa"] p:nth-child(2) {
  font-size: 13px !important;
  color: var(--text-secondary) !important;
  line-height: 1.8 !important;
  margin-bottom: 12px !important;
  text-align: left !important;
  max-width: 260px !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

/* QR boxes in payment */
#app > div > div[style*="background:#f5f6fa"] a {
  text-decoration: none;
  display: inline-block;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  min-width: 110px;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.8);
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 200;
  animation: fadeIn 0.3s;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ===== Hidden ===== */
.hidden { display: none; }


/* ===== Generating State ===== */
.generating-state { text-align: center; padding: 48px 16px; }
.generating-icon { font-size: 48px; margin-bottom: 16px; animation: pulse 1.2s ease-in-out infinite; }
.generating-text { font-size: 15px; color: var(--text-secondary); margin-bottom: 16px; }
.generating-hint { font-size: 12px; color: #bbb; margin-top: 12px; }
.progress-track {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin: 0 auto;
  max-width: 240px;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #60a5fa);
  border-radius: 3px;
  width: 30%;
  animation: progress-indeterminate 1.5s ease-in-out infinite;
}
@keyframes progress-indeterminate {
  0% { width: 20%; margin-left: 0; }
  50% { width: 50%; margin-left: 30%; }
  100% { width: 20%; margin-left: 80%; }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}