/* ===== 基础样式 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: #f8fafc;
  color: #1e293b;
  line-height: 1.6;
}

/* ===== Header ===== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid #e2e8f0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-inner {
  width: 100%;
  max-width: 1200px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.notify-bell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.2s;
}
.notify-bell:hover {
  background: #f1f5f9;
}

.user-info-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 4px;
  border-radius: 20px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  transition: all 0.2s;
}
.user-info-bar:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.header-lang-select {
  padding: 6px 10px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  color: #475569;
  background: white;
  cursor: pointer;
  outline: none;
}

.header-lang-select:hover {
  border-color: #3b82f6;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  color: #1e293b;
  text-decoration: none;
}

.logo-icon {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
  font-weight: 800;
}

.nav a {
  color: #64748b;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  margin-left: 24px;
  transition: color 0.2s;
}

.nav a:hover, .nav a.active {
  color: #3b82f6;
}

/* ===== 按钮 ===== */
.btn {
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

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

.btn-outline {
  background: transparent;
  color: #3b82f6;
  border: 1.5px solid #3b82f6;
}

.btn-outline:hover { background: #eff6ff; }

.btn-primary {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
}

.btn-primary:hover { box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3); }

.btn-success {
  background: #10b981;
  color: white;
}

.btn-success:hover { background: #059669; }

.btn-danger {
  background: #ef4444;
  color: white;
}

.btn-danger:hover { background: #dc2626; }

.btn-warning {
  background: #f59e0b;
  color: white;
}

.btn-secondary {
  background: #f1f5f9;
  color: #475569;
}

.btn-secondary:hover { background: #e2e8f0; }

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

/* ===== 首页样式 ===== */
.hero {
  margin-top: 60px;
  padding: 40px 24px 24px;
  text-align: center;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

/* 搜索栏 */
.search-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.column-select {
  padding: 8px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 14px;
  background: white;
  cursor: pointer;
  outline: none;
  color: #374151;
  transition: all 0.2s;
}

.column-select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: white;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 4px 4px 4px 14px;
  transition: all 0.2s;
  flex: 1;
  max-width: 100%;
}

.search-input-wrap:focus-within {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.search-icon {
  width: 18px;
  height: 18px;
  color: #94a3b8;
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 14px;
  color: #1e293b;
  background: transparent;
  padding: 8px 0;
}

.search-input::placeholder {
  color: #94a3b8;
}

.search-btn {
  padding: 8px 18px;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.search-btn:hover {
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.search-clear {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: #e2e8f0;
  color: #64748b;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.search-clear:hover {
  background: #cbd5e1;
}

.hero-title {
  font-size: 36px;
  font-weight: 800;
  color: #1e293b;
  margin-bottom: 10px;
}

.hero-subtitle {
  font-size: 16px;
  color: #64748b;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 60px;
}

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

.article-card {
  display: flex;
  gap: 20px;
  background: white;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.03);
  transition: all 0.3s ease;
  cursor: pointer;
  border: 1px solid #f1f5f9;
}

.article-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.08);
}

.article-thumb {
  width: 260px;
  height: 160px;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
  background: #e2e8f0;
}

.article-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.article-card:hover .article-thumb img {
  transform: scale(1.03);
}

.article-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}

.article-title {
  font-size: 18px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.4;
  margin-bottom: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.article-summary {
  font-size: 14px;
  color: #64748b;
  line-height: 1.7;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  color: #94a3b8;
  margin-top: 12px;
}

.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  background: #eff6ff;
  color: #3b82f6;
  white-space: nowrap;
}

.loading-trigger {
  text-align: center;
  padding: 40px;
}

.spinner {
  display: inline-block;
  width: 32px;
  height: 32px;
  border: 3px solid #e2e8f0;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  margin-top: 12px;
  color: #94a3b8;
  font-size: 14px;
}

.end-of-list {
  text-align: center;
  padding: 40px;
  color: #94a3b8;
  font-size: 14px;
}

.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: #94a3b8;
  grid-column: 1 / -1;
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

/* ===== 管理后台样式 ===== */
.admin-header {
  background: white;
  border-bottom: 1px solid #e2e8f0;
  padding: 20px 24px;
  margin-top: 60px;
}

.admin-header-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-title {
  font-size: 24px;
  font-weight: 700;
}

/* 配置面板 */
.config-panel {
  background: white;
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  border: 1px solid #f1f5f9;
}

.config-panel h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-row {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.form-group {
  flex: 1;
  min-width: 200px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
  font-family: inherit;
}

.form-control:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

/* 采集控制面板 */
.crawl-panel {
  background: white;
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  border: 1px solid #f1f5f9;
}

.source-checkboxes {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.source-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: #f8fafc;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.source-checkbox:hover {
  background: #eff6ff;
}

.source-checkbox input {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* 进度显示 */
.progress-box {
  background: #f8fafc;
  border-radius: 12px;
  padding: 16px;
  margin-top: 16px;
  max-height: 300px;
  overflow-y: auto;
}

.progress-item {
  padding: 6px 0;
  font-size: 13px;
  color: #64748b;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  gap: 6px;
}

.progress-item:last-child {
  border-bottom: none;
}

.progress-item.success { color: #10b981; }
.progress-item.error { color: #ef4444; }
.progress-item.info { color: #3b82f6; }

.progress-bar {
  width: 100%;
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  margin-top: 8px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #1d4ed8);
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* AI 生成面板 */
.ai-panel {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 20px;
  color: white;
}

.ai-panel h3 {
  font-size: 16px;
  margin-bottom: 16px;
}

/* 统计卡片 */
.stats-cards {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border-radius: 12px;
  padding: 20px 24px;
  min-width: 140px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  border: 1px solid #f1f5f9;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: #1e293b;
}

.stat-label {
  font-size: 13px;
  color: #64748b;
  margin-top: 4px;
}

.stat-card.pending .stat-value { color: #f59e0b; }
.stat-card.approved .stat-value { color: #10b981; }
.stat-card.rejected .stat-value { color: #ef4444; }
.stat-card.total .stat-value { color: #3b82f6; }

/* 筛选标签 */
.filter-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.filter-tab {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: white;
  color: #64748b;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-tab:hover {
  border-color: #3b82f6;
  color: #3b82f6;
}

.filter-tab.active {
  background: #3b82f6;
  color: white;
  border-color: #3b82f6;
}

/* 审核列表 */
.review-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.review-item {
  background: white;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid #f1f5f9;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.review-item .article-thumb {
  width: 180px;
  height: 120px;
}

.review-item .article-title {
  font-size: 16px;
}

.review-item .article-summary {
  font-size: 13px;
  -webkit-line-clamp: 2;
}

.review-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
}

.status-pending { background: #fef3c7; color: #92400e; }
.status-approved { background: #d1fae5; color: #065f46; }
.status-rejected { background: #fee2e2; color: #991b1b; }
.status-published { background: #dbeafe; color: #1e40af; }

.source-type-badge {
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

.source-crawl { background: #dbeafe; color: #1e40af; }
.source-ai { background: #e0e7ff; color: #3730a3; }
.source-manual { background: #d1fae5; color: #065f46; }
.source-upload { background: #fef3c7; color: #92400e; }

.source-tag {
  font-size: 12px;
  color: #94a3b8;
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 4px;
}

/* 详情弹窗 */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
}

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

.detail-modal {
  background: white;
  border-radius: 20px;
  width: 100%;
  max-width: 1000px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
}

/* PC端可拖动弹窗样式 */
.modal-overlay.side-panel-active {
  background: transparent;
  backdrop-filter: none;
  pointer-events: none;
  justify-content: flex-end;
  padding: 0;
}

.modal-overlay.side-panel-active .detail-modal.is-side-panel {
  pointer-events: auto;
}

/* 附着面板时首页自动收窄 */
body.has-side-panel {
  padding-right: calc(34vw + 24px);
}

body.has-side-panel .header {
  right: calc(34vw + 24px);
}

.modal-header-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: none;
  background: #f1f5f9;
  color: #64748b;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.modal-header-btn:hover {
  background: #e2e8f0;
}

.modal-resize-handle {
  position: absolute;
  right: 0; bottom: 0;
  width: 28px; height: 28px;
  cursor: se-resize;
  z-index: 10;
  background: linear-gradient(135deg, transparent 55%, rgba(226, 232, 240, 0.6) 55%);
  border-radius: 10px 0 0 0;
  transition: background 0.2s;
}

.modal-resize-handle:hover {
  background: linear-gradient(135deg, transparent 55%, rgba(203, 213, 225, 0.8) 55%);
}

.modal-resize-handle::after {
  content: '';
  position: absolute;
  right: 5px; bottom: 5px;
  width: 14px; height: 14px;
  border-right: 3px solid #64748b;
  border-bottom: 3px solid #64748b;
  border-radius: 0 0 4px 0;
}

.detail-modal.is-floating {
  position: fixed;
  left: calc(50% - 500px);
  top: 5vh;
  width: 1000px;
  height: 90vh;
  max-width: none;
  max-height: none;
}

.detail-modal.is-fullscreen {
  position: fixed !important;
  left: 0 !important; top: 0 !important;
  width: 100vw !important; height: 100vh !important;
  border-radius: 0 !important;
  max-width: none !important; max-height: none !important;
}

.detail-modal.is-side-panel {
  position: fixed !important;
  right: 0 !important; top: 0 !important; left: auto !important;
  width: 33.33vw !important; height: 100vh !important;
  border-radius: 0 !important;
  max-width: none !important; max-height: none !important;
}

.side-panel-resizer {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 6px;
  cursor: col-resize;
  z-index: 10;
  background: transparent;
}

.side-panel-resizer:hover {
  background: rgba(59,130,246,0.2);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
}

.modal-hint {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: #94a3b8;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.modal-close {
  width: 36px; height: 36px;
  border-radius: 10px;
  border: none;
  background: #f1f5f9;
  color: #64748b;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.source-info {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  background: #f8fafc;
  border-radius: 10px;
  margin-bottom: 20px;
  font-size: 13px;
  flex-wrap: wrap;
}

.content-preview {
  line-height: 1.8;
  color: #374151;
}

.content-preview p {
  margin-bottom: 1em;
}

.content-preview img,
.modal-body img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

.cover-image {
  width: 100%;
  height: 300px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 20px;
}

.edit-field {
  margin-bottom: 16px;
}

.edit-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
}

.edit-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
}

.edit-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.edit-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  resize: vertical;
  min-height: 120px;
  font-family: inherit;
  line-height: 1.6;
}

.edit-textarea:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #f1f5f9;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.modal-actions {
  display: flex;
  gap: 8px;
}

.edit-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: #3b82f6;
  font-weight: 500;
}

.edit-toggle input {
  width: 18px; height: 18px;
  cursor: pointer;
}

/* Toast */
.toast {
  position: fixed;
  top: 80px;
  right: 24px;
  padding: 14px 20px;
  border-radius: 10px;
  color: white;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  animation: slideIn 0.3s ease;
  z-index: 9999;
}

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

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

/* 多列布局 */
@media (min-width: 768px) {
  .article-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .article-grid[data-max-cols="1"] {
    grid-template-columns: 1fr !important;
  }
  /* 强制单列时恢复横向卡片样式 */
  .article-grid[data-max-cols="1"] .article-card {
    flex-direction: row;
    padding: 20px;
  }
  .article-grid[data-max-cols="1"] .article-thumb {
    width: 260px;
    height: 160px;
    border-radius: 12px;
    flex-shrink: 0;
  }
  .article-grid[data-max-cols="1"] .article-content {
    padding: 0;
    flex: 1;
  }
  .article-grid[data-max-cols="1"] .article-title {
    font-size: 18px;
    -webkit-line-clamp: 2;
  }
  .article-grid[data-max-cols="1"] .article-summary {
    font-size: 14px;
    -webkit-line-clamp: 3;
  }
  /* 2列及以上用纵向卡片 */
  .article-grid:not([data-max-cols="1"]) .article-card {
    flex-direction: column;
    padding: 0 0 16px 0;
    overflow: hidden;
  }
  .article-grid:not([data-max-cols="1"]) .article-thumb {
    width: 100%;
    height: 180px;
    border-radius: 16px 16px 0 0;
  }
  .article-grid:not([data-max-cols="1"]) .article-content {
    padding: 0 16px;
  }
  .article-grid:not([data-max-cols="1"]) .article-title {
    font-size: 16px;
    -webkit-line-clamp: 2;
  }
  .article-grid:not([data-max-cols="1"]) .article-summary {
    font-size: 13px;
    -webkit-line-clamp: 2;
  }
}

/* 3列 (~389px/列 @1200px container) */
@media (min-width: 1100px) {
  .article-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .article-grid[data-max-cols="1"] {
    grid-template-columns: 1fr !important;
  }
  .article-grid[data-max-cols="2"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .article-grid .article-thumb {
    height: 160px;
  }
}

/* 4列 (~378px/列 @1560px container) */
@media (min-width: 1600px) {
  .article-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .article-grid[data-max-cols="1"] {
    grid-template-columns: 1fr !important;
  }
  .article-grid[data-max-cols="2"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .article-grid[data-max-cols="3"] {
    grid-template-columns: repeat(3, 1fr) !important;
  }
  .article-grid .article-thumb {
    height: 150px;
  }
}

/* 5列 (~363px/列 @1950px container) */
@media (min-width: 1880px) {
  .article-grid {
    grid-template-columns: repeat(5, 1fr);
  }
  .article-grid[data-max-cols="1"] {
    grid-template-columns: 1fr !important;
  }
  .article-grid[data-max-cols="2"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .article-grid[data-max-cols="3"] {
    grid-template-columns: repeat(3, 1fr) !important;
  }
  .article-grid[data-max-cols="4"] {
    grid-template-columns: repeat(4, 1fr) !important;
  }
  .article-grid .article-thumb {
    height: 140px;
  }
}

/* 4列/5列时放宽 container，保持卡片宽度和3列时大致一致 */
body[data-max-cols="4"] .container,
body[data-max-cols="4"] .header-inner {
  max-width: 1560px;
}

body[data-max-cols="5"] .container,
body[data-max-cols="5"] .header-inner {
  max-width: 1950px;
}

/* auto模式在宽屏下也放宽 */
@media (min-width: 1600px) {
  body[data-max-cols="auto"] .container,
  body[data-max-cols="auto"] .header-inner {
    max-width: 1560px;
  }
}

@media (min-width: 1880px) {
  body[data-max-cols="auto"] .container,
  body[data-max-cols="auto"] .header-inner {
    max-width: 1950px;
  }
}

/* 响应式 */
@media (max-width: 768px) {
  /* 手机端 header 精简：只保留 logo 和语言选择 */
  .header .nav { display: none; }
  .header #authArea { display: none; }
  .header-inner { padding: 0 12px; }
  .header-lang-select { padding: 4px 6px; font-size: 12px; }

  .article-card {
    flex-direction: column;
  }
  .article-thumb {
    width: 100%;
    height: 200px;
  }
  .review-item {
    flex-direction: column;
  }
  .review-item .article-thumb {
    width: 100%;
    height: 180px;
  }
  .stats-cards {
    flex-wrap: wrap;
  }
  .stat-card {
    min-width: calc(50% - 8px);
  }
  .form-row {
    flex-direction: column;
  }
  .search-btn {
    padding: 8px 12px;
    font-size: 13px;
  }
  /* 手机端恢复模态弹窗 */
  .detail-modal.is-floating,
  .detail-modal.is-fullscreen,
  .detail-modal.is-side-panel {
    position: relative !important;
    left: auto !important; top: auto !important; right: auto !important;
    width: 100% !important; height: auto !important;
    max-width: 800px !important; max-height: 90vh !important;
    border-radius: 20px !important;
  }
  .modal-resize-handle,
  .side-panel-resizer,
  .modal-header-btn { display: none !important; }
}

/* ===== 文章内搜索框 ===== */
.article-search-box {
  position: absolute;
  top: 68px;
  right: 20px;
  width: 280px;
  background: white;
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.18);
  border: 1px solid #e2e8f0;
  z-index: 100;
  overflow: hidden;
}

.article-search-header {
  padding: 10px 14px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: move;
  user-select: none;
}

.article-search-close {
  width: 24px; height: 24px;
  border-radius: 6px;
  border: none;
  background: #e2e8f0;
  color: #64748b;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.article-search-close:hover {
  background: #cbd5e1;
}

.article-search-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.article-search-input {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
}

.article-search-input:focus {
  border-color: #3b82f6;
}

.article-search-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}

.article-search-count {
  font-size: 12px;
  color: #64748b;
  margin-right: auto;
}

.article-search-navbtn {
  width: 28px; height: 28px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  background: white;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.article-search-navbtn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.article-search-navbtn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

mark.search-highlight {
  background: #fde047;
  color: #1e293b;
  padding: 1px 2px;
  border-radius: 3px;
}

mark.search-highlight.search-current {
  background: #f59e0b;
  color: white;
  box-shadow: 0 0 0 2px rgba(245,158,11,0.3);
}
