/**
 * GEO文章生成系统 - Shadcn/UI 风格 CSS
 * 基于 shadcn/ui 设计系统
 * 保留原有class名和JS逻辑，仅替换样式
 */

/* ========== Shadcn CSS Variables ========== */
:root {
  /* 边框 */
  --border: 0 0 0 1px rgba(0, 0, 0, 0.05);
  --border-color: #e5e7eb;

  /* 背景 */
  --background: 0 0 0 100vh #fafafa;
  --card: #ffffff;

  /* 主题色 - Indigo */
  --primary: #4f46e5;
  --primary-foreground: #ffffff;
  --primary-hover: #4338ca;

  /* 成功 - Emerald */
  --success: #10b981;
  --success-foreground: #ffffff;

  /* 警告 - Amber */
  --warning: #f59e0b;
  --warning-foreground: #ffffff;
  --warning-bg: #fef3c7;
  --warning-border: #f59e0b;

  /* 错误 - Red */
  --destructive: #ef4444;
  --destructive-foreground: #ffffff;

  /* 文本 */
  --foreground: #09090b;
  --muted-foreground: #71717a;

  /* 圆角 */
  --radius: 0.5rem;
  --radius-sm: 0.375rem;
  --radius-lg: 0.75rem;

  /* 阴影 */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

/* ========== 基础重置 ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  border-radius: var(--radius);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #fafafa;
  color: var(--foreground);
  min-height: 100vh;
  line-height: 1.5;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

/* ========== Header ========== */
header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: white;
  padding: 24px 28px;
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
}

header h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
}

header p {
  opacity: 0.9;
  font-size: 14px;
}

/* ========== 流程步骤 - Shadcn Steps ========== */
.workflow-steps {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  overflow-x: auto;
  padding: 8px 4px;
  background: white;
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.step {
  flex: 1;
  min-width: 100px;
  padding: 14px 16px;
  background: #f4f4f5;
  border: 2px solid transparent;
  border-radius: var(--radius);
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.step:hover {
  border-color: var(--primary);
  background: #f0f0ff;
}

.step.active {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.2);
}

.step.completed {
  border-color: var(--success);
  background: var(--success);
  color: white;
}

.step-number {
  font-weight: 700;
  font-size: 20px;
  display: block;
}

.step-label {
  font-size: 12px;
  margin-top: 6px;
  font-weight: 500;
  display: block;
}

/* ========== 面板 - Shadcn Card ========== */
.panel {
  background: white;
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.panel-title {
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ========== 表单 - Shadcn Input ========== */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--foreground);
  font-size: 14px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 14px;
  transition: all 0.2s;
  background: white;
  color: var(--foreground);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.6;
}

/* ========== 复选框组 - Shadcn Badge/Toggle ========== */
.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.checkbox-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #f4f4f5;
  border: 1px solid var(--border-color);
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
  font-weight: 500;
}

.checkbox-item:hover {
  background: #e4e4e7;
  border-color: #d4d4d8;
}

.checkbox-item.selected {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* ========== 单选组 - Shadcn Radio Card ========== */
.radio-group {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.radio-item {
  display: flex;
  flex-direction: column;
  padding: 14px 18px;
  background: #f9f9f9;
  border: 2px solid var(--border-color);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
}

.radio-item:hover {
  border-color: var(--primary);
  background: #f0f0ff;
}

.radio-item.selected {
  border-color: var(--primary);
  background: #eef2ff;
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}

.radio-item .radio-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--foreground);
}

.radio-item .radio-desc {
  font-size: 12px;
  color: var(--muted-foreground);
  margin-top: 4px;
  line-height: 1.4;
}

.radio-item.selected .radio-name {
  color: var(--primary);
}

/* ========== 按钮 - Shadcn Button ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: var(--shadow);
}

.btn-primary:disabled {
  background: #d4d4d8;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-success {
  background: var(--success);
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-success:hover {
  background: #059669;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--foreground);
}

.btn-outline:hover {
  background: #f4f4f5;
  border-color: var(--primary);
  color: var(--primary);
}

/* ========== 搜索结果 - Shadcn Card ========== */
.search-results {
  margin-top: 20px;
}

