/* ============ 基础重置 ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: #1E293B;
  background: #FAFBFC;
  line-height: 1.75;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

/* ============ 导航栏 ============ */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #E2E8F0;
  padding: 0 24px;
  height: 60px;
  display: flex; align-items: center; justify-content: space-between;
}
.navbar-brand {
  display: flex; align-items: center; gap: 10px;
  font-size: 20px; font-weight: 700; color: #1E293B;
  text-decoration: none;
}
.navbar-brand svg { width: 28px; height: 28px; color: #0EA5E9; }
.navbar-links { display: flex; align-items: center; gap: 16px; }
.navbar-links a {
  color: #64748B; text-decoration: none; font-size: 14px; font-weight: 500;
  transition: color 150ms;
}
.navbar-links a:hover { color: #0EA5E9; }

/* ============ Hero 区域 ============ */
.hero {
  text-align: center;
  padding: 80px 24px 60px;
  background: linear-gradient(180deg, #F0F9FF 0%, #FAFBFC 100%);
}
.hero h1 {
  font-size: 36px; font-weight: 800; color: #1E293B;
  margin-bottom: 16px;
}
.hero p {
  font-size: 18px; color: #64748B; max-width: 600px; margin: 0 auto;
}

/* ============ 分类筛选 ============ */
.filter-bar {
  display: flex; justify-content: center; gap: 8px;
  padding: 0 24px 32px; flex-wrap: wrap;
}
.filter-btn {
  padding: 8px 20px; border-radius: 20px; border: 1px solid #E2E8F0;
  background: #fff; color: #64748B; font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all 200ms;
}
.filter-btn:hover { border-color: #0EA5E9; color: #0EA5E9; }
.filter-btn.active {
  background: #0EA5E9; color: #fff; border-color: #0EA5E9;
}

/* ============ 产品网格 ============ */
.product-grid {
  max-width: 1200px; margin: 0 auto; padding: 0 24px 80px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px;
}

/* ============ 产品卡片 ============ */
.product-card {
  background: #fff; border-radius: 0.625rem; border: 1px solid #E2E8F0;
  padding: 32px; transition: transform 200ms ease-out, box-shadow 200ms ease-out;
  animation: fadeInUp 400ms ease-out backwards;
}
.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.08);
}
.card-header { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.card-icon {
  width: 48px; height: 48px; border-radius: 12px;
  background: linear-gradient(135deg, #0EA5E9, #38BDF8);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 20px; font-weight: 700; flex-shrink: 0;
  overflow: hidden;
}
.card-icon img { width: 100%; height: 100%; object-fit: cover; }
.card-title { font-size: 18px; font-weight: 700; color: #1E293B; }
.card-category {
  display: inline-block; padding: 2px 10px; border-radius: 10px;
  font-size: 12px; font-weight: 500;
}
.cat-app { background: #DBEAFE; color: #2563EB; }
.cat-tool { background: #D1FAE5; color: #059669; }
.cat-plugin { background: #FEF3C7; color: #D97706; }
.cat-other { background: #F1F5F9; color: #64748B; }
.card-desc { color: #64748B; font-size: 14px; line-height: 1.6; margin-bottom: 16px; }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.tag {
  padding: 4px 12px; border-radius: 14px; font-size: 12px;
  background: #F0F9FF; color: #0EA5E9; font-weight: 500;
}
.card-footer { display: flex; justify-content: flex-end; }
.card-link {
  display: inline-flex; align-items: center; gap: 4px;
  color: #0EA5E9; text-decoration: none; font-size: 14px; font-weight: 500;
  transition: color 150ms;
}
.card-link:hover { color: #0284C7; }
.card-link svg { width: 16px; height: 16px; }

/* ============ 空状态 ============ */
.empty-state {
  text-align: center; padding: 80px 24px; color: #94A3B8;
}
.empty-state svg { width: 64px; height: 64px; margin-bottom: 16px; }
.empty-state p { font-size: 16px; margin-bottom: 8px; }
.empty-state a { color: #0EA5E9; text-decoration: none; font-weight: 500; }

/* ============ Footer ============ */
.footer {
  text-align: center; padding: 32px 24px; border-top: 1px solid #E2E8F0;
  color: #94A3B8; font-size: 14px;
}

/* ============ 动画 ============ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============ 后台管理 - 通用 ============ */
.admin-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; border-bottom: 1px solid #E2E8F0;
  background: #fff;
}
.admin-header h1 { font-size: 20px; font-weight: 700; }
.admin-header .left { display: flex; align-items: center; gap: 16px; }
.admin-header .right { display: flex; align-items: center; gap: 12px; }
.back-link {
  display: inline-flex; align-items: center; gap: 4px;
  color: #64748B; text-decoration: none; font-size: 14px;
  transition: color 150ms;
}
.back-link:hover { color: #0EA5E9; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 20px; border-radius: 8px; font-size: 14px; font-weight: 500;
  border: none; cursor: pointer; transition: all 150ms;
  text-decoration: none;
}
.btn-primary { background: #0EA5E9; color: #fff; }
.btn-primary:hover { background: #0284C7; }
.btn-danger { background: #FEE2E2; color: #DC2626; }
.btn-danger:hover { background: #FECACA; }
.btn-ghost { background: transparent; color: #64748B; border: 1px solid #E2E8F0; }
.btn-ghost:hover { border-color: #0EA5E9; color: #0EA5E9; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ============ 产品表格 ============ */
.admin-content { max-width: 1200px; margin: 0 auto; padding: 24px; }
.product-table {
  width: 100%; border-collapse: collapse; background: #fff;
  border-radius: 0.625rem; overflow: hidden; border: 1px solid #E2E8F0;
}
.product-table th {
  text-align: left; padding: 12px 16px; font-size: 13px;
  color: #64748B; font-weight: 600; background: #F8FAFC;
  border-bottom: 1px solid #E2E8F0;
}
.product-table td {
  padding: 12px 16px; font-size: 14px; border-bottom: 1px solid #F1F5F9;
  vertical-align: middle;
}
.product-table tr:last-child td { border-bottom: none; }
.product-table tr:hover td { background: #F8FAFC; }
.table-name { display: flex; align-items: center; gap: 12px; }
.table-icon {
  width: 36px; height: 36px; border-radius: 8px;
  background: linear-gradient(135deg, #0EA5E9, #38BDF8);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 14px; flex-shrink: 0;
  overflow: hidden;
}
.table-icon img { width: 100%; height: 100%; object-fit: cover; }
.table-actions { display: flex; gap: 8px; }

/* 开关 */
.toggle {
  position: relative; width: 40px; height: 22px;
  border-radius: 11px; background: #CBD5E1; cursor: pointer;
  transition: background 200ms;
}
.toggle.active { background: #0EA5E9; }
.toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  transition: transform 200ms;
}
.toggle.active::after { transform: translateX(18px); }

/* ============ 弹窗 ============ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; animation: fadeIn 150ms;
  overflow-y: auto;
}
.modal-overlay[hidden] { display: none; }
.modal, .modal-box {
  background: #fff; border-radius: 0.625rem; width: 90%; max-width: 560px;
  max-height: 80vh; display: flex; flex-direction: column;
  animation: fadeInUp 200ms;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
}
.modal-body { padding: 24px; overflow-y: auto; flex: 1; min-height: 0; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid #E2E8F0;
  flex-shrink: 0;
}
.modal-header h2 { font-size: 18px; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px; border-radius: 6px; border: none;
  background: transparent; cursor: pointer; font-size: 18px; color: #64748B;
  display: flex; align-items: center; justify-content: center;
  transition: background 150ms;
}
.modal-close:hover { background: #F1F5F9; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 12px;
  padding: 16px 24px; border-top: 1px solid #E2E8F0; flex-shrink: 0;
}

/* 表单 */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block; font-size: 14px; font-weight: 600; color: #374151;
  margin-bottom: 6px;
}
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 10px 14px; border-radius: 8px;
  border: 1px solid #E2E8F0; font-size: 14px; color: #1E293B;
  transition: border-color 150ms; background: #fff;
  font-family: inherit;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: #0EA5E9; box-shadow: 0 0 0 3px rgba(14,165,233,0.1);
}
.form-textarea { min-height: 80px; resize: vertical; }
.upload-field { display: flex; gap: 8px; align-items: center; }
.btn-upload {
  padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 500;
  background: #F1F5F9; color: #475569; cursor: pointer; white-space: nowrap;
  border: 1px solid #E2E8F0; transition: all 150ms;
}
.btn-upload:hover { background: #E2E8F0; color: #1E293B; }
.img-preview { margin-top: 8px; }
.img-preview img {
  max-width: 120px; max-height: 80px; border-radius: 6px;
  border: 1px solid #E2E8F0; object-fit: cover;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-switch {
  display: flex; align-items: center; gap: 10px;
}
.form-switch span { font-size: 14px; color: #374151; }

/* ============ 确认弹窗 ============ */
.confirm-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 300; animation: fadeIn 150ms;
}
.confirm-overlay[hidden] { display: none; }
.confirm-box {
  background: #fff; border-radius: 0.625rem; padding: 24px;
  max-width: 400px; width: 90%; animation: fadeInUp 200ms;
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
}
.confirm-box h3 { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.confirm-box p { font-size: 14px; color: #64748B; margin-bottom: 20px; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 12px; }

/* ============ 登录页 ============ */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #F0F9FF 0%, #FAFBFC 100%);
  padding: 24px;
}
.login-card {
  background: #fff; border-radius: 0.625rem; padding: 40px;
  width: 100%; max-width: 400px; border: 1px solid #E2E8F0;
  animation: fadeInUp 300ms;
}
.login-card h1 { font-size: 24px; font-weight: 700; text-align: center; margin-bottom: 8px; }
.login-card .subtitle { text-align: center; color: #64748B; font-size: 14px; margin-bottom: 32px; }
.login-error {
  background: #FEF2F2; color: #DC2626; padding: 10px 14px; border-radius: 8px;
  font-size: 14px; margin-bottom: 16px; display: none;
}

@keyframes fadeIn {
  from { opacity: 0; } to { opacity: 1; }
}

/* ============ 响应式 ============ */
@media (max-width: 768px) {
  .hero h1 { font-size: 28px; }
  .hero p { font-size: 16px; }
  .product-grid { grid-template-columns: 1fr; padding: 0 16px 60px; }
  .product-card { padding: 24px; }
  .form-row { grid-template-columns: 1fr; }
  .product-table { font-size: 13px; }
  .product-table th, .product-table td { padding: 10px 12px; }
}

/* ============ Loading ============ */
.loading-spinner {
  display: flex; justify-content: center; align-items: center;
  padding: 60px; color: #94A3B8;
}
.spinner {
  width: 32px; height: 32px; border: 3px solid #E2E8F0;
  border-top-color: #0EA5E9; border-radius: 50%;
  animation: spin 600ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
