/* RamScout core theme (deduped + responsive fixes) */

/* Global layout / typography */
body {
  background: #020617;
  color: #f5f5f7;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-shell {
  max-width: 1200px;
}

/* ===== Site header ===== */

.site-header {
  padding: 0.9rem 0;
  margin-bottom: 0.2rem;
  border-bottom: 1px solid rgba(17, 24, 39, 0.65);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap; /* prevents overlap when viewport is narrow */
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 0; /* allows title/tagline to shrink instead of pushing nav */
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.brand-link:hover {
  text-decoration: none;
  color: inherit;
}

.brand-link:focus-visible {
  outline: 2px solid #4f46e5;
  outline-offset: 3px;
  border-radius: 0.9rem;
}

.site-logo-placeholder {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 0.9rem;
  background: linear-gradient(135deg, #ec4899, #4f46e5);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px rgba(0,0,0,0.45);
}

.site-logo-placeholder span {
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.04em;
}

.site-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.1;
  white-space: nowrap;
}

.site-title .dot {
  color: #a5b4fc;
}

.site-tagline {
  font-size: 0.85rem;
  color: #9ca3af;
  margin-top: 0.1rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
  flex: 1 1 auto;
  padding: 0.35rem 0; /* prevents pill borders appearing clipped */
}

.site-nav a {
  color: #e5e7eb;
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a.active {
  color: #a5b4fc;
}

.site-nav-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1.05rem;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.95);
  border: 1px solid #4f46e5;
  color: #e0e7ff;
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1; /* prevents visual clipping */
  white-space: nowrap;
}

.site-nav-pill:hover {
  background: rgba(79, 70, 229, 0.18);
  border-color: #6366f1;
  color: #ffffff;
}

/* ===== Simple hero ===== */
.page-hero {
  margin: 0.75rem 0;
}

.page-heading {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.page-subheading {
  margin: 0;
  font-size: 0.85rem;
  color: #9ca3af;
}

/* ===== Brand bar (legacy) ===== */
.brand-bar {
  background: linear-gradient(90deg, #4f46e5, #06b6d4);
  border-radius: 1.5rem;
  padding: 0.7rem 1.5rem 0.75rem;
  margin-bottom: 0.5rem;
  box-shadow: 0 10px 25px rgba(0,0,0,0.45);
}

.brand-bar h1 {
  font-size: 1.2rem;
  margin: 0;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.brand-sub {
  font-size: 0.85rem;
  opacity: 0.9;
}

.seo-intro-card {
  background: #020617;
  border-radius: 1.1rem;
  padding: 0.85rem 1.2rem;
  margin: 0 0 0.9rem;
  border: 1px solid #111827;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
}

.seo-intro-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #9ca3af;
  margin-bottom: 0.25rem;
}

.seo-intro {
  margin: 0;
  font-size: 0.85rem;
  color: #9ca3af;
}

.highlight-strong {
  font-weight: 600;
  color: #f5f7ff;
}

/* ===== Filter panel ===== */
.filter-panel {
  background: #0b1120;
  border-radius: 1.25rem;
  padding: 0.75rem 1.1rem 0.9rem;
  box-shadow: 0 12px 30px rgba(0,0,0,0.4);
  margin-bottom: 0.75rem;
  border: 1px solid #1e293b;
}

.filter-row-top {
  margin-bottom: 0.1rem;
}

.filter-row-top.g-3 {
  row-gap: 0.25rem;
}

.filter-divider {
  margin: 0.15rem 0;
  border-color: #111827;
}

.filter-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #9ca3af;
  margin-bottom: 0.25rem;
}

.filter-chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.condition-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  align-items: flex-start;
}

