/* =========================================================
   buscadorthule — estilo unificado "como snovit"
   scope principal: #buscadorthule-wrapper
   ========================================================= */

/* wrapper y formulario */
#buscadorthule-wrapper {
  background: #f9f9f9;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
}
#buscadorthule-form .campo { margin-bottom: 15px; }
#buscadorthule-form label { display: block; margin-bottom: 5px; font-weight: bold; }
#buscadorthule-form select {
  width: 100%;
  padding: 8px;
  border-radius: 4px;
  border: 1px solid #ccc;
}

/* ===================== grupos y grid ===================== */
#buscadorthule-wrapper .buscadorthule-grupo {
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 15px;
  margin-bottom: 20px;
  background: #fff;
}
#buscadorthule-wrapper .buscadorthule-grid {
  display: grid;
  grid-template-columns: 1fr 50%;
  gap: 20px;
  align-items: flex-start;
}

/* ================ listado de productos =================== */
#buscadorthule-wrapper .buscadorthule-productos {
  display: flex;
  flex-direction: column;
  gap: 15px;
}
#buscadorthule-wrapper .buscadorthule-producto {
  display: flex;
  align-items: flex-start;
  background: #fafafa;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid #eee;
  gap: 12px;
}
#buscadorthule-wrapper .buscadorthule-producto.disabled { opacity: 0.5; }

/* checkbox a la izquierda */
#buscadorthule-wrapper .buscadorthule-producto .bt-check {
  margin-top: 4px;
  width: 18px; height: 18px;
  accent-color: #007bff;
  cursor: pointer;
}
#buscadorthule-wrapper .buscadorthule-producto .bt-check:disabled {
  opacity: .5; cursor: not-allowed;
}

/* imagen de producto — más grande (150px) */
#buscadorthule-wrapper .buscadorthule-producto img {
  width: 150px;
  height: auto;
  margin-right: 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  cursor: zoom-in;
}

/* info de producto */
#buscadorthule-wrapper .buscadorthule-producto .info { flex-grow: 1; }
#buscadorthule-wrapper .buscadorthule-producto .nombre {
  font-weight: bold;
  margin-bottom: 5px;
}
#buscadorthule-wrapper .buscadorthule-producto .nombre .ref {
  font-weight: normal;
  font-size: 0.9em;
  color: #666;
}
#buscadorthule-wrapper .buscadorthule-producto .bt-prod-link { text-decoration: none; }
#buscadorthule-wrapper .buscadorthule-producto .bt-prod-link:hover { text-decoration: underline; }
#buscadorthule-wrapper .buscadorthule-producto .stock { font-size: 0.9em; color: #666; }

/* precios y estados */
#buscadorthule-wrapper .precio-original {
  text-decoration: line-through;
  color: #999;
  margin-right: 5px;
}
#buscadorthule-wrapper .precio-descuento {
  color: #d60000;
  font-weight: bold;
}

/* producto fantasma (faltante) */
#buscadorthule-wrapper .buscadorthule-producto.missing {
  border: 1px dashed #bbb;
  background: #f7f7f7;
  color: #555;
  padding: 12px;
  border-radius: 10px;
  margin-bottom: 10px;
}

/* portada (columna derecha) */
#buscadorthule-wrapper .buscadorthule-portada {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
#buscadorthule-wrapper .buscadorthule-portada img {
  width: 100%;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 0 12px rgba(0,0,0,.1);
  cursor: zoom-in;
}

/* subtotal del grupo (sumando checkeados) */
#buscadorthule-wrapper .buscadorthule-total {
  display: flex;
  justify-content: flex-start; /* alineado a la izquierda */
  align-items: center;
  gap: .5rem;
  font-weight: bold;
  margin-top: 15px;
  font-size: 1.1em;
  padding-top: 8px;
  border-top: 1px dashed #e5e5e5;
}
#buscadorthule-wrapper .buscadorthule-total .total-importe { font-size: 1.125rem; }
/* opcional: remarcar el precio con descuento del subtotal un pelín más */
#buscadorthule-wrapper .buscadorthule-total .precio-descuento { font-size: 1.05em; }

