/* Palette, layout and score components follow siteone-crawler's HTML report */
:root {
  --color-white: #fff;
  --color-gray-100: #eeecec;
  --color-gray-200: #E5E7EB;
  --color-gray-300: #D1D5DB;
  --color-gray-400: #9CA3AF;
  --color-gray-500: #6B7280;
  --color-gray-600: #4B5563;
  --color-gray-700: #374151;
  --color-gray-800: #1F2937;
  --color-gray-900: #111827;
  --color-blue-500: #3B82F6;
  --color-blue-600: #2563EB;
  --color-red: #ef4444;
  --color-green: #22c55e;
  --color-yellow: #eab308;

  --text-color-default: var(--color-gray-900);
  --text-color-muted: var(--color-gray-600);
  --background-color-default: var(--color-white);
  --background-color-neutral: var(--color-gray-100);
  --qs-box-background: #F3F4F6;
  --qs-track: var(--color-gray-200);
  --border-color: var(--color-gray-300);
  --trend-down: #dc2626;
  --trend-up: #15803d;
  --warning-text: #a16207;
  --border-radius: 1.5rem;
  --padding-inline: 2rem;
}

html:has(.theme-switch__input:checked) {
  --text-color-default: var(--color-gray-200);
  --text-color-muted: var(--color-gray-400);
  --background-color-default: var(--color-gray-900);
  --background-color-neutral: var(--color-gray-800);
  --qs-box-background: var(--color-gray-800);
  --qs-track: var(--color-gray-700);
  --border-color: var(--color-gray-600);
  --trend-down: #f87171;
  --trend-up: #4ade80;
  --warning-text: #facc15;
}

html * { box-sizing: border-box; }

body {
  margin: 0;
  width: 100%;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--background-color-neutral);
  color: var(--text-color-default);
  transition: background-color 0.2s ease-out, color 0.2s ease-out;
}

a { color: var(--text-color-default); transition: color 0.2s ease-out; }
h2 { margin-top: 0; }

main { display: flex; flex-direction: column; gap: 2rem; }

section {
  background-color: var(--background-color-default);
  padding: 2rem var(--padding-inline);
  border-radius: var(--border-radius);
  transition: background-color 0.2s ease-out;
}

.container {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  max-width: 187.5rem;
  margin: 0 auto;
  padding: 1.5rem 4rem;
}

header.header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  background-color: var(--background-color-default);
  padding: 1.5rem var(--padding-inline);
  border-radius: 3rem;
  border: 1px solid var(--color-gray-100);
  transition: background-color 0.2s ease-out, border-color 0.2s ease-out;
}
html:has(.theme-switch__input:checked) header.header { border-color: transparent; }
header.header h1 { margin: 0; font-size: 1.5rem; }
.brand { text-decoration: none; }

.header-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 1.25rem; margin-left: auto; }
.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

/* Theme switch */
.theme-switch label { display: flex; align-items: center; gap: .375rem; cursor: pointer; }
.theme-switch__wrapper {
  display: flex;
  align-items: center;
  position: relative;
  border-radius: var(--border-radius);
  background-color: var(--color-gray-300);
  width: 4rem;
  height: 2rem;
  transition: all 0.2s ease-out;
}
html:has(.theme-switch__input:checked) .theme-switch__wrapper { background-color: var(--color-gray-600); }
.theme-switch__input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.theme-switch__input:focus-visible ~ .theme-switch__wrapper { outline: 2px solid var(--color-blue-500); outline-offset: 2px; }
.theme-switch__dot {
  position: absolute;
  height: 1.5rem;
  width: 1.5rem;
  left: .25rem;
  background-color: var(--color-gray-600);
  border-radius: 50%;
  transition: all .2s ease-out;
}
html:has(.theme-switch__input:checked) .theme-switch__dot {
  transform: translateX(2rem);
  background-color: var(--color-gray-300);
}

/* Dashboard */
.summary-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.summary-bar h2 { margin-bottom: .25rem; }
.summary-text { margin: 0; color: var(--text-color-muted); }

.site-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 36rem), 1fr));
  gap: 2rem;
}

.qs-box { background-color: var(--background-color-default); }
.site-card { display: flex; flex-direction: column; gap: 1rem; border: 2px solid transparent; }
.site-card-drop { border-color: var(--trend-down); }
.site-card-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .25rem 1rem; }
.qs-title { margin: 0; font-size: 18px; }
.qs-title a { text-decoration: none; }
.qs-title a:hover { text-decoration: underline; }
.site-url { font-size: 13px; color: var(--text-color-muted); overflow-wrap: anywhere; }

.qs-layout {
  display: flex;
  align-items: center;
  gap: 32px;
  flex-wrap: wrap;
  padding: 20px;
  border-radius: 12px;
  background: var(--qs-box-background);
}
.qs-donut { position: relative; width: 140px; height: 140px; border-radius: 50%; flex-shrink: 0; background-color: var(--qs-track); }
.qs-donut-inner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 112px;
  height: 112px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--qs-box-background);
}
.qs-donut-score { font-size: 28px; font-weight: bold; line-height: 1.1; }
.qs-donut-label { font-size: 13px; }