@media (min-width: 768px) {
  .condition-group {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.speed-group {
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  gap: 0.45rem;
}

.speed-group::-webkit-scrollbar {
  height: 4px;
}

.speed-group::-webkit-scrollbar-track {
  background: #020617;
}

.speed-group::-webkit-scrollbar-thumb {
  background: #4b5563;
  border-radius: 999px;
}

.speed-scroll-hint {
  font-size: 0.7rem;
  color: #6b7280;
  margin-top: 0.15rem;
}

.filter-chip {
  border-radius: 999px;
  border: 1px solid #334155;
  background: #020617;
  color: #e5e7eb;
  padding: 0.3rem 1rem;
  font-size: 0.82rem;
  cursor: pointer;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s, color 0.2s;
}

.filter-chip input {
  display: none;
}

.filter-chip .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(248, 250, 252, 0.7);
}

.filter-chip.active {
  background: #4f46e5;
  border-color: #4f46e5;
  color: #fff;
  box-shadow: 0 0 12px rgba(79, 70, 229, 0.5);
}

.filter-chip:hover {
  border-color: #4f46e5;
}

.search-input {
  background: #020617;
  border: 1px solid #1f2937;
  color: #f9fafb;
}

.search-input::placeholder {
  color: #6b7280;
}

.range-display {
  font-size: 0.8rem;
  color: #9ca3af;
}

.value-pill {
  border-radius: 999px;
  background: rgba(15,23,42,0.9);
  padding: 0.15rem 0.8rem;
  border: 1px solid rgba(226,232,240,0.3);
  font-size: 0.8rem;
}

.active-filter-bar {
  background: #020617;
  padding: 0.5rem 0.85rem;
  border-radius: 0.75rem;
  border: 1px solid #1f2937;
  font-size: 0.82rem;
  margin-top: 0.6rem;
}

.filter-pill {
  display: inline-block;
  background: #4f46e5;
  color: white;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  margin-left: 0.5rem;
  font-weight: 500;
  font-size: 0.8rem;
}

.results-count {
  color: #e5e7eb;
}

/* ===== Results table ===== */
.table-wrap {
  background: #ffffff;
  border-radius: 1.25rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(0,0,0,0.45);
}

.table {
  --bs-table-bg: #ffffff;
  --bs-table-color: #0b1220;
  --bs-table-striped-bg: #f5f7fb;
  --bs-table-striped-color: #0b1220;
  --bs-table-hover-bg: #eef2ff;
  --bs-table-hover-color: #0b1220;
  --bs-table-active-bg: #eef2ff;
  --bs-table-active-color: #0b1220;
}

.table-wrap .table {
  color: var(--bs-table-color);
}

.table-wrap thead tr {
  background: var(--bs-table-bg);
  color: var(--bs-table-color);
}

.table-wrap tbody td {
  color: var(--bs-table-color);
}

.table-wrap .table-striped > tbody > tr:nth-of-type(odd) > * {
  background-color: var(--bs-table-striped-bg) !important;
  color: var(--bs-table-striped-color) !important;
}

.table-wrap .table-hover > tbody > tr:hover > * {
  background-color: var(--bs-table-hover-bg) !important;
  color: var(--bs-table-hover-color) !important;
}

table {
  margin-bottom: 0;
}

thead tr {
  background: #ffffff;
  color: #0b1220;
}

thead th {
  border-bottom: 1px solid rgba(148, 163, 184, 0.45) !important;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

tbody td {
  border-top: 1px solid rgba(148, 163, 184, 0.35) !important;
  font-size: 0.86rem;
  vertical-align: middle;
  color: #0b1220;
}

.listing-title-strong {
  font-weight: 600;
  color: #0b1220;
}

.badge-new {
  background: #22c55e;
}

.badge-used {
  background: #f97316;
}

.deal-strong {
  color: #22c55e;
  font-weight: 600;
}

.deal-weak {
  color: #f97316;
}

.meta-line {
  font-size: 0.8rem;
  color: #0b1220;
}

.meta-spec {
  color: #667085;
  font-size: 0.75rem;
}

a.link-lightish {
  color: #a5b4fc;
}

a.link-lightish:hover {
  color: #c7d2fe;
}

.table-wrap a.link-lightish {
  color: #1d4ed8;
}

.table-wrap a.link-lightish:hover {
  color: #1e40af;
}

.footer-note {
  font-size: 0.75rem;
  color: #6b7280;
  padding: 0.6rem 1rem 0.9rem;
}

a.listing-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 1rem;
  border-radius: 0.6rem;
  background: #111827;
  color: #e0e7ff;
  font-weight: 600;
  border: 1px solid #4f46e5;
  min-width: 9rem;
  white-space: nowrap;
  text-align: center;
  transition: background 0.2s, color 0.2s, transform 0.15s, box-shadow 0.15s;
  text-decoration: none;
}

a.listing-button:hover {
  background: #4f46e5;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.45);
}

.deal-info {
  font-size: 0.8rem;
  color: #0f141e;
  margin-top: 0.5rem;
}

.sortable-header {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.sortable-header .sort-indicator {
  margin-left: 0.25rem;
  font-size: 0.7rem;
  opacity: 0.8;
}

.listing-cell-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.listing-text {
  flex: 1 1 auto;
  min-width: 0;
}

.listing-text strong {
  color: #101319;
  font-size: 0.85rem;
}

/* Amazon inline promo styling (make this row a dark band to break up results) */
.table-wrap tr.amazon-row > * {
  background: #0b1120 !important;
  color: #e5e7eb !important;
}

.table-wrap tr.amazon-row td {
  border-top: 1px solid rgba(148, 163, 184, 0.25) !important;
}

.amazon-promo {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 0.9rem;
  border: 1px solid rgba(226, 232, 240, 0.18);
  background: rgba(2, 6, 23, 0.55);
}

.amazon-promo-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #c7d2fe;
  margin-bottom: 0.2rem;
}

.amazon-promo-sub {
  color: #e5e7eb;
  font-size: 0.95rem;
}

/* Keep the button looking consistent inside the dark promo row */
.table-wrap tr.amazon-row a.listing-button {
  background: #111827;
  color: #e0e7ff;
}

.table-wrap tr.amazon-row a.listing-button:hover {
  background: #4f46e5;
  color: #ffffff;
}

/* ===== Site footer ===== */
.site-footer {
  margin-top: 2.25rem;
  padding-top: 1.5rem;
  padding-bottom: 1.25rem;
  border-top: 1px solid #111827;
  font-size: 0.85rem;
  color: #9ca3af;
}

.site-footer h6 {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #e5e7eb;
  margin-bottom: 0.75rem;
}

/* Footer columns (3-up on desktop, stacked on mobile)
   Works with either a dedicated wrapper (.footer-columns) OR bootstrap rows/cols. */
.site-footer .footer-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2rem;
}

