/* ============================================
   SEO DIRECTIVE — Design System
   ============================================ */

:root {
  --bg: #0a0a0f;
  --bg-card: #12121a;
  --bg-card-hover: #1a1a26;
  --bg-input: #16161f;
  --border: #2a2a3a;
  --border-light: #1e1e2e;
  --text: #e8e8f0;
  --text-dim: #8888a0;
  --text-muted: #55556a;
  --accent: #6c5ce7;
  --accent-light: #a29bfe;
  --accent-glow: rgba(108, 92, 231, 0.15);
  --green: #00cec9;
  --green-dim: rgba(0, 206, 201, 0.12);
  --orange: #fdcb6e;
  --orange-dim: rgba(253, 203, 110, 0.12);
  --red: #ff6b6b;
  --red-dim: rgba(255, 107, 107, 0.12);
  --blue: #74b9ff;
  --blue-dim: rgba(116, 185, 255, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'DM Sans', -apple-system, sans-serif;
  --font-mono: 'Space Mono', monospace;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---- Header ---- */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-light);
}

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

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

.logo-icon {
  color: var(--accent);
  font-size: 20px;
}

.logo-text {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.5px;
}

.nav-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

/* ---- Hero ---- */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 24px 40px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -40%;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 800px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none;
}

.hero-content {
  max-width: 720px;
  width: 100%;
  position: relative;
  z-index: 1;
}

.hero-title {
  font-size: clamp(36px, 6vw, 64px);
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -2px;
  margin-bottom: 20px;
}

.hero-line {
  display: block;
}

.hero-line.accent {
  background: linear-gradient(135deg, var(--accent-light), var(--green));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: 17px;
  color: var(--text-dim);
  line-height: 1.7;
  margin-bottom: 40px;
  max-width: 560px;
}

/* ---- Search Box ---- */
.search-box {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.search-input-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.search-input {
  width: 100%;
  padding: 16px 20px;
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-options {
  display: flex;
  gap: 8px;
}

.select-mini {
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  outline: none;
}

.select-mini:focus {
  border-color: var(--accent);
}

.btn-analyze {
  padding: 16px 32px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  color: white;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
  white-space: nowrap;
  align-self: flex-start;
}

.btn-analyze:hover {
  background: #5a4bd6;
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(108, 92, 231, 0.3);
}

.btn-analyze:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-icon { font-size: 20px; }

/* ---- Tags ---- */
.search-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tag-label {
  font-size: 13px;
  color: var(--text-muted);
}

.tag {
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.tag:hover {
  border-color: var(--accent);
  color: var(--accent-light);
  background: var(--accent-glow);
}

/* ---- Loading ---- */
.loading-section {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 120px 24px 60px;
}

.loader-container {
  text-align: center;
}

.loader-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 24px;
  animation: spin 0.8s linear infinite;
}

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

.loader-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 32px;
  letter-spacing: -0.5px;
}

.loader-steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: left;
  max-width: 300px;
  margin: 0 auto;
}

.loader-step {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 14px;
  transition: color 0.3s;
}

.loader-step.active {
  color: var(--accent-light);
}

.loader-step.done {
  color: var(--green);
}

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
  transition: background 0.3s;
}

.loader-step.active .step-dot {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse-dot 1s ease infinite;
}

.loader-step.done .step-dot {
  background: var(--green);
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ---- Dashboard ---- */
.dashboard {
  max-width: 1200px;
  margin: 0 auto;
  padding: 100px 24px 60px;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 16px;
}

.dash-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -1px;
}

.dash-subtitle {
  color: var(--text-dim);
  font-size: 14px;
  margin-top: 4px;
}

.dash-header-right {
  display: flex;
  gap: 8px;
}

.btn-export, .btn-new {
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-export {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-dim);
}

.btn-export:hover {
  border-color: var(--accent);
  color: var(--text);
}

.btn-new {
  background: var(--accent);
  border: none;
  color: white;
}

.btn-new:hover {
  background: #5a4bd6;
}

/* ---- Stats Grid ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color 0.2s;
}

.stat-card:hover {
  border-color: var(--border);
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: -1px;
}

.stat-value.green { color: var(--green); }
.stat-value.orange { color: var(--orange); }
.stat-value.accent { color: var(--accent-light); }
.stat-value.blue { color: var(--blue); }

/* ---- Tabs ---- */
.tab-nav {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 24px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tab-nav::-webkit-scrollbar { display: none; }

.tab {
  padding: 12px 18px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.tab:hover {
  color: var(--text-dim);
}

.tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* ---- Tab Content ---- */
.tab-content {
  min-height: 400px;
}

.section-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  letter-spacing: -0.5px;
}

.section-subtitle {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 20px;
}

/* Cards & Tables */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.kw-table {
  width: 100%;
  border-collapse: collapse;
}

.kw-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 500;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-light);
}