.qs-categories { flex: 1; min-width: 240px; }
.qs-category { display: flex; align-items: center; margin-bottom: 8px; }
.qs-category:last-child { margin-bottom: 0; }
.qs-cat-name { width: 105px; flex-shrink: 0; font-size: 13px; color: var(--text-color-muted); }
.qs-bar-track { flex: 1; min-width: 30px; height: 12px; border-radius: 6px; margin: 0 10px; overflow: hidden; background: var(--qs-track); }
.qs-bar { height: 100%; border-radius: 6px; }
.qs-cat-score { width: 30px; font-weight: bold; font-size: 13px; text-align: right; }
.qs-category .trend { width: 40px; text-align: right; }

.trend { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.trend-down { color: var(--trend-down); }
.trend-up { color: var(--trend-up); }
.trend-neutral { color: var(--text-color-muted); }

.scan-meta { margin: 0; font-size: 13px; color: var(--text-color-muted); }
.scan-note { margin: 0; padding: .5rem .75rem; border-radius: .5rem; font-size: 13px; overflow-wrap: anywhere; background: var(--qs-box-background); }
.scan-note-active { color: var(--color-blue-500); }
.scan-note-error { color: var(--trend-down); }
.scan-note-warning { color: var(--warning-text); }

.site-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: auto; }

.button {
  display: inline-block;
  padding: .375rem .875rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: transparent;
  color: var(--text-color-default);
  font: inherit;
  font-size: 14px;
  line-height: 1.4;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .2s ease-out, color .2s ease-out, border-color .2s ease-out;
}
.button:hover { background-color: var(--color-blue-500); border-color: var(--color-blue-500); color: var(--color-white); }
.button-primary { background-color: var(--color-blue-600); border-color: var(--color-blue-600); color: var(--color-white); }
.button-danger:hover { background-color: var(--color-red); border-color: var(--color-red); }

.flash { margin: 0; padding: .75rem 1.25rem; border-radius: 1rem; background-color: var(--background-color-default); }
.flash-success { color: var(--trend-up); }
.flash-error { color: var(--trend-down); }

/* Forms */
.login-box { width: 100%; max-width: 26rem; margin: 2rem auto; }
.stacked-form { display: flex; flex-direction: column; align-items: flex-start; gap: .5rem; }
.stacked-form input { width: 100%; margin-bottom: .5rem; }

input:not([type="hidden"]):not([type="checkbox"]) {
  padding: .5rem .75rem;
  border: 1px solid var(--border-color);
  border-radius: .5rem;
  background: var(--background-color-neutral);
  color: var(--text-color-default);
  font: inherit;
  font-size: 14px;
}

label { font-size: 13px; color: var(--text-color-muted); }

.site-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem; }
.field { display: flex; flex-direction: column; gap: .25rem; flex: 1 1 12rem; min-width: 0; }
.field-wide { flex: 3 1 18rem; }
.field input { width: 100%; }
.manage-list { display: flex; flex-direction: column; }
.manage-row { display: flex; flex-direction: column; gap: .75rem; padding: 1.25rem 0; border-top: 1px solid var(--border-color); }
.manage-row:first-child { border-top: 0; padding-top: 0; }

/* History */
.table-wrapper { overflow-x: auto; }
.history-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.history-table th, .history-table td { padding: .375rem .5rem; border: 1px solid var(--background-color-neutral); text-align: left; vertical-align: top; white-space: nowrap; }
.history-table th { background-color: var(--background-color-neutral); }
.history-note { max-width: 24rem; white-space: normal; overflow-wrap: anywhere; font-size: 12px; }
.baseline-marker { padding: 0 .375rem; border-radius: .5rem; background: var(--color-blue-600); color: var(--color-white); font-size: 11px; }

/* Report page: fills the window below the header, and the report scrolls inside its frame */
.report-page .container { height: 100vh; height: 100dvh; min-height: 32rem; gap: 1rem; }
.report-page main { flex: 1; min-height: 0; gap: .75rem; }
.report-page .footer { display: none; }
.report-bar { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem 1rem; padding-inline: var(--padding-inline); }
.report-bar-link { margin-left: auto; font-size: 14px; }
.report-frame { flex: 1; min-height: 0; width: 100%; border: 0; border-radius: var(--border-radius); background: var(--background-color-neutral); }

.footer { font-size: 12px; color: var(--text-color-muted); text-align: center; }
.footer a { color: inherit; }

@media (max-width: 768px) {
  :root { --padding-inline: 1rem; }
  .container { padding: 1rem; gap: 1rem; }
  main, .site-grid { gap: 1rem; }
  section { padding-block: 1rem; }
  header.header { border-radius: var(--border-radius); padding-block: 1rem; }
  .header-nav { margin-left: 0; order: 3; width: 100%; }
  .qs-layout { justify-content: center; padding: 12px; gap: 16px; }
  .qs-categories { min-width: 100%; }
}