/* botón bloqueado */
#buscadorthule-wrapper #buscadorthule-resultados .add-to-cart[disabled] {
  opacity: .6; cursor: not-allowed;
}

/* ================== selector de techo ==================== */
#buscadorthule-wrapper .techo-selector {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 10px;
  justify-content: flex-start;
}
#buscadorthule-wrapper .techo-opcion { text-align: center; max-width: 200px; }
#buscadorthule-wrapper .techo-opcion .techo-img {
  width: 200px;
  height: auto;
  opacity: .3;
  cursor: not-allowed;
  transition: .3s;
  border: 3px solid transparent;
  border-radius: 8px;
}
#buscadorthule-wrapper .techo-opcion .techo-img.activo { opacity: 1; cursor: pointer; }
#buscadorthule-wrapper .techo-opcion .techo-img.activo:hover {
  transform: scale(1.05);
  border-color: #007bff;
}
#buscadorthule-wrapper .techo-descripcion {
  font-size: .85rem;
  color: #666;
  margin-top: 4px;
  line-height: 1.3;
  max-width: 200px;
}

/* ======== feedback (añadido al carrito / errores) ======== */
#buscadorthule-wrapper .buscadorthule-feedback {
  margin-top: 12px;
  padding: 10px 15px;
  border-radius: 6px;
  font-size: 0.95em;
  font-weight: 500;
  box-shadow: 0 0 4px rgba(0,0,0,0.05);
  animation: fadeInOut 4s ease forwards;
  max-width: 100%;
}
#buscadorthule-wrapper .buscadorthule-feedback.success {
  background-color: #d4edda; color: #155724; border: 1px solid #c3e6cb;
}
#buscadorthule-wrapper .buscadorthule-feedback.error {
  background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb;
}
@keyframes fadeInOut {
  0% { opacity: 0; transform: translateY(-5px); }
  10% { opacity: 1; transform: translateY(0); }
  90% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-5px); }
}

/* =========== tarjetas resumen (alias + estilo) =========== */
#buscadorthule-wrapper .bt-resumen-grupos { margin: 1rem 0 1.25rem; }
#buscadorthule-wrapper .bt-resumen-intro { margin-bottom: .5rem; font-weight: 600; }
#buscadorthule-wrapper .bt-resumen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: .5rem;
}
#buscadorthule-wrapper .bt-resumen-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .25rem;
  border: 1px solid #eee;
  border-radius: 10px;
  padding: .75rem;
  background: #fff;
  cursor: pointer;
  width: 100%;
}
#buscadorthule-wrapper .bt-resumen-precio { font-weight: 700; }
#buscadorthule-wrapper .bt-resumen-badge {
  display: inline-block; margin-top: .25rem; font-size: .8rem; color: #b35;
}

