/* ============================================
   SEO REPORTER — GLOBAL STYLES
   ============================================ */

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #242836;
  --border: #2e3347;
  --text: #e8eaf0;
  --text-muted: #7a7f9a;
  --accent: #6c63ff;
  --accent-hover: #5a52e0;
  --green: #22c55e;
  --amber: #f59e0b;
  --red: #ef4444;
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

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

/* ── Login ─────────────────────────────────────────────────────── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
}

.login-brand {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 6px;
}

.login-sub {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 32px;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  letter-spacing: 0.03em;
}

input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  transition: border-color 0.2s;
}

input:focus {
  outline: none;
  border-color: var(--accent);
}

.form-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid var(--red);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--red);
  margin-bottom: 16px;
}

.btn-primary {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Dashboard layout ──────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-brand { font-size: 17px; font-weight: 700; }
.topbar-controls { display: flex; gap: 10px; align-items: center; }

select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  color: var(--text);
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
}

select:focus { outline: none; border-color: var(--accent); }

.btn-logout {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 14px;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

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

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

/* ── Score cards ────────────────────────────────────────────────── */
.scorecards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.scorecard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
}

.scorecard-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 10px;
}

.scorecard-value {
  font-size: 36px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 8px;
}

.scorecard-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.status-healthy { background: rgba(34,197,94,0.15); color: var(--green); }
.status-attention { background: rgba(245,158,11,0.15); color: var(--amber); }
.status-critical { background: rgba(239,68,68,0.15); color: var(--red); }

/* ── Charts ─────────────────────────────────────────────────────── */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 28px;
}

@media (max-width: 768px) {
  .charts-row { grid-template-columns: 1fr; }
}

.chart-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
}

.chart-box h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 18px;
}

/* ── Data panels ────────────────────────────────────────────────── */
.panels-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 28px;
}

@media (max-width: 900px) {
  .panels-row { grid-template-columns: 1fr; }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.panel-header h3 {
  font-size: 14px;
  font-weight: 600;
}

.panel-body { padding: 16px 20px; }

/* ── Tables ─────────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

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

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

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface2); }

.word-break { word-break: break-all; font-size: 12px; }
.text-muted { color: var(--text-muted); }
.text-green { color: var(--green); }
.text-amber { color: var(--amber); }
.text-red { color: var(--red); }

/* ── AI Analysis sections ───────────────────────────────────────── */
.ai-section {
  margin-bottom: 20px;
}

.ai-section h4 {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.ai-section p, .ai-section li {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
}

.ai-section ul {
  padding-left: 18px;
}

.ai-section li { margin-bottom: 4px; }

/* ── Loading / empty states ──────────────────────────────────────── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  color: var(--text-muted);
}

.skeleton {
  background: linear-gradient(90deg, var(--surface2) 25%, var(--border) 50%, var(--surface2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 6px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .container { padding: 16px; }
  .scorecards { grid-template-columns: 1fr 1fr; }
  .topbar { padding: 0 16px; }
}
/* ── Report Detail Page ─────────────────────────────────────────── */
.report-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 30px;
  margin-bottom: 24px;
}

.report-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
}

.report-site-name {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

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

.report-score-block {
  text-align: right;
}

.report-score {
  font-size: 56px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 6px;
}

.report-meta-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.meta-chip {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.report-history-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.history-dot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: all 0.15s;
}

.history-dot:hover { border-color: var(--border); background: var(--surface2); }
.history-dot.active { border-color: var(--accent); background: rgba(108,99,255,0.08); }

.history-dot-score {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}

.history-dot-date {
  font-size: 10px;
  color: var(--text-muted);
}

/* ── Tabs ─────────────────────────────────────────────────────────── */
.tabs-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

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

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

.tab-panel { animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.tab-section { margin-bottom: 28px; }
.tab-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

/* ── Metric grid ──────────────────────────────────────────────────── */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  text-align: center;
}

.metric-val {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 4px;
}

.metric-lbl {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

/* ── Issues list ──────────────────────────────────────────────────── */
.issues-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.issue-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
}

.issue-critical { border-left: 3px solid var(--red); }
.issue-warning { border-left: 3px solid var(--amber); }
.issue-info { border-left: 3px solid var(--accent); }

.issue-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

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

.issue-severity {
  font-weight: 600;
  text-transform: uppercase;
}

.issue-page {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── AI text ──────────────────────────────────────────────────────── */
.ai-text {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
}

.ai-text p { margin-bottom: 12px; }
.ai-text li { margin-bottom: 6px; }

/* ── Clickable scorecard ──────────────────────────────────────────── */
.scorecard.clickable { cursor: pointer; transition: border-color 0.15s; }
.scorecard.clickable:hover { border-color: var(--accent); }

/* ── Empty state ──────────────────────────────────────────────────── */
.empty-state {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

.table-url {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}
