@import url("/assets/css/brand-foundation.css");

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  color: var(--brand-text);
  background: #f7f9fc;
}

.container {
  max-width: 1160px;
  margin: 0 auto;
  padding: 14px 12px 40px;
}

.card {
  background: #fff;
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-lg);
  padding: 14px;
  margin-bottom: 12px;
}

.page-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-bottom: 10px;
}

h1 {
  margin: 0 0 10px;
  font-size: clamp(1.5rem, 5.4vw, 2rem);
  line-height: 1.3;
}

h2 {
  margin: 0 0 8px;
  font-size: clamp(1.2rem, 4.8vw, 1.55rem);
}

p {
  margin: 8px 0;
}

.message {
  margin: 0;
  padding: 12px;
  border-radius: 8px;
  background: #eff3f8;
  color: #274161;
}

.desktop-view {
  display: none;
}

.mobile-view {
  display: block;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  border: 1px solid var(--brand-border);
  padding: 10px;
  text-align: left;
  vertical-align: top;
  font-size: 0.92rem;
}

th {
  background: #f2f5f8;
  font-weight: 700;
  white-space: nowrap;
}

.mobile-cards {
  display: grid;
  gap: 10px;
}

.product-card,
.selected-pc {
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-lg);
  padding: 12px;
  background: #fff;
}

.selected-pc {
  border-color: #c4cfdb;
  background: linear-gradient(180deg, #f7f9fc 0%, #ffffff 70%);
}

.selected-heading {
  margin: 0 0 6px;
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  color: #1d3f72;
  background: #e9eff7;
  border-radius: 999px;
  padding: 3px 10px;
}

.product-name {
  color: #111827;
  text-decoration: none;
  display: inline-block;
  font-size: 1.03rem;
  font-weight: 800;
  line-height: 1.45;
}

.product-name:hover {
  text-decoration: underline;
}

.product-link {
  display: inline-block;
  margin-top: 4px;
  color: #1d3f72;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 700;
}

.product-link-prominent {
  margin-top: 8px;
  font-size: 0.9rem;
}

.product-link:hover {
  text-decoration: underline;
}

.price {
  display: block;
  margin: 5px 0 10px;
  font-size: 1.4rem;
  font-weight: 900;
  color: #b91c1c;
  line-height: 1.2;
}

.details {
  display: grid;
  grid-template-columns: minmax(82px, 33%) 1fr;
  gap: 6px 10px;
  font-size: 0.9rem;
}

.details dt {
  margin: 0;
  color: #374151;
  font-weight: 600;
}

.details dd {
  margin: 0;
  color: #111827;
  overflow-wrap: anywhere;
}

.feature-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.badge-good {
  background: #ebf6ed;
  color: #23553b;
  border: 1px solid #b7d8c0;
}

.badge-muted {
  background: #f2f5f8;
  color: #4f5f74;
  border: 1px solid #cfd8e2;
}

.compare-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
  padding: 7px 11px;
  border-radius: 999px;
  background: #e9eff7;
  color: #274161;
  border: 1px solid #c7d2e2;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 700;
}

.compare-link:hover {
  background: #dde7f2;
}

.section-note {
  margin-top: -3px;
  color: #4f5f74;
  font-size: 0.92rem;
}


.compare-rail-wrap {
  overflow-x: auto;
  padding-bottom: 8px;
}

.compare-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(250px, 1fr);
  gap: 10px;
}

@media (min-width: 901px) {
  .compare-rail {
    grid-auto-columns: minmax(260px, 300px);
  }
}

.diff-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 0;
}

.badge-diff {
  background: #fff6ef;
  border: 1px solid #edc4a1;
  color: #8b4a2b;
}

.details dd.is-diff {
  background: #fff6ef;
  border-radius: 6px;
  padding: 2px 6px;
  border: 1px solid #fed7aa;
}


.back-link {
  color: #1d3f72;
  text-decoration: none;
  font-weight: 600;
}

.product-name-block {
  display: grid;
  gap: 4px;
}

.product-card-header {
  margin-bottom: 10px;
}

.product-card-header .price {
  margin: 6px 0 0;
}

.back-link:hover {
  text-decoration: underline;
}

@media (min-width: 901px) {
  .container {
    padding: 24px 16px 56px;
  }

  .card {
    padding: 20px;
    margin-bottom: 16px;
  }

  .desktop-view {
    display: block;
  }

  .mobile-view {
    display: none;
  }

  .page-nav {
    margin-bottom: 14px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 10px 10px 32px;
  }

  .card {
    padding: 12px;
  }

  .details {
    grid-template-columns: 1fr;
    gap: 2px 0;
  }

  .details dd {
    margin-bottom: 8px;
  }

  .compare-link {
    width: 100%;
  }

  .hub-chip,
  .entry-link-button {
    min-height: 36px;
  }
}