/* compatibilidad con patrón "resumen de snovit" */
#buscadorthule-wrapper .resumen-grupos-intro { margin-top: 2rem; margin-bottom: 1rem; }
#buscadorthule-wrapper .resumen-grupos-titulo { font-weight: bold; font-size: 1.1rem; margin-bottom: 0.3rem; }
#buscadorthule-wrapper .resumen-grupos-vehiculo { font-size: 0.95rem; color: #333; }
#buscadorthule-wrapper .resumen-grupos-wrapper {
  display: flex; flex-wrap: nowrap; overflow-x: auto;
  gap: 1rem; margin-top: 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid #ccc;
}
#buscadorthule-wrapper .resumen-grupo {
  min-width: 150px; background: #f9f9f9; border: 1px solid #ddd; border-radius: 8px;
  padding: 0.75rem; text-align: center; cursor: pointer; transition: background-color 0.2s ease;
  box-shadow: 1px 1px 3px rgba(0,0,0,0.05);
}
#buscadorthule-wrapper .resumen-grupo:hover,
#buscadorthule-wrapper .resumen-grupo:focus { background-color: #eaeaea; outline: none; }
#buscadorthule-wrapper .resumen-grupo-img {
  width: 100%; height: auto; max-height: 80px; object-fit: contain; margin-bottom: 0.5rem;
}
#buscadorthule-wrapper .resumen-grupo-nombre { font-weight: bold; font-size: 0.95rem; margin-bottom: 0.3rem; }
#buscadorthule-wrapper .resumen-grupo-precio { font-size: 0.9rem; color: #444; }
#buscadorthule-wrapper .resaltado-grupo { animation: resaltadoGrupo 2s ease; }
@keyframes resaltadoGrupo {
  0% { background-color: #ffffcc; }
  100% { background-color: transparent; }
}

/* ================== LIGHTBOX (global) ==================== */
/* Nota: el overlay se inyecta en <body>, por eso NO se scopea */
.bt-lightbox {
  position: fixed; inset: 0; display: none;
  align-items: center; justify-content: center;
  background: rgba(0,0,0,.65); z-index: 10050; padding: 2rem;
}
.bt-lightbox.open { display: flex; }
.bt-lightbox-content { position: relative; max-width: 95vw; max-height: 95vh; }
.bt-lightbox-content img { display:block; max-width:95vw; max-height:95vh; width:auto; height:auto; }
.bt-lightbox-close {
  position: absolute; top: -12px; right: -12px;
  background:#fff; border:0; border-radius:999px;
  padding:.35rem .55rem; cursor:pointer; box-shadow:0 2px 10px rgba(0,0,0,.25);
}

/* ======================= responsive ====================== */
@media (max-width: 767px) {
  #buscadorthule-wrapper .buscadorthule-grid { display: flex; flex-direction: column; }
  #buscadorthule-wrapper .buscadorthule-portada { order: 2; padding-top: 10px; }
  #buscadorthule-wrapper .buscadorthule-productos { order: 1; }
}
@media (max-width: 576px){
  #buscadorthule-wrapper .buscadorthule-producto img { width: 120px; }
  #buscadorthule-wrapper .buscadorthule-producto { padding: 10px 12px; gap: 10px; }
}

/* ========= layout de campos del buscador ========= */
@media (min-width: 768px) {
  #buscadorthule-form .campos-flex {
    display: flex; flex-wrap: wrap; gap: 20px; justify-content: space-between;
  }
  #buscadorthule-form .campos-flex .campo { flex: 1; min-width: 180px; margin-bottom: 0; }
}
@media (max-width: 767px) {
  #buscadorthule-form .campos-flex { display: block; }
  #buscadorthule-form .campo { margin-bottom: 10px; }
}
@media (max-width: 768px) {
  #buscadorthule-wrapper .techo-selector { justify-content: center; }
}
/* forzar que el campo "tipo de techo" vaya debajo */
#buscadorthule-form .campo.campo-techo {
  flex: 0 0 100%;
  width: 100%;
  margin-top: 15px;
}

/* ======= manuales PDF + iconos svg ======= */
#buscadorthule-wrapper .bt-manual { margin-top: 6px; font-size: 0.95em; }
#buscadorthule-wrapper .bt-manual-link,
#buscadorthule-wrapper .bt-manual-missing {
  display: inline-flex; align-items: center; gap: .35rem;
  font-weight: 600; text-decoration: none;
}
#buscadorthule-wrapper .bt-manual-link:hover { text-decoration: underline; }
#buscadorthule-wrapper .bt-icon { width: 20px; height: 20px; flex-shrink: 0; }
#buscadorthule-wrapper .bt-manual-link { color: inherit; }
#buscadorthule-wrapper .bt-manual-link .bt-icon--pdf { color: #d93025; }
#buscadorthule-wrapper .bt-manual-missing { color: #b35; }
