/* Dashboard-specific styles — extends theme.css design tokens */

.dash-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.dash-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 5vw;
}

.logo-link {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.dash-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 0.25rem 0.65rem;
  border-radius: 100px;
  margin-left: 0.75rem;
  vertical-align: middle;
}

.dash-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-link {
  font-size: 0.9rem;
  color: var(--fg-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.nav-link:hover { color: var(--fg); }

.btn-run-all {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--accent);
  color: #0a0c10;
  border: none;
  border-radius: 8px;
  padding: 0.55rem 1.2rem;
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-run-all:hover { opacity: 0.85; }
.btn-run-all:disabled { opacity: 0.5; cursor: not-allowed; }

.dash-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 5vw 5rem;
}

/* Stats bar */
.stats-bar {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.stat-chip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 140px;
}

.stat-chip-num {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--fg);
  line-height: 1;
}

.stat-chip-num.accent-text { color: var(--accent); }

.stat-chip-label {
  font-size: 0.75rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Progress */
.scoring-progress {
  margin-bottom: 2rem;
}

.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.4s ease;
  width: 2%;
}

.progress-log {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  max-height: 200px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.log-line {
  padding: 0.2rem 0;
  border-bottom: 1px solid var(--border);
  color: var(--fg-muted);
}

.log-line:last-child { border-bottom: none; }
.log-name { color: var(--fg); }

/* Section */
.dash-section { }

.dash-section-header {
  margin-bottom: 1.5rem;
}

.dash-section-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.section-sub-sm {
  font-size: 0.88rem;
  color: var(--fg-muted);
}

/* Business grid */
.business-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.business-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
  position: relative;
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}

.business-card:hover {
  border-color: rgba(0, 229, 160, 0.3);
  transform: translateY(-1px);
}

.card-rank {
  position: absolute;
  top: 0.75rem;
  right: 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--fg-muted);
  opacity: 0.5;
}

/* Score ring */
.score-ring {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  position: relative;
}

.score-svg {
  width: 64px;
  height: 64px;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 4;
}

.ring-fill {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 151;
  transition: stroke-dashoffset 0.6s ease;
}

.score-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.score-num {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--fg);
}

.score-grade {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  margin-top: 1px;
}

.score-ring.unscored .score-num {
  font-size: 0.65rem;
  color: var(--fg-muted);
  text-align: center;
  line-height: 1.3;
}

/* Card body */
.card-body {
  flex: 1;
  min-width: 0;
}

