/* ===== COMPARADOR ===== */

/* Wrapper de color: neutraliza cualquier herencia de Astra */
.rl-comparador-page {
  color: var(--text-primary);
  background: var(--bg-primary);
}

/* ── Página del comparador ── */
.rl-comparador-hero {
  background: var(--dark);
  padding: 40px 0 32px;
}
.rl-comparador-hero__title {
  font-family: var(--font-heading);
  font-size: clamp(28px, 5vw, 52px);
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
}
.rl-comparador-hero__title em { font-style: normal; color: var(--color-primary-hl); }
.rl-comparador-hero__sub { color: rgba(255,255,255,.55); font-size: 16px; margin-top: 8px; }
.rl-comparador-body { padding: 32px 0 64px; }

/* ── Slot selector (grid 3 col) ── */
.rl-comp-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 8px;
}

/* ── Card base ── */
.rl-comp-card {
  border: 2px dashed var(--border-medium);
  border-radius: var(--radius-md);
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: border-color 0.15s, box-shadow 0.15s, min-height 0.2s;
  background: var(--bg-primary);
  overflow: hidden;
}
.rl-comp-card:hover { border-color: var(--color-primary-hl); }
.rl-comp-card.has-product {
  border-style: solid;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px rgba(27,79,219,0.15);
}
.rl-comp-card.is-searching {
  min-height: 340px;
  align-items: flex-start;
  justify-content: flex-start;
  border-style: solid;
  border-color: var(--color-primary);
}

/* ── Empty state ── */
.rl-comp-card__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 14px;
  padding: 24px 20px;
  text-align: center;
  cursor: pointer;
  width: 100%;
}
.rl-comp-card__plus {
  width: 48px;
  height: 48px;
  border: 2px dashed var(--border-medium);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--text-muted);
  transition: border-color 0.15s, color 0.15s;
}
.rl-comp-card__empty:hover .rl-comp-card__plus {
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.rl-comp-card__empty-label { color: var(--text-muted); font-size: 13px; }

/* ── Inline search panel ── */
.rl-comp-card__search {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding: 10px;
}
.rl-comp-card__search-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-secondary);
  border: 1.5px solid var(--color-primary);
  border-radius: var(--radius);
  padding: 6px 8px;
  margin-bottom: 6px;
}
.rl-comp-inline-search {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  font-family: var(--font-body);
  min-width: 0;
}
.rl-comp-inline-search::placeholder { color: var(--text-muted); }
.rl-comp-search-cancel {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 2px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: color 0.12s;
}
.rl-comp-search-cancel:hover { color: var(--color-accent); }

/* ── Resultados inline ── */
.rl-comp-inline-results {
  flex: 1;
  overflow-y: auto;
  max-height: 260px;
}
.rl-comp-inline-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  padding: 4px 6px 2px;
}
.rl-comp-inline-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: var(--radius);
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: background 0.1s;
}
.rl-comp-inline-item:hover:not([disabled]) { background: var(--bg-secondary); }
.rl-comp-inline-item[disabled] { opacity: 0.4; cursor: not-allowed; }
.rl-comp-inline-item img {
  width: 44px;
  height: 34px;
  object-fit: contain;
  border-radius: var(--radius);
  background: var(--bg-tertiary);
  flex-shrink: 0;
}
.rl-comp-inline-item__thumb-ph {
  width: 44px;
  height: 34px;
  background: var(--bg-tertiary);
  border-radius: var(--radius);
  flex-shrink: 0;
}
.rl-comp-inline-item__info { flex: 1; min-width: 0; }
.rl-comp-inline-item__name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rl-comp-inline-item__sub { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.rl-comp-inline-item__price {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 700;
  color: var(--color-primary);
  flex-shrink: 0;
}
.rl-comp-inline-msg { padding: 8px; font-size: 12px; color: var(--text-muted); }

/* ── Slot lleno ── */
.rl-comp-card__filled {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 20px 16px;
  width: 100%;
  text-align: center;
}
.rl-comp-card__img {
  width: 100px;
  height: 75px;
  object-fit: contain;
  border-radius: var(--radius);
  background: var(--bg-secondary);
}
.rl-comp-card__img-placeholder {
  width: 100px;
  height: 75px;
  background: var(--bg-tertiary);
  border-radius: var(--radius);
}
.rl-comp-card__marca {
  font-family: var(--font-heading);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--color-primary);
}
.rl-comp-card__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}
.rl-comp-card__price {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  color: var(--color-primary);
}
.rl-comp-card__remove {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--dark);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s;
  line-height: 1;
}
.rl-comp-card__remove:hover { background: var(--color-accent); }
.rl-comp-card__link {
  font-size: 12px;
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 600;
  margin-top: 4px;
  transition: color 0.12s;
}
.rl-comp-card__link:hover { color: var(--color-primary-hl); }