@media (max-width: 768px) {
  .site-footer .footer-columns {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
}

/* Link lists */
.site-footer ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.site-footer li {
  margin: 0.25rem 0;
}

.site-footer a {
  color: #e5e7eb;
  text-decoration: none;
}

.site-footer a:hover {
  color: #a5b4fc;
}

/* Prevent awkward wrapping on icon + text links (e.g. “Follow on X”) */
.site-footer a.footer-social-link,
.site-footer .footer-social a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

/* Bottom bar: keep the disclaimer and the follow link from mushing together */
.site-footer .footer-bottom {
  border-top: 1px solid #111827;
  margin-top: 1.25rem;
  padding-top: 0.75rem;
  font-size: 0.78rem;
  color: #6b7280;

  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.site-footer .footer-bottom .footer-disclaimer {
  flex: 1 1 420px;
  min-width: 0;
}

.site-footer .footer-bottom .footer-meta {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* ===== RAM deal page hub cards ===== */
.deal-page-grid .deal-page-card {
  display: block;
  background: #0b1120;
  border: 1px solid #1e293b;
  border-radius: 1rem;
  box-shadow: 0 12px 30px rgba(0,0,0,0.45);
  color: #e5e7eb;
  height: 100%;
  transition: transform 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.deal-page-grid .deal-page-card:hover {
  transform: translateY(-2px);
  border-color: #4f46e5;
  box-shadow: 0 16px 38px rgba(0,0,0,0.55);
  text-decoration: none;
}

.deal-page-kicker {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #9ca3af;
  margin-bottom: 0.35rem;
}

.deal-page-title {
  color: #0b1220;
  font-weight: 700;
  line-height: 1.15;
}

.deal-page-desc {
  margin-top: 0.6rem;
  font-size: 0.85rem;
  line-height: 1.45;
  color: #475569;
}

.deal-page-grid .deal-page-card {
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.deal-page-pill {
  border-radius: 999px;
  background: rgba(15,23,42,0.9);
  padding: 0.15rem 0.8rem;
  border: 1px solid rgba(226,232,240,0.25);
  font-size: 0.8rem;
  color: #e5e7eb;
  white-space: nowrap;
}

/* ===== Responsive tweaks ===== */
@media (max-width: 768px) {
  .brand-bar {
    border-radius: 1rem;
  }

  .filter-panel {
    border-radius: 1rem;
  }

  .site-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .site-nav {
    width: 100%;
    justify-content: flex-start;
    gap: 0.6rem;
  }

  .site-title {
    font-size: 1.25rem;
    white-space: normal;
  }

  .listing-cell-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
  }

  a.listing-button {
    width: 100%;
    justify-content: center;
    margin-top: 0.25rem;
  }

  /* Price history: stop the meta row feeling crowded on mobile */
  #history-filter .meta-row {
    justify-content: flex-start;
  }
}

/* ===== Price history page polish ===== */

/* The controls card already uses .filter-panel. Give it a touch more breathing room */
.price-history .filter-panel,
#price-history .filter-panel {
  margin-bottom: 1rem;
}

/* Lay out the meta row (current selection + status) with more breathing room */
#history-filter .meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.65rem;
}

/* The current selection pill was feeling cramped */
#history-filter #seriesLabel.value-pill,
#history-filter #seriesLabel {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.95rem;
  line-height: 1.15;
  margin: 0;
}