.listing-toolbar {
  margin: 10px 0 12px;
  padding: 12px;
  border: 1px solid var(--brand-border);
  border-radius: 10px;
  background: #f8fbff;
}

.hub-selector {
  margin: 4px 0 12px;
  padding: 12px;
  border: 1px solid var(--brand-border);
  border-radius: 10px;
  background: #fff;
}

.hub-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 12px;
  margin-bottom: 8px;
}

.hub-title,
.hub-current {
  margin: 0;
  font-size: 0.88rem;
  color: #4f5f74;
}

.hub-current {
  font-weight: 700;
  color: #274161;
}

.hub-group + .hub-group {
  margin-top: 8px;
}

.hub-group-title {
  margin: 0 0 6px;
  font-size: 0.84rem;
  color: #51647a;
}

.hub-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hub-chip,
.entry-link-button {
  border: 1px solid #c8d3e1;
  background: #f8fbff;
  color: #274161;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.88rem;
  line-height: 1.2;
  cursor: pointer;
}

.hub-chip.is-active {
  border-color: #1d3f72;
  background: #1d3f72;
  color: #fff;
}

.search-hub-groups {
  margin-top: 10px;
  display: grid;
  gap: 10px;
}

.search-candidates-block {
  margin-top: 10px;
}

.search-candidates-block summary {
  cursor: pointer;
  color: #314761;
  font-weight: 700;
  font-size: 0.9rem;
}

.search-live-suggestions {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.search-hub-group h2 {
  margin: 0 0 6px;
  font-size: 0.9rem;
  color: #4d6077;
}

.search-subgroup + .search-subgroup {
  margin-top: 8px;
}

.search-subgroup-title {
  margin: 0 0 6px;
  font-size: 0.82rem;
  color: #5a6a7f;
  font-weight: 700;
}

#listing-guide {
  margin: 6px 0 12px;
}

.comparison-guide ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.comparison-guide li {
  margin: 6px 0;
  color: #334860;
  font-size: 0.92rem;
}

.comparison-guide-subtle {
  border-style: dashed;
}

.comparison-guide-subtle h2 {
  font-size: 1rem;
  color: #425166;
}

.toolbar-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: end;
  gap: 8px;
}

.listing-count {
  margin: 0;
  color: #425166;
  font-size: 0.9rem;
}

.toolbar-filters {
  margin-top: 10px;
}

.toolbar-filters summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--brand-text);
}

.toolbar-fields {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
}

.toolbar-field {
  display: grid;
  gap: 4px;
}

.toolbar-label {
  font-size: 0.82rem;
  color: #506177;
  font-weight: 600;
}

.toolbar-select {
  width: 100%;
  border: 1px solid #c7d0dc;
  border-radius: 8px;
  padding: 8px;
  background: #fff;
}

.toolbar-reset {
  border: 1px solid #c7d2e2;
  background: #edf2f8;
  color: #274161;
  border-radius: 8px;
  padding: 8px 10px;
  font-weight: 700;
}

.listing-progressive-controls {
  margin-top: 12px;
  display: grid;
  gap: 8px;
  justify-items: center;
}

.listing-progressive-count {
  margin: 0;
  color: #425166;
  font-size: 0.9rem;
}

.listing-load-more {
  border: 1px solid #c7d2e2;
  background: #edf2f8;
  color: #274161;
  border-radius: 999px;
  padding: 9px 16px;
  font-weight: 700;
  cursor: pointer;
}

.listing-load-more:hover {
  background: #e2ebf6;
}

.type-pill {
  display: inline-block;
  margin-left: 8px;
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 999px;
  vertical-align: middle;
}

.type-same {
  background: #e9eff7;
  border: 1px solid #c7d2e2;
  color: #274161;
}

.type-similar {
  background: #fff6ef;
  border: 1px solid #edc4a1;
  color: #8b4a2b;
}

.mobile-summary {
  margin-top: 10px;
  border: 1px solid #c7d0dc;
  border-radius: 10px;
  padding: 10px;
  background: #f7f9fc;
}

.mobile-summary-title {
  margin: 0 0 6px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #425166;
}

.mobile-summary-grid {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 8px;
}

.mobile-summary-grid dt {
  margin: 0;
  font-size: 0.82rem;
  color: #5a6a7f;
}

.mobile-summary-grid dd {
  margin: 0;
  font-weight: 700;
  color: #17263d;
}

.selected-details-toggle {
  margin-top: 10px;
  border: 1px solid #d5dee8;
  border-radius: 10px;
  background: #fafcff;
  padding: 8px 10px;
}

.selected-details-toggle summary {
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 700;
  color: #314761;
}

.selected-details-toggle[open] summary {
  margin-bottom: 8px;
}

.selected-specs-mobile {
  margin-top: 2px;
}

@media (min-width: 901px) {
  .mobile-summary {
    display: none;
  }

  .selected-details-toggle {
    display: none;
  }
}