.search-result {
  padding: 16px 20px;
  background: #f9f9f9;
  border-radius: var(--radius);
  margin-bottom: 12px;
  border-left: 4px solid var(--primary);
  transition: all 0.2s;
}

.search-result:hover {
  background: #f0f0f5;
  box-shadow: var(--shadow-sm);
}

.search-result-title {
  font-weight: 600;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-result-content {
  font-size: 13px;
  color: var(--muted-foreground);
  line-height: 1.6;
}

.search-result-score {
  font-size: 12px;
  color: var(--success);
  margin-top: 8px;
  font-weight: 500;
}

/* ========== 进度列表 - Shadcn Progress ========== */
.progress-list {
  margin-top: 20px;
}

.progress-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: #f9f9f9;
  border-radius: var(--radius);
  margin-bottom: 10px;
  border: 1px solid var(--border-color);
  transition: all 0.2s;
}

.progress-item:hover {
  background: #f4f4f5;
}

.progress-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.progress-icon.pending {
  background: #f4f4f5;
  color: var(--muted-foreground);
  border: 2px dashed #d4d4d8;
}

.progress-icon.loading {
  background: var(--warning);
  color: white;
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.progress-icon.done {
  background: var(--success);
  color: white;
}

.progress-icon.error {
  background: var(--destructive);
  color: white;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.progress-text {
  flex: 1;
}

.progress-title {
  font-weight: 500;
  font-size: 14px;
}

.progress-status {
  font-size: 12px;
  color: var(--muted-foreground);
  margin-top: 2px;
}

/* ========== 文章卡片 - Shadcn Collapsible ========== */
.article-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  overflow: hidden;
  background: white;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}

.article-card:hover {
  box-shadow: var(--shadow);
}

.article-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: #f9f9f9;
  cursor: pointer;
  transition: background 0.2s;
}

.article-header:hover {
  background: #f0f0f5;
}

.article-title {
  font-weight: 600;
  font-size: 15px;
}

.article-meta {
  font-size: 12px;
  color: var(--muted-foreground);
  margin-top: 4px;
}

.article-body {
  padding: 20px;
  display: none;
  border-top: 1px solid var(--border-color);
}

.article-body.show {
  display: block;
}

.article-content {
  line-height: 1.8;
  white-space: pre-wrap;
  font-size: 14px;
}

.article-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

/* ========== 审稿结果 - Shadcn Alert ========== */
.review-section {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  border-left: 4px solid var(--warning);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
}

.review-title {
  font-weight: 600;
  color: #92400e;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.review-content {
  line-height: 1.6;
  white-space: pre-wrap;
  color: #78350f;
  font-size: 14px;
}

/* ========== 加载动画 - Shadcn Skeleton ========== */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  z-index: 1000;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid #e4e4e7;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-text {
  margin-top: 16px;
  color: var(--muted-foreground);
  font-size: 14px;
}

/* ========== 状态类 ========== */
.hidden {
  display: none !important;
}

.status-passed {
  color: #22c55e !important;
}

.status-failed {
  color: #ef4444 !important;
}

.status-modified {
  color: #f59e0b !important;
}

/* ========== 修改通知 - Shadcn Badge ========== */
.modify-notice {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 1px solid #f59e0b;
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: #92400e;
}

.modify-notice .modify-icon {
  font-size: 18px;
}

.article-meta.status-modified {
  font-weight: 600;
  color: #f59e0b;
}

/* ========== 参数摘要 - Shadcn Badge ========== */
.params-summary {
  background: #f9f9f9;
  padding: 16px 20px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  border: 1px solid var(--border-color);
}

.params-summary-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border-color);
}

.params-summary-item:last-child {
  border-bottom: none;
}

.params-summary-label {
  color: var(--muted-foreground);
  font-size: 14px;
}

.params-summary-value {
  font-weight: 500;
  font-size: 14px;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
  .container {
    padding: 16px;
  }

  .workflow-steps {
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .step {
    min-width: 80px;
    padding: 10px 12px;
  }

  .step-number {
    font-size: 16px;
  }

  .step-label {
    font-size: 11px;
  }

  .radio-group {
    grid-template-columns: 1fr;
  }
}