/* Points/status text: clearer and not jammed against the pill */
#history-filter #status {
  margin: 0;
  color: #e5e7eb;
  font-size: 0.85rem;
}

/* Helper note text ("History grows daily...") should be readable */
#history-filter .muted,
#history-filter .text-muted,
#history-filter small,
#history-filter .small {
  color: #cbd5e1;
}

#history-filter .meta,
#history-filter .history-meta,
#history-filter #history-meta {
  color: #cbd5e1;
}

/* If the template wraps the chart in any of these containers, style it like a card */
.history-chart-card,
.chart-card,
#history-chart-card,
#chart-card,
.history-chart-wrap,
.chart-wrap {
  background: #0b1120;
  border: 1px solid #1e293b;
  border-radius: 1.25rem;
  box-shadow: 0 12px 30px rgba(0,0,0,0.4);
  padding: 0.9rem 1.1rem 1.1rem;
  margin-top: 0.75rem;
}

/* Title + subtitle inside the chart card */
.history-chart-card .chart-title,
.chart-card .chart-title,
#history-chart-card .chart-title,
#chart-card .chart-title,
#chartTitle,
#chart-title {
  font-size: 1rem;
  font-weight: 700;
  color: #f8fafc;
  margin: 0;
}

.history-chart-card .chart-subtitle,
.chart-card .chart-subtitle,
#history-chart-card .chart-subtitle,
#chart-card .chart-subtitle,
#chartSubtitle,
#chart-subtitle {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  color: #9ca3af;
}

/* If the title/subtitle currently sit outside any wrapper, at least make them readable */
.price-history h2,
.price-history h3,
#price-history h2,
#price-history h3 {
  color: #f8fafc;
}

.price-history .muted,
#price-history .muted {
  color: #9ca3af;
}

/* Keep the “current selection” pill row from crowding the next line */
.current-selection,
#current-selection,
.history-current-selection {
  margin-top: 0.6rem;
  margin-bottom: 0.35rem;
}

/* The small helper text on the right (e.g., Last update) was too faint */
.history-meta,
#history-meta,
.price-history .meta,
#price-history .meta {
  color: #cbd5e1;
}

/* Slightly increase spacing between chip rows on the history controls */
.price-history .filter-chip-group,
#price-history .filter-chip-group {
  gap: 0.55rem;
}

/* Make the “Showing X points” line clearer */
.points-count,
#points-count,
.history-points-count {
  color: #cbd5e1;
  font-size: 0.85rem;
  margin-top: 0.35rem;
}

/* ===== Results: scrollable window instead of page-number UX ===== */
.results-scroll {
  max-height: 70vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Keep table header visible while scrolling */
.results-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bs-table-bg);
}

/* Hide the old numeric pagination UI (we use Load more) */
nav[aria-label="RAM listings pagination"] {
  display: none;
}

/* Mobile tweaks: reduce header/nav overlap and keep pills from colliding */
@media (max-width: 480px) {
  .site-nav {
    gap: 0.5rem;
  }
  .site-nav-pill {
    padding: 0.5rem 0.9rem;
    font-size: 0.85rem;
    line-height: 1;
  }
  .results-scroll {
    max-height: 72vh;
  }
}