@media (max-width: 900px) {
  .selected-specs-desktop {
    display: none;
  }

  .toolbar-filters {
    border-top: 1px solid #e2e8f0;
    padding-top: 8px;
  }

  .toolbar-filters:not([open]) .toolbar-fields {
    display: none;
  }
}

.compare-candidate-actions {
  margin-top: 8px;
}

.compare-candidate-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #ccd7e3;
  background: #f5f8fc;
  color: #334155;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.compare-candidate-btn:hover {
  background: #ebf1f8;
}

.compare-candidate-btn.is-added {
  border-color: #b8c7da;
  background: #e7eef8;
  color: #1e3a5f;
}


.table-inline-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.table-inline-actions .compare-candidate-actions {
  margin-top: 0;
}

@media (min-width: 901px) {
  .table-inline-actions .compare-link,
  .table-inline-actions .compare-candidate-btn {
    margin-top: 0;
    padding: 3px 8px;
    font-size: 0.74rem;
    border-radius: 7px;
    border: 1px solid #cfd8e3;
    background: #f8fbff;
    color: #2c4566;
    line-height: 1.3;
    font-weight: 600;
  }

  .table-inline-actions .compare-link:hover,
  .table-inline-actions .compare-candidate-btn:hover {
    background: #eef4fb;
  }

  .table-inline-actions .compare-candidate-btn.is-added {
    border-color: #bfd0e4;
    background: #edf3fb;
    color: #24415f;
  }
}

.compare-candidates-bar {
  position: fixed;
  right: 12px;
  bottom: 12px;
  width: min(420px, calc(100% - 24px));
  z-index: 60;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid #cfd8e2;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(17, 24, 39, 0.12);
  padding: 10px;
}

.compare-candidates-summary {
  display: grid;
  gap: 4px;
  margin-bottom: 8px;
}

.compare-candidates-count {
  font-size: 0.86rem;
  font-weight: 800;
  color: #1f3555;
}

.compare-candidates-names {
  font-size: 0.75rem;
  color: #4a5d78;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.compare-candidates-actions {
  display: flex;
  gap: 8px;
}

.compare-candidates-go,
.compare-candidates-clear,
.compare-candidate-remove {
  border-radius: 999px;
  border: 1px solid #c7d2e2;
  background: #e9eff7;
  color: #274161;
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 10px;
  cursor: pointer;
}

.compare-candidates-go:hover,
.compare-candidates-clear:hover,
.compare-candidate-remove:hover {
  background: #dde7f2;
}

.compare-candidates-notice {
  margin: 8px 0 0;
  font-size: 0.76rem;
  color: #8b4a2b;
}

.compare-candidates-page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.compare-candidates-table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 8px;
}

.compare-candidates-table-head h2 {
  margin-bottom: 0;
}

.diff-only-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: #4a5d78;
  font-weight: 700;
}

.diff-only-toggle input {
  margin: 0;
  accent-color: #1d3f72;
}

.compare-column-head {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.compare-column-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: #4a5d78;
}

.compare-candidates-table thead th {
  min-width: 130px;
  padding: 6px;
}

.compare-candidates-table thead th:first-child {
  min-width: 82px;
  width: 82px;
}

.compare-candidates-table tbody th {
  white-space: nowrap;
  font-size: 0.84rem;
}

.compare-candidates-table tbody tr.has-diff th,
.compare-candidates-table tbody tr.has-diff td {
  background: #fff8f2;
}

.compare-candidates-table {
  border-collapse: separate;
  border-spacing: 0;
}

.compare-candidates-table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #f2f5f8;
}

.compare-candidates-table tbody th {
  position: sticky;
  left: 0;
  z-index: 3;
  background: #f2f5f8;
}

.compare-candidates-table thead th:first-child {
  left: 0;
  z-index: 5;
}

.compare-candidates-table tbody tr.has-diff th {
  background: #fff8f2;
}

.compare-candidates-table td {
  min-width: 130px;
}

.compare-candidates-table td .price-main {
  display: block;
}

.price-diff-note {
  display: block;
  margin-top: 2px;
  font-size: 0.76rem;
  color: #5b6f86;
  font-weight: 700;
}

.price-diff-note.is-best-price {
  color: #1f6b42;
}

.compare-candidates-table.is-diff-only tbody tr.has-diff th,
.compare-candidates-table.is-diff-only tbody tr.has-diff td {
  background: #fff7ee;
}

@media (max-width: 900px) {
  .compare-candidates-table-head {
    align-items: flex-start;
  }

  .diff-only-toggle {
    font-size: 0.8rem;
  }

  .compare-candidates-table thead th:first-child,
  .compare-candidates-table tbody th {
    min-width: 92px;
  }
}

@media (max-width: 900px) {
  .compare-candidates-bar {
    right: 8px;
    left: 8px;
    bottom: 8px;
    width: auto;
    padding: 8px;
  }

  .compare-candidates-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .compare-candidates-go,
  .compare-candidates-clear {
    text-align: center;
  }
}
