/* PageSpeed Tracker — Dashboard Styles */
:root {
  --bg: #f5f5f5;
  --card-bg: #fff;
  --nav-bg: #1a1a2e;
  --accent: #e94560;
  --text: #1a1a2e;
  --text-light: #666;
  --border: #e5e7eb;
  --good: #0cce6b;
  --average: #ffa400;
  --poor: #ff4e42;
  --radius: 8px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; font-size: 14px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Navigation */
.top-nav { background: #000; color: #fff; padding: 0 2rem; display: flex; align-items: center; height: 52px; }
.nav-brand { font-weight: 700; font-size: 1rem; margin-right: 2rem; color: #fff; text-decoration: none; min-width: 350px; }
.nav-brand:hover { color: #fff; text-decoration: none; }
a.nav-brand > span { font-size: 12px !important; padding-top: 0px !important; font-weight: normal; display: inline-block; border-left: 1px solid #a2c338; padding-left: 10px; letter-spacing: 2px; text-transform: uppercase; color: #a2c338; }
.nav-site-name { color: #000; font-size: 14px; background: #a2c338; text-align: center; display: inline-block; padding: 2px 15px; font-weight: 600; margin-right: 1rem; }
.nav-links a { color: rgba(255,255,255,0.7); padding: 0.5rem 1rem; font-size: 0.85rem; border-radius: 4px; }
.nav-links a:hover, .nav-links a.active { color: #fff; background: rgba(255,255,255,0.1); text-decoration: none; }

/* Site cards (landing page) */
.site-card { background: var(--card-bg); border-radius: var(--radius); padding: 1.5rem; box-shadow: 0 1px 4px rgba(0,0,0,0.08); transition: box-shadow 0.2s; cursor: pointer; text-decoration: none; color: var(--text); display: block; }
.site-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.12); text-decoration: none; }
.site-card h3 { font-size: 1.1rem; margin-bottom: 0.2rem; }
.site-card .domain { color: var(--text-light); font-size: 0.8rem; margin-bottom: 1rem; }

/* Settings — common page list */
.cp-list { list-style: none; padding: 0; }
.cp-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-radius: 6px; margin-bottom: 0.5rem; background: var(--card-bg); }
.cp-item:hover { border-color: #ccc; }
.cp-handle { cursor: grab; color: #ccc; font-size: 1.2rem; }
.cp-path { flex: 1; font-size: 0.85rem; font-family: monospace; }
.cp-label { color: var(--text-light); font-size: 0.8rem; min-width: 120px; }
.cp-remove { color: var(--poor); cursor: pointer; border: none; background: none; font-size: 1rem; padding: 0.25rem; }
.cp-remove:hover { color: #c0392b; }

/* INP predicted badge */
.inp-badge { font-size: 0.7rem; font-weight: 600; }

/* Add site modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: var(--card-bg); border-radius: 12px; padding: 2rem; width: 90%; max-width: 500px; box-shadow: 0 8px 32px rgba(0,0,0,0.2); }

/* Layout */
.container { max-width: 1100px; margin: 0 auto; padding: 1.5rem 2rem; }
.footer { text-align: center; color: #aaa; font-size: 0.75rem; padding: 2rem 0; }

/* Cards */
.card { background: var(--card-bg); border-radius: var(--radius); padding: 1.25rem; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.card h3 { font-size: 0.8rem; text-transform: uppercase; color: var(--text-light); margin-bottom: 0.5rem; letter-spacing: 0.3px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }

/* Score gauge */
.score-gauge { width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; font-weight: 700; margin: 0 auto 0.5rem; }
.score-gauge.good { background: rgba(12,206,107,0.12); color: var(--good); border: 3px solid var(--good); }
.score-gauge.average { background: rgba(255,164,0,0.12); color: var(--average); border: 3px solid var(--average); }
.score-gauge.poor { background: rgba(255,78,66,0.12); color: var(--poor); border: 3px solid var(--poor); }
.score-label { text-align: center; font-size: 0.7rem; color: var(--text-light); text-transform: uppercase; }

/* Score inline */
.score-inline { font-weight: 700; padding: 2px 6px; border-radius: 4px; font-size: 0.85rem; }
.score-inline.good { background: rgba(12,206,107,0.15); color: var(--good); }
.score-inline.average { background: rgba(255,164,0,0.15); color: var(--average); }
.score-inline.poor { background: rgba(255,78,66,0.15); color: var(--poor); }

/* Badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 0.7rem; font-weight: 700; }
.badge-good, .badge-pass { background: #d4edda; color: #155724; }
.badge-average { background: #fff3cd; color: #856404; }
.badge-poor, .badge-fail { background: #f8d7da; color: #721c24; }
.badge-mobile { background: #e3f2fd; color: #1565c0; }
.badge-desktop { background: #f3e5f5; color: #7b1fa2; }

/* Tables */
table { width: 100%; border-collapse: collapse; background: var(--card-bg); border-radius: var(--radius); overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.06); margin-bottom: 1.5rem; }
th { background: #fafafa; text-align: left; padding: 0.6rem 0.75rem; font-size: 0.7rem; text-transform: uppercase; color: var(--text-light); border-bottom: 2px solid var(--border); letter-spacing: 0.3px; }
td { padding: 0.5rem 0.75rem; border-bottom: 1px solid #f0f0f0; font-size: 0.85rem; }
tr:last-child td { border-bottom: none; }
tr:hover { background: #fafafa; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Section headers */
.section-title { font-size: 1.1rem; margin: 1.5rem 0 0.75rem; color: var(--text); }
.section-subtitle { font-size: 0.85rem; color: var(--text-light); margin-bottom: 1rem; }

/* Buttons */
.btn { display: inline-block; padding: 0.5rem 1.25rem; border-radius: 6px; font-size: 0.85rem; font-weight: 600; border: none; cursor: pointer; transition: background 0.2s; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #c73350; text-decoration: none; }
.btn-secondary { background: #e5e7eb; color: var(--text); }
.btn-secondary:hover { background: #d1d5db; text-decoration: none; }
.btn-sm { padding: 0.3rem 0.75rem; font-size: 0.75rem; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.8rem; font-weight: 600; margin-bottom: 0.3rem; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.3px; }
.form-group input, .form-group select { width: 100%; padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-radius: 6px; font-size: 0.9rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* Progress bar */
.progress-bar { width: 100%; height: 8px; background: #e5e7eb; border-radius: 4px; overflow: hidden; margin: 0.5rem 0; }
.progress-fill { height: 100%; background: var(--accent); transition: width 0.3s; border-radius: 4px; }
.progress-fill.running {
  background: linear-gradient(90deg, var(--accent) 0%, #ff7b8a 50%, var(--accent) 100%);
  background-size: 200% 100%;
  animation: progress-slide 1.5s linear infinite;
}
.progress-fill.completed { background: #a2c338; animation: none; }
.progress-fill.failed { background: var(--poor); animation: none; }
.progress-fill.queued {
  background: linear-gradient(90deg, #e5e7eb 0%, #cfd4db 50%, #e5e7eb 100%);
  background-size: 200% 100%;
  animation: progress-slide 2s linear infinite;
}
@keyframes progress-slide {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* History chart (CSS-only bars) */
.chart-bars { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding: 0; margin: 1rem 0; }
.chart-bar { flex: 1; border-radius: 3px 3px 0 0; min-width: 8px; position: relative; transition: height 0.3s; cursor: pointer; }
.chart-bar.good { background: var(--good); }
.chart-bar.average { background: var(--average); }
.chart-bar.poor { background: var(--poor); }
.chart-bar:hover::after { content: attr(data-label); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: var(--nav-bg); color: #fff; padding: 2px 6px; border-radius: 4px; font-size: 0.65rem; white-space: nowrap; }
.chart-dates { display: flex; gap: 3px; font-size: 0.6rem; color: var(--text-light); }
.chart-dates span { flex: 1; text-align: center; min-width: 8px; }

/* Change annotation */
.change-row td { background: #fffbeb; font-style: italic; }
.change-marker { color: var(--accent); font-weight: 700; }

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-light); }
.text-sm { font-size: 0.8rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

/* Alert */
.alert { padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 0.85rem; }
.alert-info { background: #e3f2fd; color: #1565c0; }
.alert-success { background: #d4edda; color: #155724; }
.alert-error { background: #f8d7da; color: #721c24; }

/* Two-column layout */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 768px) { .two-col { grid-template-columns: 1fr; } .form-row { grid-template-columns: 1fr; } }

/* SVG charts */
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.5rem; }
.svg-chart-container { padding: 0.75rem; }
.svg-chart-container svg { width: 100%; height: auto; }

/* Predictions */
.prediction-improved { color: var(--good); font-weight: 600; }
.prediction-worse { color: var(--poor); font-weight: 600; }
.prediction-note { font-size: 0.75rem; color: var(--text-light); margin-top: 0.5rem; padding: 0.5rem; background: #f8f9fa; border-radius: 4px; }

/* Paths page */
.search-input { width: 100%; padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-radius: 6px; font-size: 0.9rem; margin-bottom: 1rem; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { background: #f0f0f0; }
th.sort-asc::after { content: ' \25B2'; font-size: 0.6rem; }
th.sort-desc::after { content: ' \25BC'; font-size: 0.6rem; }

/* Panel strip list (dashboard common pages) */
.panel-list { display: flex; flex-direction: column; gap: 0; margin-bottom: 1.5rem; }
.panel-strip { display: flex; align-items: center; gap: 1.5rem; padding: 0.75rem 1rem; background: var(--card-bg); border: 1px solid var(--border); border-bottom: none; text-decoration: none; color: var(--text); transition: background 0.15s; }
.panel-strip:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.panel-strip:last-child { border-bottom: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius); }
.panel-strip:only-child { border-radius: var(--radius); border-bottom: 1px solid var(--border); }
.panel-strip:hover { background: #fafafa; text-decoration: none; }
.panel-info { flex: 1; min-width: 0; }
.panel-title { font-weight: 600; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel-path { font-size: 0.75rem; color: var(--text-light); font-family: monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel-scores { display: flex; gap: 1rem; align-items: center; }
.panel-device { text-align: center; min-width: 50px; }
.panel-metrics { display: flex; gap: 0.75rem; }
.panel-metric { display: flex; flex-direction: column; align-items: center; min-width: 55px; }
.panel-metric-label { font-size: 0.65rem; text-transform: uppercase; color: var(--text-light); letter-spacing: 0.5px; }
.panel-metric-val { font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.panel-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 0.2rem; min-width: 80px; font-size: 0.75rem; }
.panel-empty { flex: 1; text-align: center; color: var(--text-light); font-size: 0.85rem; padding: 0.5rem; }

@media (max-width: 768px) {
  .panel-strip { flex-wrap: wrap; gap: 0.75rem; }
  .panel-info { width: 100%; }
  .panel-metrics { gap: 0.5rem; }
}

/* View toggle */
.view-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.view-toggle button { padding: 0.3rem 0.75rem; border: none; background: #fff; cursor: pointer; font-size: 0.8rem; color: var(--text-light); }
.view-toggle button:not(:last-child) { border-right: 1px solid var(--border); }
.view-toggle button.active { background: var(--accent); color: #fff; }
.view-toggle button:hover:not(.active) { background: #f5f5f5; }

/* Site thumbnail */
.site-thumb { width: 100%; aspect-ratio: 16/9; border-radius: 6px; overflow: hidden; margin-bottom: 0.75rem; background: #f0f0f0; display: flex; align-items: center; justify-content: center; }
.site-thumb img { width: 100%; height: 100%; object-fit: cover; }
.site-thumb .placeholder { color: #ccc; font-size: 2rem; }

/* List view for sites */
.site-list-table { width: 100%; }
.site-list-table td { vertical-align: middle; }
.site-list-table .thumb-sm { width: 80px; height: 45px; border-radius: 4px; overflow: hidden; background: #f0f0f0; }
.site-list-table .thumb-sm img { width: 100%; height: 100%; object-fit: cover; }

/* Active jobs banner */
.jobs-banner { background: #fffbeb; border: 1px solid #fde68a; border-radius: var(--radius); padding: 1rem; margin-bottom: 1.5rem; }
.jobs-banner h3 { font-size: 0.85rem; color: #92400e; margin-bottom: 0.5rem; }
.job-row { display: flex; align-items: center; gap: 1rem; padding: 0.4rem 0; font-size: 0.85rem; }
.job-row:not(:last-child) { border-bottom: 1px solid #fde68a; }
.job-row .job-site { color: var(--accent); font-weight: 600; min-width: 120px; }
.job-row .job-progress { flex: 1; }

/* Sitemap picker */
.sitemap-list { max-height: 400px; overflow-y: auto; border: 1px solid var(--border); border-radius: 6px; }
.sitemap-item { display: flex; align-items: center; justify-content: space-between; padding: 0.4rem 0.75rem; border-bottom: 1px solid #f0f0f0; font-size: 0.8rem; }
.sitemap-item:last-child { border-bottom: none; }
.sitemap-item:hover { background: #fafafa; }
.sitemap-item .path { font-family: monospace; flex: 1; }

/* Pagination */
.pagination { display: flex; gap: 0.25rem; margin-top: 1rem; }
.pagination a, .pagination span { padding: 0.3rem 0.6rem; border-radius: 4px; font-size: 0.8rem; border: 1px solid var(--border); }
.pagination a:hover { background: #f0f0f0; text-decoration: none; }
.pagination .active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Print styles */
@media print {
  .top-nav, .no-print, .btn, button, .nav-links { display: none !important; }
  body { background: #fff; font-size: 11px; padding: 0; }
  .container { max-width: none; padding: 0; box-shadow: none; }
  .card { box-shadow: none; border: 1px solid #ddd; }
  table { box-shadow: none; border: 1px solid #ddd; page-break-inside: avoid; }
  .page-break { page-break-before: always; }
  .chart-grid { grid-template-columns: 1fr; }
  .svg-chart-container { page-break-inside: avoid; }
}
