/* SEO Stats Dashboard — Custom Styles */

:root {
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --sidebar-bg: #1e1b4b;
  --sidebar-text: #c7d2fe;
  --sidebar-active: #4f46e5;
  --sidebar-hover: #312e81;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

/* ── Layout ── */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: 220px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-brand {
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand h1 {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.02em;
}

.sidebar-brand p {
  font-size: 11px;
  color: var(--sidebar-text);
  margin-top: 2px;
  opacity: 0.7;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s;
}

.sidebar-nav a:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.sidebar-nav a.active {
  background: rgba(79, 70, 229, 0.25);
  color: #fff;
  border-left-color: var(--primary);
}

.sidebar-nav .nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 12px;
  color: var(--sidebar-text);
  opacity: 0.6;
}

.sidebar-footer a {
  color: var(--sidebar-text);
  text-decoration: none;
}

.sidebar-footer a:hover { opacity: 1; color: #fff; }

/* ── Main content ── */
.main {
  margin-left: 220px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar h2 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
}

.content {
  padding: 24px 28px;
  flex: 1;
}

/* ── KPI Cards ── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.kpi-card .kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.kpi-card .kpi-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.kpi-card.accent-green  { border-top: 3px solid var(--success); }
.kpi-card.accent-blue   { border-top: 3px solid var(--info); }
.kpi-card.accent-purple { border-top: 3px solid var(--primary); }
.kpi-card.accent-amber  { border-top: 3px solid var(--warning); }
.kpi-card.accent-red    { border-top: 3px solid var(--danger); }

/* ── Cards / Panels ── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 24px;
  overflow: hidden;
}

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

.card-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.card-header .card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.card-body {
  padding: 20px;
}

.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.chart-grid .card { margin-bottom: 0; }

.chart-container {
  position: relative;
  height: 260px;
}

/* ── Tables ── */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  background: #f1f5f9;
  padding: 9px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }

tbody td {
  padding: 9px 12px;
  color: var(--text);
  vertical-align: middle;
}

.td-mono {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 12px;
}

.td-muted { color: var(--text-muted); }

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-success  { background: #d1fae5; color: #065f46; }
.badge-info     { background: #dbeafe; color: #1e40af; }
.badge-warning  { background: #fef3c7; color: #92400e; }
.badge-primary  { background: #ede9fe; color: #4c1d95; }
.badge-danger   { background: #fee2e2; color: #991b1b; }
.badge-secondary{ background: #f1f5f9; color: #475569; }

/* ── Filters / Forms ── */
.filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-bar input,
.filter-bar select {
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  background: var(--card-bg);
  outline: none;
  transition: border-color 0.15s;
}

.filter-bar input:focus,
.filter-bar select:focus {
  border-color: var(--primary);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background 0.15s, opacity 0.15s;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #f1f5f9; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #e2e8f0; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ── Pagination ── */
.pagination {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  padding: 16px 0 4px;
}

.pagination a, .pagination span {
  padding: 5px 11px;
  border-radius: 6px;
  font-size: 13px;
  text-decoration: none;
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--card-bg);
}

.pagination a:hover { background: #f1f5f9; }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .disabled { opacity: 0.4; pointer-events: none; }

/* ── Timeline (Profile Journey) ── */
.timeline {
  position: relative;
  padding-left: 28px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 9px;
  top: 0; bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  margin-bottom: 12px;
}

.timeline-dot {
  position: absolute;
  left: -24px;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--card-bg);
}

.timeline-dot.phase-1 { background: var(--info); }
.timeline-dot.phase-2 { background: var(--warning); }
.timeline-dot.phase-3 { background: var(--primary); }
.timeline-dot.phase-3.success { background: var(--success); }
.timeline-dot.phase-3.failure { background: var(--danger); }

.timeline-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
}

.timeline-card.phase-3-success {
  border-left: 3px solid var(--success);
}

.timeline-card.phase-3-failure {
  border-left: 3px solid var(--danger);
  opacity: 0.75;
}

.timeline-ts {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.timeline-title {
  font-weight: 600;
  color: var(--text);
}

.timeline-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ── Login page ── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--sidebar-bg);
}

.login-box {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 40px 36px;
  width: 360px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-box h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.login-box p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 28px;
}

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

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

.form-group input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

.form-group input:focus { border-color: var(--primary); }

.alert {
  padding: 10px 14px;
  border-radius: 7px;
  font-size: 13px;
  margin-bottom: 16px;
}

.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }

/* ── Progress bar ── */
.progress {
  height: 6px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  min-width: 80px;
}

.progress-bar {
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
  transition: width 0.3s;
}

.progress-bar.green { background: var(--success); }
.progress-bar.amber { background: var(--warning); }
.progress-bar.red   { background: var(--danger); }

/* ── Misc ── */
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-muted   { color: var(--text-muted); }
.text-right   { text-align: right; }
.text-center  { text-align: center; }
.fw-bold      { font-weight: 700; }
.mono         { font-family: monospace; font-size: 12px; }

.section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

.empty-state .empty-icon { font-size: 36px; margin-bottom: 10px; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .chart-grid { grid-template-columns: 1fr; }
  .kpi-grid   { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .sidebar { width: 0; overflow: hidden; }
  .main    { margin-left: 0; }
  .kpi-grid { grid-template-columns: 1fr; }
}
