/* pages/seo-gen.css — SEO Article Generator (FE-1B: Professional SaaS UI) */

/* ═══════════════════════════════════════════════════════════
   LAYOUT — 2-column: config steps (left) + result (right)
═══════════════════════════════════════════════════════════ */
.seo-page { display: grid; grid-template-columns: 440px 1fr; gap: 28px; min-height: calc(100vh - 120px); align-items: start; }
@media (max-width: 980px) { .seo-page { grid-template-columns: 1fr; } }

.seo-steps { display: flex; flex-direction: column; gap: 20px; }

/* ═══════════════════════════════════════════════════════════
   STEP CARD — depth with shadow, rounded, hover lift
═══════════════════════════════════════════════════════════ */
.seo-step {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}
.seo-step:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }

/* ─── Step Header ─────────────────────────────────────── */
.seo-step-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--border-subtle);
}

.seo-step-icon-box {
  width: 36px; height: 36px; border-radius: var(--radius-md);
  background: var(--surface-sunken); border: 1px solid var(--border-subtle);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.seo-step-icon-box svg { width: 18px; height: 18px; color: var(--text-secondary); stroke-width: 1.5; }

.seo-step-titles { flex: 1; min-width: 0; }
.seo-step-title { font-size: 13px; font-weight: 700; color: var(--text-primary); line-height: 1.3; }
.seo-step-subtitle { font-size: 11px; color: var(--text-tertiary); margin-top: 1px; }

.seo-step-num {
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  color: var(--text-disabled); flex-shrink: 0; letter-spacing: -0.5px;
}

.seo-step-badge {
  font-size: 9px; font-weight: 700; padding: 2px 7px; border-radius: 10px;
  text-transform: uppercase; letter-spacing: 0.4px;
}
.seo-step-badge.soon { background: rgba(217, 119, 6, 0.08); color: var(--status-reviewing); }
.seo-step-badge.active { background: rgba(22, 163, 106, 0.1); color: #16a36a; }

/* ─── Step Body ───────────────────────────────────────── */
.seo-step-body { padding: 16px 18px; }

/* ═══════════════════════════════════════════════════════════
   SEGMENTED CONTROL (Goal selector)
═══════════════════════════════════════════════════════════ */
.seo-segment-group {
  display: flex; gap: 2px; padding: 3px;
  background: var(--surface-sunken); border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}
.seo-segment {
  flex: 1; padding: 7px 6px; border-radius: var(--radius-sm);
  font-size: 11px; font-weight: 500; text-align: center;
  color: var(--text-tertiary); cursor: pointer; border: none; background: transparent;
  transition: all 0.15s ease; user-select: none; white-space: nowrap;
  display: flex; align-items: center; justify-content: center; gap: 5px;
}
.seo-segment svg { width: 13px; height: 13px; flex-shrink: 0; }
.seo-segment:hover:not(.active) { color: var(--text-secondary); }
.seo-segment.active {
  background: var(--surface-card); color: var(--text-primary); font-weight: 600;
  box-shadow: var(--shadow-xs);
}

/* ═══════════════════════════════════════════════════════════
   CONTENT STYLE GRID
═══════════════════════════════════════════════════════════ */
.seo-style-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 600px) { .seo-style-grid { grid-template-columns: repeat(2, 1fr); } }

.seo-style-card {
  padding: 14px 12px; border-radius: var(--radius-md); position: relative;
  border: 1.5px solid var(--border-default); background: var(--surface-base);
  cursor: pointer; transition: all 0.15s ease; text-align: left;
}
.seo-style-card:hover:not(.disabled) { border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.seo-style-card.active {
  border-color: #2563EB; background: rgba(37, 99, 235, 0.03);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.15);
}
.seo-style-card.disabled { opacity: 0.45; cursor: not-allowed; }
.seo-style-card.full-width { grid-column: 1 / -1; }

.seo-style-icon-box {
  width: 30px; height: 30px; border-radius: var(--radius-sm);
  background: var(--surface-sunken); border: 1px solid var(--border-subtle);
  display: flex; align-items: center; justify-content: center; margin-bottom: 8px;
}
.seo-style-icon-box svg { width: 14px; height: 14px; color: var(--text-secondary); }
.seo-style-card.active .seo-style-icon-box { background: rgba(37, 99, 235, 0.08); border-color: rgba(37, 99, 235, 0.2); }
.seo-style-card.active .seo-style-icon-box svg { color: #2563EB; }

.seo-style-name { font-size: 12px; font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.seo-style-desc { font-size: 10px; color: var(--text-tertiary); line-height: 1.4; }

/* Active check mark */
.seo-style-check {
  position: absolute; top: 8px; right: 8px; width: 18px; height: 18px; border-radius: 50%;
  background: #2563EB; display: flex; align-items: center; justify-content: center;
}
.seo-style-check svg { width: 10px; height: 10px; color: #fff; }

/* Hot badge */
.seo-style-hot {
  position: absolute; top: 8px; right: 8px;
  font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 6px;
  background: rgba(217, 119, 6, 0.1); color: #d97706; text-transform: uppercase;
}

/* ═══════════════════════════════════════════════════════════
   IMAGE SOURCE TABS
═══════════════════════════════════════════════════════════ */
.seo-img-tabs {
  display: flex; gap: 2px; padding: 3px;
  background: var(--surface-sunken); border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}
.seo-img-tab {
  flex: 1; padding: 7px 8px; font-size: 11px; font-weight: 600; text-align: center;
  border-radius: var(--radius-sm); color: var(--text-tertiary); cursor: pointer;
  transition: all 0.15s ease; border: none; background: transparent;
  display: flex; align-items: center; justify-content: center; gap: 5px;
}
.seo-img-tab svg { width: 13px; height: 13px; flex-shrink: 0; }
.seo-img-tab.active { background: var(--surface-card); color: var(--text-primary); box-shadow: var(--shadow-xs); }
.seo-img-tab.disabled { opacity: 0.4; cursor: not-allowed; }

/* ═══════════════════════════════════════════════════════════
   STEPPER
═══════════════════════════════════════════════════════════ */
.seo-stepper {
  display: inline-flex; align-items: center;
  border: 1px solid var(--border-default); border-radius: var(--radius-md); overflow: hidden;
}
.seo-stepper-btn {
  width: 32px; height: 32px; border: none;
  background: var(--surface-sunken); color: var(--text-secondary);
  font-size: 15px; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.12s ease;
}
.seo-stepper-btn:hover:not(:disabled) { background: var(--border-default); }
.seo-stepper-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.seo-stepper-val {
  width: 40px; text-align: center; font-size: 14px; font-weight: 700;
  color: var(--text-primary); height: 32px; line-height: 32px;
  border-left: 1px solid var(--border-default); border-right: 1px solid var(--border-default);
  background: var(--surface-card);
}

/* ═══════════════════════════════════════════════════════════
   COST ESTIMATE
═══════════════════════════════════════════════════════════ */
.cost-preview {
  background: var(--surface-card); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); padding: 14px 18px;
  box-shadow: var(--shadow-xs);
}
.cost-preview-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.cost-icon { display: flex; align-items: center; }
.cost-icon svg { width: 16px; height: 16px; color: var(--text-tertiary); }
.cost-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }

.cost-preview-body { min-height: 20px; }
.cost-placeholder { font-size: 12px; color: var(--text-disabled); }
.cost-loading { font-size: 12px; color: var(--text-tertiary); }
.cost-error { font-size: 12px; color: var(--status-live); }

.cost-main { display: flex; align-items: baseline; gap: 6px; margin-bottom: 2px; }
.cost-amount { font-size: 18px; font-weight: 800; color: var(--text-primary); }
.cost-usd { font-size: 12px; color: var(--text-tertiary); }
.cost-meta { display: flex; gap: 6px; align-items: center; }
.cost-model { font-size: 11px; color: var(--text-tertiary); font-weight: 500; }
.cost-sep { font-size: 11px; color: var(--text-disabled); }
.cost-tokens { font-size: 11px; color: var(--text-tertiary); }

/* ═══════════════════════════════════════════════════════════
   GENERATE BUTTON
═══════════════════════════════════════════════════════════ */
.seo-gen-btn {
  width: 100%; padding: 14px 20px; border: none; border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #0F172A, #1E3A8A);
  color: #fff; font-size: 14px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: all 0.2s ease; box-shadow: var(--shadow-sm); letter-spacing: 0.2px;
}
.seo-gen-btn svg { width: 18px; height: 18px; }
.seo-gen-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: var(--shadow-md); background: linear-gradient(135deg, #1e293b, #2563EB); }
.seo-gen-btn:active:not(:disabled) { transform: translateY(0); }
.seo-gen-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

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

/* ═══════════════════════════════════════════════════════════
   RESULT PANEL
═══════════════════════════════════════════════════════════ */
.seo-result-panel {
  background: var(--surface-card); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-xs);
  overflow: hidden; position: sticky; top: 60px;
}
.seo-result-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--border-subtle);
}
.seo-result-title { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.seo-result-count { font-size: 11px; color: var(--text-disabled); font-weight: 500; }
.seo-result-body { min-height: 340px; }

/* ─── Empty State ─────────────────────────────────────── */
.seo-empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 70px 30px; gap: 14px; }
.seo-empty-icon { width: 64px; height: 64px; border-radius: 50%; background: var(--surface-sunken); border: 1px solid var(--border-subtle); display: flex; align-items: center; justify-content: center; }
.seo-empty-icon svg { width: 26px; height: 26px; color: var(--text-disabled); }
.seo-empty-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.seo-empty-desc { font-size: 12px; color: var(--text-disabled); max-width: 240px; line-height: 1.5; }

/* ─── Progress Steps ─────────────────────────────────── */
.seo-progress-steps { display: flex; flex-direction: column; gap: 0; padding: 24px 20px; }
.seo-progress-step { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--text-disabled); padding: 10px 0; border-bottom: 1px solid var(--border-subtle); transition: color 0.3s; }
.seo-progress-step:last-child { border-bottom: none; }
.seo-progress-step.active { color: var(--text-primary); font-weight: 600; }
.seo-progress-step.done { color: var(--status-posted); font-weight: 500; }
.seo-progress-step.error { color: var(--status-live); }