.card-name {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-address {
  font-size: 0.78rem;
  color: var(--fg-muted);
  margin-bottom: 0.85rem;
}

/* Mini bars */
.card-bars {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.mini-bar-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mini-bar-label {
  font-size: 0.72rem;
  color: var(--fg-muted);
  width: 48px;
  flex-shrink: 0;
}

.mini-bar-track {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.mini-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.mini-bar-val {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--fg-muted);
  width: 24px;
  text-align: right;
}

.card-meta {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.meta-pill {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 0.15rem 0.5rem;
  color: var(--fg-muted);
}

/* Unscored card */
.card-unscored {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.unscored-text {
  font-size: 0.8rem;
  color: var(--fg-muted);
}

.btn-score-one {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 6px;
  padding: 0.25rem 0.65rem;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-score-one:hover { background: var(--accent-dim); }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 5rem 2rem;
  color: var(--fg-muted);
}

.empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state h3 { font-size: 1.2rem; color: var(--fg); margin-bottom: 0.5rem; }
.empty-state p { font-size: 0.9rem; }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  max-width: 680px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  color: var(--fg-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem 0.5rem;
}

.modal-close:hover { color: var(--fg); }

.modal-loading {
  text-align: center;
  padding: 3rem;
  color: var(--fg-muted);
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.modal-header { margin-bottom: 1.5rem; }
.modal-header h2 { font-size: 1.4rem; font-weight: 600; margin-bottom: 0.3rem; }
.modal-addr { font-size: 0.85rem; color: var(--fg-muted); }
.modal-site-link { color: var(--accent); text-decoration: none; }

.modal-score-row {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-big-score {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
}

.modal-score-num {
  font-family: var(--font-mono);
  font-size: 3.5rem;
  font-weight: 700;
  line-height: 1;
}

.modal-score-label {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--fg-muted);
}

.modal-grade-badge {
  border: 2px solid;
  border-radius: 8px;
  padding: 0.4rem 0.8rem;
  font-weight: 700;
  font-size: 0.9rem;
}

.modal-breakdown {
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.breakdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.breakdown-label {
  font-size: 0.85rem;
  width: 180px;
  flex-shrink: 0;
}

.breakdown-weight {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--fg-muted);
}

.breakdown-bar-wrap {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.breakdown-bar {
  height: 100%;
  border-radius: 8px;
  transition: width 0.5s ease;
}

.breakdown-val {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  width: 30px;
  text-align: right;
}

.modal-signals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  padding: 1.25rem;
  background: var(--bg-card);
  border-radius: 10px;
}

.signals-col h4 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
  margin-bottom: 0.75rem;
}

.signal-row {
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
  color: var(--fg-muted);
}

.signal-finding {
  font-size: 0.82rem;
  color: var(--fg);
  font-style: italic;
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: var(--bg-elevated);
  border-radius: 6px;
  border-left: 2px solid var(--accent);
}

.signal-source {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--fg-muted);
  margin-top: 0.5rem;
  text-transform: uppercase;
}

.modal-issues {
  margin-bottom: 1rem;
}

.modal-issues h4 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
}

.issue-row {
  font-size: 0.85rem;
  color: var(--fg-muted);
  padding: 0.3rem 0;
}

.modal-actions {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.btn-rescore {
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 8px;
  padding: 0.6rem 1.2rem;
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-rescore:hover { background: rgba(0, 229, 160, 0.2); }

.modal-unscored {
  padding: 2rem 0;
  font-size: 0.9rem;
  color: var(--fg-muted);
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Scan signals button */
.btn-scan-signals {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(167, 139, 250, 0.12);
  color: #a78bfa;
  border: 1px solid #a78bfa;
  border-radius: 8px;
  padding: 0.55rem 1.2rem;
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-scan-signals:hover { background: rgba(167, 139, 250, 0.2); }
.btn-scan-signals:disabled { opacity: 0.5; cursor: not-allowed; }

/* Signal monitor legend */
.signal-legend {
  margin-bottom: 1.5rem;
}

.signal-legend-inner {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.signal-pill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--fg-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 0.2rem 0.75rem;
}

.signal-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.signal-weight {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  opacity: 0.7;
}

/* 4-column signals grid in modal */
.modal-signals-4 {
  grid-template-columns: repeat(2, 1fr);
}

/* Wider modal for 4-column layout */
.modal {
  max-width: 860px;
}

/* SEO performance row inside detail modal */
.modal-seo-row {
  margin: 1.25rem 0;
  padding: 1rem 1.25rem;
  background: rgba(16, 185, 129, 0.05);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 10px;
}

.seo-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem 0.75rem;
}

.seo-item {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.seo-label {
  font-size: 0.7rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.seo-val {
  font-size: 0.85rem;
  font-family: var(--font-mono);
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

@media (max-width: 700px) {
  .modal-signals-4 { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .modal-signals { grid-template-columns: 1fr; }
  .business-grid { grid-template-columns: 1fr; }
  .stats-bar { gap: 0.75rem; }
  .stat-chip { min-width: 0; flex: 1; }
  .dash-nav { gap: 0.5rem; }
  .btn-scan-signals { padding: 0.5rem 0.7rem; font-size: 0.8rem; }
  .btn-run-all { padding: 0.5rem 0.7rem; font-size: 0.8rem; }
}
