/* ============================================
   聚变 — 全局样式
   ============================================ */

:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --bg: #f8fafc;
  --text: #1e293b;
  --text-light: #64748b;
  --border: #e2e8f0;
  --card-bg: #ffffff;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* --- Header --- */
.header {
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: white;
  padding: 40px 0 30px;
  text-align: center;
}

.header h1 { font-size: 2rem; letter-spacing: -0.3px; }
.header .subtitle { opacity: 0.85; margin-top: 6px; font-size: 1.05rem; }

.nav {
  margin-top: 16px;
  display: flex;
  justify-content: center;
  gap: 20px;
}

.nav a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-size: 0.95rem;
  padding: 4px 12px;
  border-radius: 20px;
  transition: all 0.2s;
}

.nav a:hover { background: rgba(255,255,255,0.15); color: white; }

/* --- Filters --- */
.filters {
  margin: 24px 0 16px;
}

.filter-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.filter-select {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  outline: none;
}

.filter-select:focus { border-color: var(--primary); }

.product-count {
  margin-left: auto;
  font-size: 0.9rem;
  color: var(--text-light);
}

/* --- Product Grid --- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.loading, .empty, .error {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
  font-size: 1rem;
}

.product-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
}

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

.card-avatar {
  height: 100px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-avatar img {
  max-width: 64px;
  max-height: 64px;
  object-fit: contain;
}

.avatar-fallback {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--primary);
  color: white;
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-body {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-category {
  font-size: 0.75rem;
  color: var(--primary);
  background: #eef2ff;
  padding: 2px 8px;
  border-radius: 10px;
  width: fit-content;
  margin-bottom: 8px;
  font-weight: 500;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.card-desc {
  font-size: 0.88rem;
  color: var(--text-light);
  flex: 1;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.btn-visit {
  text-align: center;
  text-decoration: none;
  display: block;
}

/* --- Buttons --- */
.btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background 0.2s, opacity 0.2s;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

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

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: var(--primary); color: white; }

.btn-small { padding: 6px 14px; font-size: 13px; }

.btn-page {
  padding: 6px 16px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}
.btn-page:hover:not(:disabled) { border-color: var(--primary); }

/* --- Submit Section --- */
.submit-section {
  margin: 48px 0;
  padding: 32px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.submit-section h2 { font-size: 1.4rem; margin-bottom: 4px; }
.submit-desc { color: var(--text-light); margin-bottom: 20px; font-size: 0.95rem; }

.submit-form { display: flex; flex-direction: column; gap: 16px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.form-group { display: flex; flex-direction: column; gap: 4px; }

.form-group label { font-size: 0.9rem; font-weight: 500; }
.form-group .required { color: #ef4444; }

.form-group input,
.form-group select {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus { border-color: var(--primary); }

/* Logo 上传 */
.logo-upload-row { display: flex; align-items: center; gap: 12px; }
.btn-file { position: relative; cursor: pointer; display: inline-block; }
.btn-file input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.logo-file-name { font-size: 0.85rem; color: var(--text-light); }

/* --- Result Box --- */
.result-box {
  margin-top: 24px;
  padding: 24px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius);
}

.result-box h3 { font-size: 1.1rem; margin-bottom: 4px; color: #166534; }
.result-box p { margin-bottom: 12px; font-size: 0.95rem; }

.embed-code-box { margin: 12px 0; }

.embed-code-box label { font-size: 0.9rem; font-weight: 500; display: block; margin-bottom: 6px; }

.embed-code-box textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: "SF Mono", "Consolas", monospace;
  font-size: 13px;
  resize: none;
  background: white;
  margin-bottom: 8px;
}

.hint { font-size: 0.85rem; color: var(--text-light); }

/* Detail fieldset */
.detail-fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 4px;
}
.detail-fieldset legend {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--primary);
  padding: 0 8px;
}
.form-group textarea {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  resize: vertical;
  font-family: inherit;
  line-height: 1.6;
  transition: border-color 0.2s;
}
.form-group textarea:focus { border-color: var(--primary); }

/* Regenerate */
.regenerate-section {
  margin-top: 12px;
  padding: 16px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
}
.regenerate-section .regenerate-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.regenerate-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  outline: none;
}
.regenerate-input:focus { border-color: var(--primary); }

/* --- Pagination --- */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}

.page-info { font-size: 0.9rem; color: var(--text-light); }

.pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 10px 0;
  flex-wrap: wrap;
}
.page-size-group {
  display: flex;
  align-items: center;
  gap: 4px;
}
.page-size-label {
  font-size: 0.82rem;
  color: var(--text-light);
}
.page-size-btn {
  padding: 4px 10px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  border-radius: 5px;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--text);
  transition: all 0.15s;
}
.page-size-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-size-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.page-nav-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.page-total {
  font-size: 0.8rem;
  color: var(--text-light);
}

/* --- Footer --- */
.footer {
  text-align: center;
  padding: 24px 20px;
  color: var(--text-light);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}

/* ========== V2.0 新增样式 ========== */

