/* Oportunidades: tarjetas de lotes destacados (página /oportunidades). */
.opp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
  margin-top: 24px;
}
.opp-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.opp-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.12);
}
/* Todas las fotos de las tarjetas tienen el mismo formato (4:3), sea cual sea la foto original:
   la imagen se coloca encima del recuadro (absoluta) y se recorta, así una foto vertical o muy ancha
   no puede estirar la tarjeta. Vale para autos, luxury, motos, motos de agua, botes y Heavy Duty. */
.opp-media {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #0f172a;
  cursor: pointer;
}
.opp-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}
.opp-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #ffffff;
  background: #1d4ed8;
}
.opp-badge--iaai { background: #7c3aed; }
.opp-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}
.opp-title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 800;
  line-height: 1.3;
  color: #0f172a;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.opp-price {
  margin: 2px 0 0;
  font-size: 1.15rem;
  font-weight: 800;
  color: #e11d48;
}
.opp-price small {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  margin-left: 4px;
}
/* Compra ya: azul. Sin puja ni compra ya: gris, sin monto. */
.opp-price--bin { color: #2563eb; }
.opp-price--none { color: #64748b; font-size: 1rem; }
.opp-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.opp-chip {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #334155;
}
.opp-yard {
  margin: 0;
  font-size: 0.8rem;
  color: #64748b;
}
.opp-actions {
  margin-top: auto;
  padding-top: 6px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.opp-btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 11px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-decoration: none;
}
.opp-btn--primary {
  background: #1d4ed8;
  color: #ffffff;
}
.opp-btn--primary:hover { background: #1e40af; }
.opp-btn--ghost {
  background: #ffffff;
  color: #0f172a;
  border: 1.5px solid #cbd5e1;
}
.opp-btn--ghost:hover { border-color: #0f172a; }
.opp-empty {
  margin-top: 24px;
  color: #64748b;
}
/* Aviso de precio y disponibilidad, bajo el título de lotes destacados */
.opp-note {
  margin: 4px 0 0;
  font-size: 0.78rem;
  line-height: 1.4;
  color: #64748b;
}
@media (max-width: 480px) {
  .opp-grid { grid-template-columns: 1fr; }
}

/* Botón "Fotos y detalles" de la tarjeta */
.opp-btn--details {
  width: 100%;
  background: #eff6ff;
  color: #2563EB;
  border: 1.5px solid #bfdbfe;
  cursor: pointer;
  font-family: inherit;
}
.opp-btn--details:hover { background: #dbeafe; }
.opp-media { cursor: pointer; }

/* Ventana de detalle: galería y ficha */
body.opp-lock { overflow: hidden; }
.opp-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(15, 23, 42, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.opp-modal[hidden] { display: none; }
.opp-modal__dialog {
  position: relative;
  width: min(1100px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: #ffffff;
  border-radius: 20px;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 0;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.35);
}
.opp-modal__close {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 2;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.7);
  color: #ffffff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
/* La X sigue visible al hacer scroll dentro del visor (en móvil el diálogo se desplaza). */
.opp-modal__close {
  position: sticky;
  top: 10px;
  grid-column: 1 / -1;
  grid-row: 1;
  justify-self: end;
  margin: 10px 12px -48px auto;
}
.opp-modal__gallery {
  padding: 16px;
  background: #0f172a;
  border-radius: 20px 0 0 20px;
}
.opp-modal__stage {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  overflow: hidden;
  background: #020617;
}
.opp-modal__stage img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.opp-modal__gallery,
.opp-modal__info {
  min-width: 0;
}
/* Las etiquetas de la tarjeta son absolutas; dentro de la ventana van en línea. */
.opp-modal .opp-badge {
  position: static;
  align-self: flex-start;
}
.opp-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  color: #0f172a;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}
.opp-nav--prev { left: 10px; }
.opp-nav--next { right: 10px; }
.opp-counter {
  position: absolute;
  left: 12px;
  bottom: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.75);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
}
.opp-modal__thumbs {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.opp-thumb {
  flex: 0 0 auto;
  width: 84px;
  height: 62px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 10px;
  overflow: hidden;
  background: #1e293b;
  cursor: pointer;
}
.opp-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.opp-thumb.is-active { border-color: #2563EB; }
.opp-modal__info {
  padding: 26px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.opp-modal__title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.25;
  color: #0f172a;
}
.opp-specs {
  margin: 4px 0 0;
  display: grid;
  gap: 0;
  border-top: 1px solid #e5e7eb;
}
.opp-spec {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid #e5e7eb;
  font-size: 0.9rem;
}
.opp-spec dt { color: #64748b; font-weight: 600; }
.opp-spec dd { margin: 0; color: #0f172a; font-weight: 700; text-align: right; }
@media (max-width: 860px) {
  .opp-modal__dialog { grid-template-columns: minmax(0, 1fr); }
  .opp-modal__gallery { border-radius: 20px 20px 0 0; }
}

/* Versión compacta de la tarjeta */
.opp-meta {
  margin: 0;
  font-size: 0.78rem;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.opp-auction {
  margin: 4px 0 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: #1d4ed8;
}
.opp-auction--pending { color: #64748b; font-weight: 500; }
.opp-auction--pending span { font-weight: 400; font-style: italic; }
.opp-actions {
  margin-top: 8px;
  padding-top: 0;
  grid-template-columns: 1fr 1.6fr;
}
.opp-btn {
  padding: 9px 10px;
  font-size: 0.75rem;
}
.opp-lot {
  margin-top: 4px;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: #2563EB;
  text-decoration: none;
}
.opp-lot:hover { text-decoration: underline; }
.opp-card { border-radius: 16px; }

/* Encabezado "Lotes destacados" compacto en escritorio, con su borde superior a 122 px (igual que Nosotros). */
@media (min-width: 769px) {
  #oportunidades-panel { padding-top: 96px; }
  #oportunidades-panel .catalog-section-header { padding: 10px 16px; margin-bottom: 16px; }
  #oportunidades-panel .catalog-section-title { font-size: 1rem; line-height: 1.2; margin: 0; }
  #oportunidades-panel .opp-note { font-size: 0.72rem; line-height: 1.3; margin: 2px 0 0; }
  #oportunidades-panel .catalog-section-desc { font-size: 0.75rem; line-height: 1.3; margin: 2px 0 0; }
}

/* Modal del lote: el único botón ocupa todo el ancho, centrado y en una sola línea. */
.opp-modal .opp-actions {
  grid-template-columns: 1fr;
  justify-items: stretch;
}
.opp-modal .opp-actions .opp-btn--primary {
  width: 100%;
  white-space: nowrap;
  text-align: center;
}

/* Pestañas por categoría: Vehículos, Motocicletas, Botes */
.opp-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}
.opp-tab {
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #374151;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.opp-tab:hover { border-color: #1d4ed8; color: #1d4ed8; }
.opp-tab.is-active {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #ffffff;
}
.opp-tab__count { font-weight: 400; opacity: 0.8; }

/* Paginación: 20 por página, con opción de 10 o 15 */
.opp-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 28px 0 8px;
  font-size: 0.85rem;
  color: #374151;
}
.opp-pager:empty { display: none; }
.opp-pager__btn {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #1d4ed8;
  font-weight: 600;
  cursor: pointer;
}
.opp-pager__btn:disabled { opacity: 0.4; cursor: default; }
.opp-pager__btn:not(:disabled):hover { border-color: #1d4ed8; }
.opp-pager__info { font-weight: 600; }
.opp-pager__size select {
  margin-left: 6px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
}

/* Lote resaltado desde AutoFinder: brillo suave y lento (no parpadea). */
@keyframes opp-soft-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
  50% { box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.16); }
}
.opp-card--highlight {
  border-color: rgba(37, 99, 235, 0.45);
  animation: opp-soft-glow 3.6s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  .opp-card--highlight { animation: none; }
}
.opp-pager__nums { display: flex; gap: 6px; align-items: center; }
.opp-pager__num {
  min-width: 36px;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #374151;
  font-weight: 600;
  cursor: pointer;
}
.opp-pager__num:hover { border-color: #1d4ed8; color: #1d4ed8; }
.opp-pager__num.is-active { background: #1d4ed8; border-color: #1d4ed8; color: #ffffff; }

/* Ficha: puja actual y compra ahora por lado a lado */
.opp-price__sep { display: inline-block; width: 22px; }
.opp-modal .opp-price { display: flex; flex-wrap: wrap; align-items: baseline; }
/* Compra ahora por: el monto en azul, a la derecha de la etiqueta */
.opp-modal .opp-bin { color: #2563eb; }
.opp-modal .opp-price small { margin-left: 0; margin-right: 6px; }

/* Buscador, filtros y orden de oportunidades: una sola línea y compacto, como el del catálogo */
.opp-console {
  margin: 14px 0 12px;
  padding: 18px 24px;
  border-radius: 16px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}
.opp-console .search-console-grid {
  grid-template-columns: 1.4fr repeat(5, 1fr) auto;
  gap: 12px;
}
.opp-console .search-console-group input {
  width: 100%; padding: 12px 14px; border-radius: 10px; font: inherit; font-size: 0.88rem; font-weight: 500;
  border: 1.5px solid #E2E8F0; background: #F8FAFC; color: #0F172A; outline: none;
}
.opp-console .search-console-group input:focus { border-color: var(--primary); background: #FFFFFF; }
.opp-console .search-console-group input::placeholder { color: #94A3B8; }
.opp-console .btn-dealership-search { padding: 12px 18px; }
@media (min-width: 769px) {
  .opp-console { zoom: 0.7; }
}
/* Móvil: la rejilla de 7 columnas de arriba anulaba las reglas globales y los campos se cortaban.
   Aquí se reinicia: 2 columnas en tablet y 1 en celular, con el buscador a todo el ancho. */
@media (max-width: 992px) {
  .opp-console .search-console-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .opp-console .search-console-group { min-width: 0; }
  .opp-console .search-console-group select,
  .opp-console .search-console-group input { min-width: 0; max-width: 100%; }
  .opp-console .opp-console__search,
  .opp-console .btn-dealership-search { grid-column: 1 / -1; }
}
@media (max-width: 580px) {
  .opp-console { padding: 14px; }
  .opp-console .search-console-grid { grid-template-columns: minmax(0, 1fr); }
}
.opp-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 20px; }
/* Pestañas y orden en la misma línea: las pestañas no traen margen propio dentro de la barra */
.opp-toolbar .opp-tabs { margin-top: 0; }
.opp-sort { display: inline-flex; align-items: center; gap: 8px; font-size: 0.85rem; font-weight: 600; margin: 0; }
.opp-sort select {
  height: 38px; padding: 0 12px; border-radius: 999px; font: inherit; font-size: 0.85rem; color: inherit;
  border: 1px solid #d1d5db; background: #ffffff;
}
.opp-count { margin: 10px 0 0; font-size: 13px; opacity: 0.75; }
@media (max-width: 640px) {
  .opp-toolbar { flex-direction: column; align-items: stretch; }
  .opp-sort { justify-content: space-between; }
}
