/* ============================================================
   Resource Site - 前台样式
   设计风格：简洁现代，深色主题，移动优先
   ============================================================ */

/* CSS Variables */
:root {
  --primary: #4f6ef7;
  --primary-dark: #3a56d4;
  --primary-light: #eef0ff;
  --accent: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --bg: #0f1117;
  --bg2: #1a1d2e;
  --bg3: #252840;
  --card: #1e2136;
  --border: rgba(255,255,255,0.08);
  --text: #e8eaf6;
  --text2: #9ca3af;
  --text3: #6b7280;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --font: 'PingFang SC','Microsoft YaHei','Segoe UI',sans-serif;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; transition: color .2s; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; display: block; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

/* ── Layout ── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.container-sm { max-width: 640px; margin: 0 auto; padding: 0 16px; }

/* ── Header ── */
.site-header {
  background: rgba(15,17,23,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.header-inner {
  display: flex; align-items: center; gap: 12px;
  height: 60px;
}
.site-logo {
  font-size: 1.25rem; font-weight: 700;
  color: var(--text) !important;
  white-space: nowrap;
}
.site-logo span { color: var(--primary); }
.header-search {
  flex: 1; max-width: 400px;
  display: flex; align-items: center;
  background: var(--bg3); border-radius: 8px;
  border: 1px solid var(--border); overflow: hidden;
}
.header-search input {
  flex: 1; padding: 8px 12px;
  background: transparent; border: none; outline: none;
  color: var(--text);
}
.header-search button {
  padding: 8px 14px; background: var(--primary);
  border: none; cursor: pointer; color: #fff;
  transition: background .2s;
}
.header-search button:hover { background: var(--primary-dark); }
.header-nav { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.btn-ghost {
  padding: 7px 16px; border-radius: 8px;
  border: 1px solid var(--border); background: transparent;
  color: var(--text2); cursor: pointer; transition: all .2s;
  white-space: nowrap;
}
.btn-ghost:hover { background: var(--bg3); color: var(--text); }
.btn-primary {
  padding: 7px 16px; border-radius: 8px;
  background: var(--primary); border: none;
  color: #fff; cursor: pointer; font-weight: 500;
  transition: background .2s; white-space: nowrap;
}
.btn-primary:hover { background: var(--primary-dark); }
.user-menu { position: relative; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary); display: flex; align-items: center;
  justify-content: center; font-weight: 600; font-size: 0.9rem;
  cursor: pointer; border: 2px solid var(--border);
  color: #fff;
}
.dropdown {
  position: absolute; right: 0; top: calc(100% + 8px);
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); min-width: 160px;
  box-shadow: var(--shadow); display: none; z-index: 200;
}
.dropdown.open { display: block; }
.dropdown a, .dropdown button {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; color: var(--text2);
  background: none; border: none; width: 100%;
  text-align: left; cursor: pointer; font-size: 0.9rem;
  transition: all .15s;
}
.dropdown a:hover, .dropdown button:hover {
  background: var(--bg3); color: var(--text);
}
.dropdown hr { border-color: var(--border); margin: 4px 0; }

/* Mobile menu toggle */
.menu-toggle {
  display: none; background: none; border: none;
  color: var(--text); cursor: pointer; padding: 6px;
  flex-direction: column; gap: 5px;
}
.menu-toggle span {
  display: block; width: 22px; height: 2px;
  background: var(--text); transition: all .3s; border-radius: 2px;
}

/* ── Hero / Banner ── */
.hero {
  background: linear-gradient(135deg, var(--bg2) 0%, var(--bg3) 100%);
  padding: 48px 16px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.hero h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); font-weight: 700; margin-bottom: 12px; }
.hero p { color: var(--text2); font-size: 1rem; margin-bottom: 24px; }

/* ── Category Filter ── */
.category-bar {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}
.cat-btn {
  padding: 6px 16px; border-radius: 20px;
  border: 1px solid var(--border); background: transparent;
  color: var(--text2); cursor: pointer; font-size: 0.875rem;
  transition: all .2s; white-space: nowrap;
}
.cat-btn:hover, .cat-btn.active {
  background: var(--primary); border-color: var(--primary);
  color: #fff;
}

/* ── Resource Grid ── */
.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  padding: 24px 0;
}
.resource-card {
  background: var(--card); border-radius: var(--radius);
  border: 1px solid var(--border); overflow: hidden;
  transition: transform .2s, box-shadow .2s;
  cursor: pointer;
  display: flex; flex-direction: column;
}
.resource-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(79,110,247,0.15);
  border-color: rgba(79,110,247,0.3);
}
.card-cover {
  width: 100%; aspect-ratio: 16/9;
  object-fit: cover; background: var(--bg3);
  display: flex; align-items: center; justify-content: center;
  color: var(--text3); font-size: 2rem;
}
.card-cover img { width: 100%; height: 100%; object-fit: cover; }
.card-cover-placeholder {
  width: 100%; aspect-ratio: 16/9;
  background: linear-gradient(135deg, var(--bg2), var(--bg3));
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem;
}
.card-body { padding: 16px; flex: 1; display: flex; flex-direction: column; }
.card-title {
  font-size: 0.95rem; font-weight: 600;
  color: var(--text); margin-bottom: 8px;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.card-desc {
  font-size: 0.8rem; color: var(--text3);
  flex: 1; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  margin-bottom: 12px;
}
.card-meta {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: auto;
}
.badge {
  padding: 3px 10px; border-radius: 20px;
  font-size: 0.75rem; font-weight: 600;
  white-space: nowrap;
}
.badge-monthly  { background: rgba(16,185,129,0.15); color: #10b981; }
.badge-quarterly { background: rgba(79,110,247,0.15); color: #818cf8; }
.badge-yearly   { background: rgba(245,158,11,0.15); color: #f59e0b; }
.badge-single   { background: rgba(239,68,68,0.15); color: #ef4444; }
.card-price { font-size: 0.85rem; color: var(--accent); font-weight: 700; }
.card-downloads { font-size: 0.75rem; color: var(--text3); }

/* ── Pagination ── */
.pagination {
  display: flex; justify-content: center; gap: 6px;
  padding: 32px 0;
}
.page-btn {
  min-width: 36px; height: 36px; padding: 0 12px;
  border-radius: 8px; border: 1px solid var(--border);
  background: var(--card); color: var(--text2);
  cursor: pointer; font-size: 0.875rem; transition: all .2s;
  display: flex; align-items: center; justify-content: center;
}
.page-btn:hover, .page-btn.active {
  background: var(--primary); border-color: var(--primary); color: #fff;
}

/* ── Resource Detail ── */
.detail-layout {
  display: grid; grid-template-columns: 1fr 340px;
  gap: 28px; padding: 32px 0;
}
.detail-cover {
  width: 100%; border-radius: var(--radius);
  aspect-ratio: 16/9; object-fit: cover;
  background: var(--bg3); margin-bottom: 24px;
}
.detail-title { font-size: clamp(1.3rem, 3vw, 1.8rem); font-weight: 700; margin-bottom: 12px; }
.detail-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.detail-desc { color: var(--text2); line-height: 1.8; white-space: pre-wrap; }
.detail-sidebar {
  position: sticky; top: 80px;
  align-self: start;
}
.sidebar-card {
  background: var(--card); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 24px;
}
.sidebar-card h3 { font-size: 1rem; margin-bottom: 16px; }
.price-tag {
  font-size: 2rem; font-weight: 700; color: var(--accent);
  margin-bottom: 4px;
}
.price-tag small { font-size: 1rem; color: var(--text3); }
.price-note { font-size: 0.8rem; color: var(--text3); margin-bottom: 16px; }
.btn-block { display: block; width: 100%; text-align: center; padding: 12px; margin-bottom: 10px; border-radius: 10px; font-size: 1rem; font-weight: 600; cursor: pointer; transition: all .2s; border: none; }
.btn-accent { background: var(--accent); color: #111; }
.btn-accent:hover { background: #d97706; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text2); }
.btn-outline:hover { background: var(--bg3); color: var(--text); }
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.download-box {
  background: rgba(16,185,129,0.08); border: 1px solid rgba(16,185,129,0.25);
  border-radius: var(--radius-sm); padding: 16px; margin-top: 8px;
}
.download-box label { font-size: 0.8rem; color: var(--text3); display: block; margin-bottom: 6px; }
.link-copy {
  display: flex; gap: 8px;
}
.link-copy input {
  flex: 1; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 6px; padding: 8px 10px; color: var(--text);
  font-size: 0.85rem; outline: none;
}
.copy-btn {
  padding: 8px 14px; background: var(--success); color: #fff;
  border: none; border-radius: 6px; cursor: pointer;
  font-size: 0.8rem; white-space: nowrap; transition: background .2s;
}
.copy-btn:hover { background: #059669; }

/* ── Forms ── */
.form-card {
  background: var(--card); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 32px;
  margin: 40px 0;
}
.form-card h2 { text-align: center; margin-bottom: 28px; font-size: 1.4rem; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 0.875rem; color: var(--text2); margin-bottom: 6px; }
.form-control {
  width: 100%; padding: 11px 14px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  outline: none; transition: border-color .2s; font-size: 0.95rem;
}
.form-control:focus { border-color: var(--primary); }
.form-control::placeholder { color: var(--text3); }
.form-hint { font-size: 0.78rem; color: var(--text3); margin-top: 4px; }
.form-error { font-size: 0.78rem; color: var(--danger); margin-top: 4px; }
.btn-submit {
  width: 100%; padding: 13px; border-radius: var(--radius-sm);
  background: var(--primary); color: #fff; border: none;
  font-size: 1rem; font-weight: 600; cursor: pointer;
  transition: background .2s; margin-top: 8px;
}
.btn-submit:hover { background: var(--primary-dark); }
.form-footer { text-align: center; margin-top: 20px; font-size: 0.875rem; color: var(--text3); }
.form-footer a { color: var(--primary); }

/* ── Alert Messages ── */
.alert {
  padding: 12px 16px; border-radius: var(--radius-sm);
  margin-bottom: 16px; font-size: 0.875rem;
  display: flex; align-items: center; gap: 8px;
}
.alert-success { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.3); color: #34d399; }
.alert-error   { background: rgba(239,68,68,0.1);  border: 1px solid rgba(239,68,68,0.3);  color: #f87171; }
.alert-info    { background: rgba(79,110,247,0.1); border: 1px solid rgba(79,110,247,0.3); color: #818cf8; }
.alert-warn    { background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.3); color: #fbbf24; }

/* ── Membership Plans ── */
.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px; padding: 32px 0;
}
.plan-card {
  background: var(--card); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 28px 24px;
  text-align: center; position: relative; transition: all .2s;
}
.plan-card.featured {
  border-color: var(--primary);
  background: linear-gradient(135deg, rgba(79,110,247,0.05), var(--card));
}
.plan-card.featured::before {
  content: '最受欢迎';
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--primary); color: #fff;
  padding: 3px 14px; border-radius: 20px; font-size: 0.75rem; font-weight: 600;
}
.plan-name { font-size: 1.1rem; font-weight: 700; margin-bottom: 8px; }
.plan-price { font-size: 2.4rem; font-weight: 800; color: var(--accent); margin-bottom: 4px; }
.plan-price small { font-size: 1rem; color: var(--text3); }
.plan-period { font-size: 0.8rem; color: var(--text3); margin-bottom: 20px; }
.plan-desc { font-size: 0.875rem; color: var(--text2); margin-bottom: 20px; }

/* ── User Center ── */
.ucenter-layout { display: grid; grid-template-columns: 220px 1fr; gap: 28px; padding: 32px 0; }
.ucenter-nav {
  background: var(--card); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 8px; align-self: start;
  position: sticky; top: 80px;
}
.ucenter-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  color: var(--text2); font-size: 0.9rem; transition: all .2s;
}
.ucenter-nav a:hover, .ucenter-nav a.active {
  background: var(--bg3); color: var(--text);
}
.ucenter-nav a.active { color: var(--primary); }
.panel { background: var(--card); border-radius: var(--radius); border: 1px solid var(--border); padding: 28px; }
.panel-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }

/* Member status card */
.member-status {
  display: flex; align-items: center; gap: 16px;
  padding: 20px; background: var(--bg3); border-radius: var(--radius-sm);
  margin-bottom: 20px;
}
.member-icon { font-size: 2.5rem; }
.member-info h4 { font-size: 1rem; font-weight: 600; }
.member-info p { font-size: 0.85rem; color: var(--text3); margin-top: 2px; }
.member-level-tag { margin-left: auto; }

/* Order table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th {
  text-align: left; padding: 10px 14px;
  color: var(--text3); font-weight: 500; white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
td { padding: 12px 14px; border-bottom: 1px solid var(--border); color: var(--text2); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }

/* Status badges */
.status { padding: 2px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; }
.status-paid { background: rgba(16,185,129,0.15); color: #10b981; }
.status-pending { background: rgba(245,158,11,0.15); color: #f59e0b; }
.status-failed { background: rgba(239,68,68,0.15); color: #ef4444; }

/* ── Payment Page ── */
.pay-card {
  background: var(--card); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 32px;
  max-width: 480px; margin: 40px auto;
  text-align: center;
}
.pay-amount { font-size: 3rem; font-weight: 800; color: var(--accent); margin: 16px 0; }
.pay-qr {
  width: 200px; height: 200px;
  background: #fff; border-radius: var(--radius-sm);
  margin: 20px auto; display: flex; align-items: center;
  justify-content: center; color: #555; font-size: 0.85rem;
}
.pay-methods { display: flex; gap: 12px; justify-content: center; margin-bottom: 20px; }
.pay-method-btn {
  flex: 1; max-width: 160px; padding: 12px;
  border-radius: var(--radius-sm); border: 2px solid var(--border);
  background: var(--bg3); cursor: pointer;
  font-size: 0.9rem; font-weight: 600; transition: all .2s;
  color: var(--text);
}
.pay-method-btn.active, .pay-method-btn:hover { border-color: var(--primary); color: var(--primary); }
.pay-timer { font-size: 0.85rem; color: var(--text3); margin-top: 12px; }

/* ── Footer ── */
.site-footer {
  border-top: 1px solid var(--border); padding: 32px 16px;
  text-align: center; color: var(--text3); font-size: 0.8rem;
  margin-top: 40px;
}

/* ── Toast ── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 12px 20px; border-radius: var(--radius-sm);
  font-size: 0.875rem; animation: slideIn .3s ease;
  min-width: 200px; max-width: 320px;
  box-shadow: var(--shadow);
}
.toast-success { background: #064e3b; color: #34d399; border: 1px solid rgba(16,185,129,0.3); }
.toast-error   { background: #7f1d1d; color: #fca5a5; border: 1px solid rgba(239,68,68,0.3); }
.toast-info    { background: #1e1b4b; color: #a5b4fc; border: 1px solid rgba(99,102,241,0.3); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Responsive ── */
@media (max-width: 900px) {
  .detail-layout { grid-template-columns: 1fr; }
  .detail-sidebar { position: static; }
  .ucenter-layout { grid-template-columns: 1fr; }
  .ucenter-nav { position: static; display: flex; flex-wrap: wrap; gap: 4px; }
  .ucenter-nav a { flex: none; }
}
@media (max-width: 640px) {
  .header-search { display: none; }
  .header-search.mobile-open { display: flex; position: fixed; top: 60px; left: 0; right: 0; z-index: 99; border-radius: 0; border: none; border-bottom: 1px solid var(--border); background: var(--bg2); }
  .menu-toggle { display: flex; }
  .header-nav .btn-ghost:not(.always-show) { display: none; }
  .resource-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .plan-grid { grid-template-columns: 1fr; }
  .form-card { padding: 24px 16px; }
  .pay-card { padding: 24px 16px; }
  .toast-container { left: 16px; right: 16px; bottom: 16px; }
}