/* Auth pages */
.header-sm { padding: 20px 0; text-align: left; }
.header-sm .container { display: flex; align-items: center; justify-content: space-between; }
.header-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.header-user { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; }
.header-user a { color: rgba(255,255,255,0.85); text-decoration: none; font-size: 0.9rem; padding: 6px 16px; border-radius: 6px; transition: background 0.2s; }
.header-user a:hover { background: rgba(255,255,255,0.15); color: #fff; }
.header-user .btn-white { background: rgba(255,255,255,0.95); color: var(--primary); border: none; padding: 6px 16px; border-radius: 6px; font-weight: 600; cursor: pointer; font-size: 0.9rem; text-decoration: none; }
.header-user .btn-white:hover { background: #fff; }
.logo-link { color: white; text-decoration: none; font-size: 1.3rem; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.logo-link:hover { color: white; }
.logo-link img { height: 1.2em; width: auto; vertical-align: baseline; }
.auth-box { max-width: 400px; margin: 40px auto; padding: 32px; background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); }
.auth-box h2 { font-size: 1.4rem; margin-bottom: 20px; text-align: center; }
.auth-switch { text-align: center; margin-top: 16px; font-size: 0.9rem; color: var(--text-light); }
.form-error { background: #fef2f2; color: #dc2626; padding: 10px 14px; border-radius: 6px; font-size: 0.85rem; margin-bottom: 8px; }
.form-ok { background: #f0fdf4; color: #16a34a; padding: 10px 14px; border-radius: 6px; font-size: 0.85rem; margin-bottom: 8px; }
.code-row { display: flex; gap: 8px; align-items: center; }

/* Profile */
.profile-card { background: var(--card-bg); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); margin: 24px 0; }
.profile-card h2 { font-size: 1.2rem; margin-bottom: 12px; }
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; font-size: 0.9rem; }
.profile-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* My products */
.my-products { margin: 24px 0; }
.my-products h2 { font-size: 1.2rem; margin-bottom: 12px; }
.product-table { width: 100%; border-collapse: collapse; background: var(--card-bg); border-radius: var(--radius); overflow: hidden; font-size: 0.85rem; }
.product-table th, .product-table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); }
.product-table th { background: #f8f9fa; font-weight: 600; }
.product-table tr:hover { background: #fafafa; }
.status-tag { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 0.75rem; font-weight: 500; }
.status-pending { background: #fff3cd; color: #856404; }
.status-approved { background: #d4edda; color: #155724; }
.status-rejected { background: #f8d7da; color: #721c24; }
.btn-danger { background: transparent; color: #dc3545; border: 1px solid #dc3545; }
.btn-danger:hover { background: #dc3545; color: white; }

/* Modals */
.modal-overlay { position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,0.45); display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-box { background: white; border-radius: 12px; padding: 24px; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,0.2); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-header h3 { font-size: 1.1rem; }
.modal-close { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: #94a3b8; }
.modal-close:hover { color: #475569; }

/* Product detail */
.detail-card { background: var(--card-bg); border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow); }
.detail-header { display: flex; gap: 24px; align-items: flex-start; }
.detail-avatar .avatar-fallback.lg { width: 80px; height: 80px; border-radius: 16px; font-size: 2rem; }
.detail-avatar img { width: 80px; height: 80px; border-radius: 16px; object-fit: contain; }
.detail-info h1 { font-size: 1.5rem; margin: 4px 0; }
.detail-desc { color: var(--text-light); margin: 8px 0 16px; font-size: 0.95rem; }
.detail-meta { display: flex; gap: 16px; flex-wrap: wrap; font-size: 0.8rem; color: var(--text-light); margin-bottom: 16px; }
.detail-btn { display: inline-block; text-decoration: none; }

/* Admin */
.admin-tabs { display: flex; gap: 4px; margin-bottom: 16px; flex-wrap: wrap; }
.admin-tab { padding: 8px 16px; border: 1px solid var(--border); background: white; border-radius: 6px; cursor: pointer; font-size: 0.85rem; }
.admin-tab.active { background: var(--primary); color: white; border-color: var(--primary); }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card { background: var(--card-bg); border-radius: 8px; padding: 16px; text-align: center; box-shadow: var(--shadow); }
.stat-card .num { font-size: 1.8rem; font-weight: 700; color: var(--primary); }
.stat-card .lbl { font-size: 0.8rem; color: var(--text-light); margin-top: 4px; }
.admin-table-wrap { overflow-x: auto; }
.admin-table-wrap table { width: 100%; border-collapse: collapse; background: var(--card-bg); border-radius: 8px; overflow: hidden; font-size: 0.82rem; }
.admin-table-wrap th, .admin-table-wrap td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.admin-table-wrap th { background: #f8f9fa; font-weight: 600; }
.admin-table-wrap tr:hover { background: #fafafa; }
.btn-xs { padding: 3px 10px; font-size: 11px; border-radius: 4px; border: none; cursor: pointer; }
.btn-ok { background: #28a745; color: white; }
.btn-no { background: #dc3545; color: white; }
.btn-ok:hover { background: #218838; }
.btn-no:hover { background: #c82333; }

/* Responsive */
@media (max-width: 640px) {
  .profile-grid { grid-template-columns: 1fr; }
  .detail-header { flex-direction: column; align-items: center; text-align: center; }
  .detail-meta { justify-content: center; }
  .product-table { font-size: 0.75rem; }
  .product-table th, .product-table td { padding: 6px 8px; }
}

/* Payment UI */
.upload-zone {
  border: 2px dashed #ddd;
  border-radius: 8px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.upload-zone:hover {
  border-color: var(--primary);
  background: #f8fafc;
}

/* --- Responsive --- */
@media (max-width: 640px) {
  .header h1 { font-size: 1.5rem; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
  .form-row { grid-template-columns: 1fr; }
  .submit-section { padding: 20px; }
  .filter-row { gap: 8px; }
  .product-count { margin-left: 0; width: 100%; text-align: left; }
}
