﻿/* ── Page Speed Inspector ── */

/* Score circle */
.speed-score {
  width: 5rem;
  height: 5rem;
  border-radius: 50%;
  border: 3px solid currentColor;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  flex-shrink: 0;
  transition: color 0.3s;
}

.speed-score.score-good  { color: var(--success, #15803d); }
.speed-score.score-ok    { color: var(--warning, #b45309); }
.speed-score.score-poor  { color: var(--error,   #b91c1c); }

/* Results layout */
.speed-results {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 2rem;
  margin-top: 1.5rem;
}

.speed-results-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

@media (max-width: 768px) {
  .speed-results {
    grid-template-columns: 1fr;
  }
  .speed-results-left {
    flex-direction: row;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

/* Timing waterfall */
.timing-waterfall {
  display: flex;
  flex-direction: column;
}

.timing-phase {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.timing-phase:last-child {
  border-bottom: none;
}

.timing-phase-label {
  width: 120px;
  flex-shrink: 0;
  font-size: 0.78rem;
  color: var(--text-3);
  white-space: nowrap;
}

.timing-bar-wrap {
  flex: 1;
  height: 12px;
  background: var(--surface);
  border-radius: 6px;
  overflow: hidden;
}

.timing-bar {
  height: 100%;
  border-radius: 6px;
  transition: width 0.4s ease;
  min-width: 2px;
}

.timing-phase-value {
  width: 60px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-2);
  flex-shrink: 0;
}

/* Timing phase colors */
.phase-dns      .timing-bar { background: #0d9488; }
.phase-tcp      .timing-bar { background: #1d4ed8; }
.phase-tls      .timing-bar { background: #8b5cf6; }
.phase-ttfb     .timing-bar { background: var(--accent, #4f46e5); }
.phase-download .timing-bar { background: #15803d; }
.timing-bar.bar-zero        { background: var(--border); opacity: 0.4; }

/* Metrics grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.metric-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  background: #fff;
}

[data-design="dossier"] .metric-card,
[data-design="console"] .metric-card {
  background: var(--surface);
}

.metric-card-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  margin-bottom: 0.4rem;
}

.metric-card-value {
  font-size: 1.15rem;
  font-weight: 600;
  word-break: break-word;
}

.metric-card-value.value-good { color: var(--success, #15803d); }
.metric-card-value.value-warn { color: var(--warning, #b45309); }
.metric-card-value.value-bad  { color: var(--error,   #b91c1c); }

/* Recommendations */
.recommendations-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.rec-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  border-left: 3px solid transparent;
}

.rec-item.rec-high {
  border-left-color: var(--error, #b91c1c);
  background: rgba(220, 38, 38, 0.06);
}

.rec-item.rec-medium {
  border-left-color: var(--warning, #b45309);
  background: rgba(217, 119, 6, 0.06);
}

.rec-item.rec-low {
  border-left-color: var(--accent, #4f46e5);
  background: rgba(99, 102, 241, 0.06);
}

.rec-body {
  flex: 1;
  min-width: 0;
}

.rec-message {
  display: block;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text);
}

.rec-expand-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.35rem;
  font-size: 0.75rem;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  line-height: 1;
}

.rec-expand-btn:hover { text-decoration: underline; }

.rec-expand-arrow { display: inline-block; }

.rec-details {
  margin: 0.4rem 0 0;
  padding: 0.4rem 0.6rem;
  background: rgba(0,0,0,0.04);
  border-radius: var(--radius);
  list-style: none;
  max-height: 180px;
  overflow-y: auto;
}

[data-design="dossier"] .rec-details,
[data-design="console"] .rec-details {
  background: rgba(255,255,255,0.05);
}

.rec-detail-item {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-2);
  padding: 0.2rem 0;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.rec-priority {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  background: rgba(0,0,0,0.08);
  white-space: nowrap;
  align-self: flex-start;
  flex-shrink: 0;
}

/* Found-on URL line inside recommendation cards */
.rec-found-on {
  font-size: 0.75rem;
  color: var(--text-3);
  margin-top: 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rec-found-on a { color: var(--accent); text-decoration: none; }
.rec-found-on a:hover { text-decoration: underline; }

/* Deductions breakdown */
.deductions-list {
  width: 100%;
  list-style: none;
  padding: 0;
  margin: 0;
}

.deduction-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  padding: 0.25rem 0;
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
}

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

.deduction-pts {
  font-family: var(--font-mono);
  color: var(--error, #b91c1c);
  flex-shrink: 0;
  margin-left: 0.5rem;
}

/* Recent inspections section */
.recent-inspections-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.recent-inspection-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 0.85rem;
}

.recent-inspection-item:hover { background: var(--surface); }
.recent-inspection-item:last-child { border-bottom: none; }

.recent-insp-score {
  font-family: var(--font-mono);
  font-weight: 700;
  min-width: 2.5rem;
  text-align: center;
  font-size: 0.9rem;
}

.recent-insp-url {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--accent);
}

.recent-insp-meta {
  color: var(--text-3);
  font-size: 0.75rem;
  white-space: nowrap;
}
