/* ============================
   用户中心样式
   ============================ */

:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #a855f7 100%);
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-md: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -4px rgba(0,0,0,.04);
  --shadow-lg: 0 20px 40px rgba(79,70,229,.12);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

html { overflow-y: scroll; }

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ==================== Header ==================== */

.site-header {
  background: rgba(255,255,255,.85);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-icon {
  width: 40px;
  height: 40px;
  background: var(--primary-gradient);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
  box-shadow: 0 4px 12px rgba(79,70,229,.3);
}

.brand-text h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.brand-text span {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 999px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  transition: all .2s;
  text-decoration: none;
  background: #f1f5f9;
}

.nav-link i { font-size: 15px; }

.nav-link:hover { background: #eef2ff; color: var(--primary); }

/* ==================== Main ==================== */

.user-main {
  max-width: 520px;
  margin: 0 auto;
  padding: 60px 24px 80px;
}

/* ==================== Panel Card ==================== */

.panel-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 6px -1px rgba(0,0,0,.05);
  text-align: center;
}

.panel-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius);
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 28px;
  margin: 0 auto 16px;
  box-shadow: 0 8px 24px rgba(79,70,229,.3);
}

.panel-card h2 {
  font-size: 20px;
  margin-bottom: 6px;
}

.panel-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 28px;
}

/* ==================== Form ==================== */

.form-group {
  text-align: left;
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
  transition: border-color .2s;
  font-family: var(--font);
  background: var(--card-bg);
  color: var(--text);
}

.form-group textarea { resize: vertical; }

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}

.panel-error {
  color: #ef4444;
  font-size: 13px;
  margin-top: 12px;
  min-height: 20px;
}

.panel-switch {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 20px;
}

.panel-switch a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

.panel-switch a:hover { text-decoration: underline; }

/* ==================== Button ==================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 22px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all .25s;
  text-decoration: none;
  font-family: var(--font);
}

.btn-primary {
  background: var(--primary-gradient);
  color: #fff;
  box-shadow: 0 4px 12px rgba(79,70,229,.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(79,70,229,.4);
}

.btn-primary:disabled {
  opacity: .6;
  pointer-events: none;
}

.btn-outline {
  background: var(--card-bg);
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
}

.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

.btn-block { width: 100%; justify-content: center; padding: 11px; }

.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ==================== Dashboard ==================== */

.dash-header {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.dash-welcome {
  display: flex;
  align-items: center;
  gap: 14px;
}

.dash-avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 22px;
  flex-shrink: 0;
}

.dash-welcome h2 {
  font-size: 18px;
  margin-bottom: 2px;
}

.dash-welcome p {
  font-size: 13px;
  color: var(--text-muted);
}

/* ==================== Purchases ==================== */

.purchases-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.purchase-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  border: 1px solid var(--border);
  transition: all .3s cubic-bezier(.4,0,.2,1);
  animation: fadeInUp .4s ease backwards;
}

.purchase-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: transparent;
}

.purchase-top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
}

.purchase-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(79,70,229,.2);
}

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

.purchase-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.purchase-desc {
  font-size: 13px;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.purchase-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.purchase-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.purchase-field .pf-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .3px;
}

.purchase-field .pf-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  word-break: break-all;
}

.purchase-field .pf-value code {
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  color: #4f46e5;
  cursor: pointer;
  user-select: all;
}

.purchase-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
  align-items: flex-end;
  flex-shrink: 0;
}

/* ==================== Empty State ==================== */

.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 56px;
  margin-bottom: 16px;
  opacity: .4;
}

.empty-state h3 {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state p { font-size: 14px; }

/* ==================== Toast ==================== */

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: toastIn .3s ease, toastOut .3s ease 2.7s forwards;
  max-width: 360px;
}