.kw-table td {
  padding: 10px 12px;
  font-size: 14px;
  border-bottom: 1px solid var(--border-light);
}

.kw-table tr:last-child td {
  border-bottom: none;
}

.kw-table tr:hover td {
  background: rgba(255,255,255,0.02);
}

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-green { background: var(--green-dim); color: var(--green); }
.badge-orange { background: var(--orange-dim); color: var(--orange); }
.badge-red { background: var(--red-dim); color: var(--red); }
.badge-blue { background: var(--blue-dim); color: var(--blue); }
.badge-accent { background: var(--accent-glow); color: var(--accent-light); }

/* Chips */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  padding: 5px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-dim);
}

/* Page cards */
.page-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 12px;
  transition: border-color 0.2s;
}

.page-card:hover {
  border-color: var(--border);
}

.page-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.page-card-title {
  font-weight: 600;
  font-size: 15px;
}

.page-card-slug {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--green);
}

.page-card-meta {
  display: flex;
  gap: 12px;
  font-size: 13px;
  color: var(--text-dim);
}

/* Cluster cards */
.cluster-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 20px;
}

.cluster-title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cluster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

/* Quick wins */
.qw-card {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  margin-bottom: 10px;
}

.qw-number {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-glow);
  color: var(--accent-light);
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.qw-content { flex: 1; }

.qw-action {
  font-weight: 500;
  font-size: 14px;
  margin-bottom: 6px;
}

.qw-meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Technical directives */
.directive {
  padding: 16px;
  background: var(--bg-card);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 12px;
}

.directive-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent-light);
  font-weight: 600;
  margin-bottom: 6px;
}

.directive-value {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  word-break: break-all;
}

/* Roadmap */
.roadmap-phase {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  position: relative;
}

.phase-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.phase-title {
  font-size: 16px;
  font-weight: 700;
}

.phase-timeline {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-light);
  background: var(--accent-glow);
  padding: 4px 12px;
  border-radius: 20px;
}

.phase-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.phase-stat {
  padding: 12px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
}

.phase-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.phase-stat-value {
  font-weight: 600;
  font-size: 16px;
}

.phase-focus {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.6;
}

/* Error */
.error-section {
  min-height: 40vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 120px 24px 60px;
}

.error-box {
  text-align: center;
  max-width: 400px;
}

.error-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 16px;
}

.error-box h3 {
  font-size: 20px;
  margin-bottom: 8px;
}

.error-box p {
  color: var(--text-dim);
  font-size: 14px;
  margin-bottom: 20px;
  line-height: 1.6;
}

/* Summary section specifics */
.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.summary-text {
  font-size: 15px;
  color: var(--text-dim);
  line-height: 1.7;
}

.priority-list {
  list-style: none;
  padding: 0;
}

.priority-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.priority-list li:last-child {
  border-bottom: none;
}

.priority-bullet {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

/* Blog topics */
.blog-topic {
  padding: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.blog-topic-title {
  font-weight: 500;
  font-size: 14px;
  margin-bottom: 4px;
}

.blog-topic-kw {
  font-size: 12px;
  color: var(--green);
  font-family: var(--font-mono);
}

.blog-topic-angle {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* Data sources info */
.data-sources-info {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.source-badge {
  padding: 4px 12px;
  background: var(--green-dim);
  color: var(--green);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Opportunity score */
.opportunity-score {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.opp-number {
  font-size: 48px;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: -2px;
}

.opp-number.green { color: var(--green); }
.opp-number.orange { color: var(--orange); }
.opp-number.accent { color: var(--accent-light); }

.opp-label {
  font-size: 18px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Question items */
.question-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
  gap: 12px;
}

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

.question-text {
  font-size: 14px;
  color: var(--text);
  flex: 1;
}

.question-meta {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* Cluster meta */
.cluster-meta {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Responsive */
@media (max-width: 768px) {
  .search-box {
    flex-direction: column;
  }
  
  .btn-analyze {
    width: 100%;
    justify-content: center;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-header {
    flex-direction: column;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .cluster-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 28px;
    letter-spacing: -1px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }
}
