/* ==========================================================================
   FleetSearch UI — accent #0ea5e9 (sky), Font Awesome icons, Tailwind base.
   DEV_GUIDE constraints: rem-only (zero px in this file), mobile-first
   (360px = 22.5rem), touch targets >= 2.75rem, dark/light via html.dark
   (Tailwind class strategy) driven by CSS variables below.
   ========================================================================== */

:root {
  --fs-accent: #0ea5e9;
  --fs-accent-strong: #0284c7;
  --fs-accent-soft: rgba(14, 165, 233, 0.14);
  --fs-bg: #f6f8fb;
  --fs-surface: #ffffff;
  --fs-surface-2: #e9eef5;
  --fs-text: #0f172a;
  --fs-muted: #5b6b80;
  --fs-border: #d9e2ec;
  --fs-link: #0369a1;
  --fs-url: #047857;
  --fs-mark-bg: rgba(14, 165, 233, 0.24);
  --fs-danger: #b91c1c;
  --fs-shadow: 0 0.0625rem 0.25rem rgba(15, 23, 42, 0.08);
}

html.dark {
  --fs-accent: #38bdf8;
  --fs-accent-strong: #7dd3fc;
  --fs-accent-soft: rgba(56, 189, 248, 0.16);
  --fs-bg: #0b1220;
  --fs-surface: #111a2c;
  --fs-surface-2: #1b2740;
  --fs-text: #e6edf6;
  --fs-muted: #94a6bd;
  --fs-border: #27354f;
  --fs-link: #7cc2f4;
  --fs-url: #4ade80;
  --fs-mark-bg: rgba(56, 189, 248, 0.28);
  --fs-danger: #fca5a5;
  --fs-shadow: 0 0.0625rem 0.25rem rgba(0, 0, 0, 0.45);
}

/* ------------------------------------------------------------------ base */

.fs-body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--fs-bg);
  color: var(--fs-text);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.fs-body a {
  color: var(--fs-link);
}

.fs-body :focus-visible {
  outline: 0.125rem solid var(--fs-accent);
  outline-offset: 0.125rem;
  border-radius: 0.375rem;
}

mark {
  background: var(--fs-mark-bg);
  color: inherit;
  font-weight: 600;
  border-radius: 0.25rem;
  padding: 0 0.0625rem;
}

/* ---------------------------------------------------------------- topbar */

.fs-topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  background: var(--fs-surface);
  border-bottom: 0.0625rem solid var(--fs-border);
}

.fs-topbar-spacer {
  flex: 1 1 auto;
}

.fs-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0 0.25rem;
  font-weight: 700;
  font-size: 1.0625rem;
  color: var(--fs-text);
  text-decoration: none;
  white-space: nowrap;
}

.fs-brand-icon {
  color: var(--fs-accent);
  font-size: 1.125rem;
}

.fs-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  flex: 0 0 auto;
  border: 0;
  border-radius: 0.75rem;
  background: transparent;
  color: var(--fs-muted);
  font-size: 1rem;
  cursor: pointer;
}

.fs-icon-btn:hover {
  background: var(--fs-surface-2);
  color: var(--fs-text);
}

.fs-hide-narrow {
  display: none;
}

@media (min-width: 40rem) {
  .fs-hide-narrow {
    display: inline;
  }
}

/* ------------------------------------------------------------ search box */

.fs-search-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--fs-surface);
  border: 0.0625rem solid var(--fs-border);
  border-radius: 1rem;
  padding: 0.25rem 0.25rem 0.25rem 1rem;
  box-shadow: var(--fs-shadow);
}

.fs-search-box:focus-within {
  border-color: var(--fs-accent);
  box-shadow: 0 0 0 0.1875rem var(--fs-accent-soft);
}

.fs-search-icon {
  color: var(--fs-muted);
  flex: 0 0 auto;
}

.fs-search-input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 2.75rem;
  border: 0;
  background: transparent;
  color: var(--fs-text);
  font-size: 1rem;
}

.fs-search-input::placeholder {
  color: var(--fs-muted);
}

.fs-search-input:focus {
  outline: none; /* ring is on .fs-search-box:focus-within */
}

.fs-search-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0 1.25rem;
  border: 0;
  border-radius: 0.75rem;
  background: var(--fs-accent);
  color: #ffffff;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

html.dark .fs-search-submit {
  color: #082f49;
}

.fs-search-submit:hover {
  background: var(--fs-accent-strong);
}

.fs-search-submit-icon {
  width: 2.75rem;
  padding: 0;
}

/* ------------------------------------------------------------- home page */

.fs-home-main {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.fs-hero {
  width: 100%;
  max-width: 42rem;
  text-align: center;
}

.fs-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 50%;
  background: var(--fs-accent-soft);
  color: var(--fs-accent);
  font-size: 1.875rem;
  margin-bottom: 1rem;
}

.fs-title {
  margin: 0;
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.fs-tagline {
  margin: 0.375rem 0 0;
  color: var(--fs-muted);
  font-size: 1.0625rem;
}

.fs-search-form {
  margin-top: 1.75rem;
}

.fs-hero-note {
  margin-top: 1rem;
  color: var(--fs-muted);
  font-size: 0.8125rem;
}

/* ----------------------------------------------------------------- footer */

.fs-footer {
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: center;
}

.fs-footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.25rem;
}