.toast-success { background: #10b981; }
.toast-error { background: #ef4444; }

@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes toastOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

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

/* ==================== 三卡片操作区 ==================== */

.dashboard-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.action-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 28px;
  cursor: pointer;
  transition: all .3s cubic-bezier(.4,0,.2,1);
  text-align: center;
}

.action-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(79,70,229,.12);
  border-color: transparent;
}

.action-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #fff;
  margin: 0 auto 16px;
}

.action-card-icon.indigo { background: linear-gradient(135deg, #4f46e5, #7c3aed); }
.action-card-icon.green  { background: linear-gradient(135deg, #10b981, #059669); }
.action-card-icon.cyan   { background: linear-gradient(135deg, #06b6d4, #0891b2); }

.action-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.action-card-desc {
  font-size: 13px;
  color: var(--text-muted);
}

/* ==================== Modal 通用 ==================== */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal-dialog {
  background: var(--card-bg);
  border-radius: 16px;
  width: 420px;
  max-width: 92vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px rgba(0,0,0,.2);
  animation: modalIn .25s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(-16px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-header-bar h3 {
  font-size: 17px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.modal-header-bar h3 i { color: var(--primary); }

.modal-close {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: none;
  background: none;
  font-size: 22px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
  line-height: 1;
}

.modal-close:hover { background: #f1f5f9; color: #0f172a; }

.modal-body-scroll {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* ==================== 联系作者 Modal ==================== */

.cm-author {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: #f8fafc;
  border-radius: 12px;
  margin-bottom: 24px;
}

.cm-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  object-fit: cover;
  background: #f1f5f9;
  flex-shrink: 0;
}

.cm-name { font-size: 17px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.cm-bio { font-size: 13px; color: var(--text-muted); line-height: 1.5; }

.cm-qr-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.cm-qr-card {
  text-align: center;
  padding: 20px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.cm-qr-label {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.cm-qr-card.wechat .cm-qr-label { color: #07c160; }
.cm-qr-card.qq .cm-qr-label { color: #12b7f5; }

.cm-qr-account {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.cm-qr-img-wrap {
  width: 150px; height: 150px;
  margin: 0 auto;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  padding: 6px;
  background: #fff;
}

.cm-qr-img-wrap img { width: 100%; height: 100%; object-fit: contain; }

/* ==================== 付款 Modal ==================== */

.pm-tip {
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.pm-qr-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.pm-qr-card {
  text-align: center;
}

.pm-qr-label {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.pm-qr-label .fa-weixin { color: #07c160; }
.pm-qr-label .fa-alipay { color: #1677ff; }

.pm-qr-img-wrap {
  width: 180px; height: 180px;
  margin: 0 auto;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  padding: 8px;
  background: #fff;
}

.pm-qr-img-wrap img { width: 100%; height: 100%; object-fit: contain; }

/* ==================== 修改密码 Modal ==================== */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal-dialog {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 420px;
  max-width: 92vw;
  box-shadow: 0 25px 60px rgba(0,0,0,.2);
  animation: modalIn .25s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(-16px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-dialog h3 {
  font-size: 18px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

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

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* ==================== Footer ==================== */

.site-footer {
  text-align: center;
  padding: 32px 24px;
  color: var(--text-muted);
  font-size: 13px;
  border-top: 1px solid var(--border);
}

/* ==================== Responsive ==================== */

@media (max-width: 640px) {
  .user-main { padding: 32px 16px 48px; }
  .panel-card { padding: 32px 24px; }
  .dash-header { flex-direction: column; align-items: flex-start; }
  .purchase-card { padding: 20px; }
  .purchase-meta { flex-direction: column; gap: 12px; }
  .purchase-actions { margin-left: 0; }
  .dashboard-actions { grid-template-columns: 1fr; }
  .action-card { padding: 24px 20px; }
  .cm-qr-grid { grid-template-columns: 1fr; }
  .pm-qr-grid { grid-template-columns: 1fr; }
  .pm-qr-img-wrap { width: 160px; height: 160px; }
  .header-inner { padding: 0 16px; }
  .brand-text h1 { font-size: 16px; }
}