.seo-step-icon { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; border-radius: 50%; font-size: 12px; background: var(--surface-sunken); }
.seo-progress-step.active .seo-step-icon { background: rgba(37, 99, 235, 0.08); color: #2563EB; }
.seo-progress-step.done .seo-step-icon { background: rgba(22, 163, 106, 0.1); color: var(--status-posted); }
.seo-progress-step.error .seo-step-icon { background: rgba(220, 38, 38, 0.1); color: var(--status-live); }

/* ─── Result Card ─────────────────────────────────────── */
.seo-result-card { padding: 20px; }

/* ─── Score ────────────────────────────────────────────── */
.seo-score-hero { display: flex; align-items: center; gap: 20px; padding: 20px; background: var(--surface-sunken); border-radius: var(--radius-lg); margin-bottom: 20px; border: 1px solid var(--border-subtle); }
.seo-score-circle { width: 72px; height: 72px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 800; color: #fff; flex-shrink: 0; box-shadow: var(--shadow-sm); }
.seo-score-circle.grade-success { background: linear-gradient(135deg, #22c55e, #16a34a); }
.seo-score-circle.grade-warning { background: linear-gradient(135deg, #f59e0b, #d97706); }
.seo-score-circle.grade-error   { background: linear-gradient(135deg, #ef4444, #dc2626); }
.seo-score-info { flex: 1; }
.seo-grade-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.seo-score-label { font-size: 12px; color: var(--text-tertiary); }

/* ─── Breakdown ───────────────────────────────────────── */
.seo-breakdown { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.seo-breakdown-item { display: flex; align-items: center; gap: 10px; }
.seo-breakdown-label { width: 100px; font-size: 11px; font-weight: 600; color: var(--text-secondary); flex-shrink: 0; }
.seo-breakdown-bar { flex: 1; height: 6px; background: var(--border-default); border-radius: 3px; overflow: hidden; }
.seo-breakdown-fill { height: 100%; border-radius: 3px; transition: width 0.6s ease; }
.seo-breakdown-fill.fill-success { background: linear-gradient(90deg, #22c55e, #16a34a); }
.seo-breakdown-fill.fill-warning { background: linear-gradient(90deg, #f59e0b, #d97706); }
.seo-breakdown-fill.fill-error   { background: linear-gradient(90deg, #ef4444, #dc2626); }
.seo-breakdown-score { width: 28px; text-align: right; font-size: 11px; font-weight: 700; color: var(--text-primary); flex-shrink: 0; }

/* ─── Recommendations ─────────────────────────────────── */
.seo-recs { margin-bottom: 16px; }
.seo-rec-item { display: flex; align-items: flex-start; gap: 8px; padding: 6px 0; font-size: 12px; color: var(--text-secondary); border-bottom: 1px solid var(--border-subtle); }
.seo-rec-item:last-child { border-bottom: none; }
.seo-rec-icon { flex-shrink: 0; width: 16px; text-align: center; font-size: 12px; }
.seo-rec-icon.sev-error   { color: #dc2626; }
.seo-rec-icon.sev-warning { color: #d97706; }
.seo-rec-icon.sev-info    { color: #2563eb; }

/* ─── Meta Preview ────────────────────────────────────── */
.seo-meta-preview { background: var(--surface-sunken); border-radius: var(--radius-md); padding: 14px; margin-bottom: 16px; border: 1px solid var(--border-subtle); }
.seo-meta-title { font-size: 16px; font-weight: 600; color: #1a0dab; margin-bottom: 4px; word-break: break-word; }
.seo-meta-url { font-size: 12px; color: #006621; margin-bottom: 4px; }
.seo-meta-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }

/* ─── Content Preview ─────────────────────────────────── */
.seo-content-preview { border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 20px; max-height: 500px; overflow-y: auto; font-size: 14px; line-height: 1.8; color: var(--text-primary); }
.seo-content-preview h1 { font-size: 22px; font-weight: 700; margin: 0 0 16px; }
.seo-content-preview h2 { font-size: 18px; font-weight: 600; margin: 20px 0 10px; color: var(--text-primary); }
.seo-content-preview h3 { font-size: 15px; font-weight: 600; margin: 16px 0 8px; }
.seo-content-preview p  { margin: 0 0 12px; }
.seo-content-preview ul, .seo-content-preview ol { margin: 0 0 12px; padding-left: 20px; }
.seo-content-preview li { margin-bottom: 4px; }
.seo-content-preview img { max-width: 100%; border-radius: 6px; margin: 8px 0; }
.seo-content-preview strong { font-weight: 600; }

/* ─── Article Actions ─────────────────────────────────── */
.seo-article-actions { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }

/* ─── Section Headers ─────────────────────────────────── */
.seo-section-title { font-size: 11px; font-weight: 700; color: var(--text-tertiary); margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.6px; }

/* ─── Tags ────────────────────────────────────────────── */
.seo-tags-wrap { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 10px; border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--surface-base); min-height: 38px; cursor: text; transition: border-color 0.12s ease, box-shadow 0.12s ease; }
.seo-tags-wrap:focus-within { border-color: #2563EB; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08); }
.seo-tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; background: rgba(37, 99, 235, 0.06); border-radius: var(--radius-sm); font-size: 12px; color: #2563EB; font-weight: 500; }
.seo-tag-remove { cursor: pointer; opacity: 0.5; font-size: 14px; line-height: 1; transition: opacity 0.12s; }
.seo-tag-remove:hover { opacity: 1; }
.seo-tags-input { border: none; outline: none; background: transparent; font-size: 13px; flex: 1; min-width: 80px; padding: 2px 0; color: var(--text-primary); }

/* ─── Form Row ────────────────────────────────────────── */
.seo-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 500px) { .seo-form-row { grid-template-columns: 1fr; } }

/* ─── Pill group (kept for delegate selector compat) ─── */
.seo-pill-group { display: none; }