.fs-footer-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  min-height: 2.75rem;
  padding: 0 0.5rem;
  color: var(--fs-muted);
  text-decoration: none;
  font-size: 0.875rem;
}

.fs-footer-link:hover {
  color: var(--fs-accent-strong);
}

/* ------------------------------------------------------------------ SERP */

.fs-topbar-serp {
  flex-wrap: nowrap;
}

.fs-serp-form {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 38rem;
}

.fs-search-box-compact {
  padding-left: 0.75rem;
  border-radius: 0.875rem;
}

.fs-serp-main {
  flex: 1 1 auto;
  width: 100%;
  max-width: 46rem;
  margin: 0 auto;
  padding: 0.75rem 1rem 1.5rem;
  box-sizing: border-box;
}

.fs-meta {
  margin: 0;
  padding: 0.5rem 0;
  color: var(--fs-muted);
  font-size: 0.8125rem;
  border-bottom: 0.0625rem solid var(--fs-border);
}

.fs-result {
  padding: 1rem 0;
  border-bottom: 0.0625rem solid var(--fs-border);
}

.fs-result-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.fs-result-link {
  color: var(--fs-link);
  text-decoration: none;
}

.fs-result-link:hover {
  text-decoration: underline;
}

.fs-result-url {
  margin-top: 0.125rem;
  color: var(--fs-url);
  font-size: 0.8125rem;
  overflow-wrap: anywhere;
}

.fs-result-snippet {
  margin: 0.375rem 0 0;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--fs-text);
  overflow-wrap: anywhere;
}

.fs-result-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.625rem;
  margin-top: 0.375rem;
}

.fs-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.125rem 0.625rem;
  border-radius: 62.5rem;
  background: var(--fs-surface-2);
  color: var(--fs-muted);
  font-size: 0.75rem;
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fs-result-age {
  color: var(--fs-muted);
  font-size: 0.75rem;
}

.fs-score-pill {
  padding: 0.125rem 0.625rem;
  border-radius: 62.5rem;
  background: var(--fs-accent-soft);
  color: var(--fs-accent-strong);
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.fs-why-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  min-height: 2.75rem;
  padding: 0 0.5rem;
  border: 0;
  background: transparent;
  color: var(--fs-accent-strong);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
}

.fs-why-btn:hover {
  text-decoration: underline;
}

.fs-why-btn[aria-expanded="true"] {
  color: var(--fs-text);
}

/* -------------------------------------------------------------- breakdown */

.fs-breakdown {
  margin-top: 0.5rem;
  padding: 0.75rem;
  background: var(--fs-surface);
  border: 0.0625rem solid var(--fs-border);
  border-radius: 0.75rem;
  overflow-x: auto;
}

.fs-breakdown-caption {
  margin: 0 0 0.5rem;
  color: var(--fs-muted);
  font-size: 0.75rem;
}

.fs-breakdown-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.fs-breakdown-table th,
.fs-breakdown-table td {
  padding: 0.375rem 0.5rem;
  text-align: left;
  border-bottom: 0.0625rem solid var(--fs-border);
}

.fs-breakdown-table tbody tr:last-child th,
.fs-breakdown-table tbody tr:last-child td {
  border-bottom: 0;
}

.fs-breakdown-table th {
  color: var(--fs-muted);
  font-weight: 600;
  white-space: nowrap;
}

.fs-num {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.fs-component-name {
  font-weight: 600;
  text-transform: capitalize;
}

.fs-bar-cell {
  width: 30%;
  min-width: 5.5rem;
}

.fs-bar-track {
  height: 0.5rem;
  border-radius: 62.5rem;
  background: var(--fs-surface-2);
  overflow: hidden;
}

.fs-bar {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--fs-accent);
}

/* ------------------------------------------------------------------ pager */

.fs-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 0 1.5rem;
}

.fs-page-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0 1rem;
  border: 0.0625rem solid var(--fs-border);
  border-radius: 0.75rem;
  background: var(--fs-surface);
  color: var(--fs-text);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

.fs-page-btn:hover:not(:disabled) {
  border-color: var(--fs-accent);
  color: var(--fs-accent-strong);
}

.fs-page-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.fs-page-label {
  color: var(--fs-muted);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

/* --------------------------------------------------- skeleton + states */

.fs-skel {
  padding: 1rem 0;
  border-bottom: 0.0625rem solid var(--fs-border);
}

.fs-skel-line {
  height: 0.875rem;
  width: 100%;
  margin: 0.4375rem 0;
  border-radius: 0.5rem;
  background: var(--fs-surface-2);
  animation: fs-pulse 1.2s ease-in-out infinite;
}

.fs-skel-line-title {
  width: 55%;
  height: 1.0625rem;
}

.fs-skel-line-url {
  width: 40%;
  height: 0.75rem;
}

.fs-skel-line-short {
  width: 70%;
}

@keyframes fs-pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .fs-skel-line {
    animation: none;
  }
}

.fs-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
  padding: 3.5rem 1rem;
  text-align: center;
}

.fs-state-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: var(--fs-accent-soft);
  color: var(--fs-accent);
  font-size: 1.375rem;
  margin-bottom: 0.5rem;
}

.fs-state-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.fs-state-detail {
  margin: 0;
  color: var(--fs-muted);
  font-size: 0.9375rem;
  max-width: 28rem;
}

.fs-retry-btn {
  margin-top: 1rem;
}