/* ── Botón comparar ── */
.rl-comp-cta-wrap { text-align: center; margin: 28px 0 8px; }
.rl-comp-hint { font-size: 13px; color: var(--text-muted); margin-top: 10px; }

/* ── Tabla comparativa ── */
.rl-comp-table-wrap {
  overflow-x: auto;
  margin-top: 40px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
}
.rl-comp-table { width: 100%; border-collapse: collapse; }
.rl-comp-table th,
.rl-comp-table td {
  padding: 12px 16px;
  text-align: center;
  border-bottom: 1px solid var(--border-light);
  font-size: 14px;
  vertical-align: middle;
  color: var(--text-primary);
}
.rl-comp-table th {
  font-family: var(--font-heading);
  font-weight: 700;
  background: var(--bg-secondary);
  color: var(--text-primary);
}
.rl-comp-table__label-col {
  text-align: left;
  color: var(--text-secondary);
  font-weight: 500;
  min-width: 140px;
  font-size: 13px;
}
.rl-comp-table tr:last-child td { border-bottom: none; }
.rl-comp-table tr:nth-child(even) td { background: var(--bg-secondary); }
.rl-comp-table .is-best { color: var(--color-success); font-weight: 700; }
.rl-comp-table .is-worst { color: var(--color-accent); }
.rl-comp-table__product-header { min-width: 160px; }
.rl-comp-table__product-img {
  width: 80px;
  height: 60px;
  object-fit: contain;
  margin: 0 auto 8px;
  display: block;
  background: var(--bg-tertiary);
  border-radius: var(--radius);
}
.rl-comp-table__product-name { font-size: 13px; line-height: 1.3; color: var(--text-primary); }
.rl-comp-table__product-score {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  color: var(--color-primary);
  display: block;
  margin: 4px 0;
}
.rl-comp-table__product-price { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.rl-comp-table__section-row td {
  background: var(--dark) !important;
  color: rgba(255,255,255,.7);
  font-family: var(--font-heading);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 700;
  padding: 8px 16px;
}

/* ── Score bar ── */
.rl-score-bar { display: flex; align-items: center; gap: 6px; justify-content: center; }
.rl-score-bar__track {
  flex: 1;
  max-width: 80px;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
}
.rl-score-bar__fill { height: 100%; background: var(--color-primary); border-radius: 3px; }
.rl-score-bar__val { font-size: 12px; font-weight: 600; }

/* ── Home: comparador-rapido ── */
.rl-comp-rapido { background: var(--bg-primary); }
.rl-comp-rapido .rl-comp-selector { margin-bottom: 0; }
.rl-comp-rapido .rl-comp-cta-wrap { margin-top: 20px; }
.rl-comp-rapido .rl-comp-table-wrap { margin-top: 32px; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .rl-comp-selector { grid-template-columns: repeat(2, 1fr); }
  .rl-comp-selector .rl-comp-card:last-child { grid-column: 1 / -1; max-width: 50%; margin: 0 auto; width: 100%; }
}
@media (max-width: 600px) {
  .rl-comp-selector { grid-template-columns: 1fr; }
  .rl-comp-selector .rl-comp-card:last-child { grid-column: auto; max-width: none; }
}
