/* ==========================================================================
   TT24 Vehicle Finder - Professional UI/UX Design
   Author: Expert Designer | Version: 3.0 Final
   ========================================================================== */

/* ========== CONTAINER ========== */
.tt24vf {
  padding: 32px !important;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.tt24vf > div:first-child,
.tt24vf .tw-shadow {
  box-shadow: none !important;
  padding: 0 !important;
}

.tt24vf-head { 
  font-weight: 700; 
  font-size: 18px;
  color: inherit !important; 
  margin-bottom: 20px;
  letter-spacing: -0.02em;
}

/* ========== TABS ========== */
.tt24vf-tabs {
  margin-bottom: 28px;
}

.tt24vf-tabs > div {
  display: flex !important;
  gap: 42px !important;
  padding-bottom: 0;
  border-bottom: 2px solid #e5e7eb;
}

.tt24vf-tab {
  padding: 14px 10px 12px 10px !important;
  margin: 0 !important;
  background: transparent !important;
  border: none !important;
  border-bottom: 3px solid transparent !important;
  color: #64748b !important;
  font-size: 16px !important;
  font-weight: 500 !important;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  bottom: -2px;
  white-space: nowrap;
}

.tt24vf-tab:hover {
  color: #2563eb !important;
}

.tt24vf-tab[data-active="true"] {
  font-weight: 600 !important;
  border-bottom-color: #2563eb !important;
  color: #2563eb !important;
}

/* ========== VEHICLE TYPE BUTTONS ========== */
.tt24vf-vehtypes { 
  margin-bottom: 24px;
  gap: 12px;
  display: flex;
}

.tt24vf-type {
  width: 48px !important;
  height: 48px !important;
  min-width: 48px !important;
  border: 2px solid #e5e7eb !important;
  border-radius: 10px !important;
  background: #fff !important;
  color: inherit !important;
  font-size: 22px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
}

.tt24vf-type:hover {
  border-color: #2563eb !important;
  background: #eff6ff !important;
  transform: translateY(-1px);
}

.tt24vf-type[data-on="true"] {
  background: #2563eb !important;
  border-color: #2563eb !important;
  color: #fff !important;
}

/* ========== LABELS ========== */
.tt24vf label {
  display: block !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  color: #334155 !important;
  margin-bottom: 8px !important;
  min-height: 22px;
  line-height: 1.4;
}

.tt24vf label span {
  font-weight: 400;
  color: #64748b;
  font-size: 13px;
}

/* ========== SELECTS ========== */
.tt24vf select,
.tt24vf .tt24vf-select {
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  background-color: #fff !important;
  background-image: none !important;
  border: 2px solid #e5e7eb !important;
  border-radius: 8px !important;
  padding: 11px 40px 11px 14px !important;
  font-size: 15px !important;
  line-height: 1.5 !important;
  height: 48px !important;
  color: inherit !important;
  transition: all 0.15s ease;
  cursor: pointer;
  width: 100% !important;
  outline: none !important;
  box-shadow: none !important;
  margin: 0 !important;
}

.tt24vf select:hover:not(:disabled) {
  border-color: #cbd5e1 !important;
}

.tt24vf select:focus {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1) !important;
}

.tt24vf select:disabled {
  background-color: #f8fafc !important;
  cursor: not-allowed;
  opacity: 0.65;
}

.tt24vf select option {
  color: inherit !important;
  background-color: #fff !important;
}

.tt24vf .tw-relative > span {
  pointer-events: none;
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  font-size: 12px;
}

/* ========== INPUTS ========== */
.tt24vf input[type="text"] {
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  background-color: #fff !important;
  border: 2px solid #e5e7eb !important;
  border-radius: 8px !important;
  padding: 11px 14px !important;
  font-size: 15px !important;
  line-height: 1.5 !important;
  height: 48px !important;
  color: inherit !important;
  transition: all 0.15s ease;
  width: 100% !important;
  outline: none !important;
  box-shadow: none !important;
  margin: 0 !important;
}

.tt24vf input[type="text"]:hover {
  border-color: #cbd5e1 !important;
}

.tt24vf input[type="text"]:focus {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1) !important;
}

/* =======================================================================
   Estilos personalizados para la ventana emergente de resultados VIN
   Generada desde finder.js usando SweetAlert2. Estas clases permiten
   replicar un diseño similar al mostrado en las capturas de ejemplo:
   lista de vehículos con imagen, nombre, especificaciones y badges.
   ======================================================================= */

/* Limitar ancho y ajustar márgenes del popup */
.swal2-popup.vin-popup {
  padding: 1.5rem;
  max-width: 90vw;
}

/* Contenedor de la lista scrollable */
.swal2-html-container.vin-popup-body {
  padding: 0;
  margin: 0;
  max-height: 60vh;
  overflow-y: auto;
}

/* Lista de vehículos */
.vin-results {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Cada fila de vehículo */
.vin-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.5rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background-color: #fff;
}

/* Imagen del vehículo */
.vin-img img {
  width: 96px;
  height: 60px;
  object-fit: cover;
  border-radius: 6px;
  background-color: #f3f4f6;
}

/* Contenido textual */
.vin-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.vin-name {
  font-weight: 600;
  color: #1e293b;
}

.vin-variant {
  font-weight: 500;
  color: #1e40af;
  font-size: 0.9rem;
}

.vin-meta {
  font-size: 0.85rem;
  color: #475569;
}

.vin-badges {
  margin-top: 0.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

/* Estilo base para las etiquetas */
.vin-badge {
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.75rem;
  line-height: 1;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
}

/* Combustibles (colors basados en categorías) */
.vin-badge.fuel-benzin {
  background-color: #fb7185; /* rosa */
}
.vin-badge.fuel-diesel {
  background-color: #f59e0b; /* naranja */
}
.vin-badge.fuel-ethanol {
  background-color: #10b981; /* verde */
}
.vin-badge.fuel-lpg {
  background-color: #38bdf8; /* azul claro */
}
.vin-badge.fuel-cng {
  background-color: #0ea5e9; /* azul */
}
.vin-badge.fuel-elektro {
  background-color: #a855f7; /* morado */
}
.vin-badge.fuel-default {
  background-color: #6b7280; /* gris */
}

/* Engine codes badge */
.vin-badge.engine {
  background-color: #c084fc;
}

.tt24vf input[type="text"]::placeholder {
  color: #94a3b8 !important;
}

/* ========== GRID LAYOUT - CRITICAL FOR BUTTON ALIGNMENT ========== */
.tt24vf .tw-grid {
  display: grid !important;
  gap: 16px !important;
  align-items: end !important;
}

.tt24vf .md\:tw-col-span-4,
.tt24vf .md\:tw-col-span-3,
.tt24vf .md\:tw-col-span-5,
.tt24vf .md\:tw-col-span-10,
.tt24vf .md\:tw-col-span-2,
.tt24vf .md\:tw-col-span-1 {
  display: flex !important;
  flex-direction: column !important;
}

/* ========== BUTTONS ========== */
.tt24vf button {
  box-sizing: border-box;
}

.tt24vf .tt24vf-search,
.tt24vf .tt24vf-clear,
.tt24vf .tt24vf-do-kba,
.tt24vf .tt24vf-do-vin,
.tt24vf .btn-primary,
.tt24vf .btn-clear {
  border-radius: 8px !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  cursor: pointer;
  transition: all 0.15s ease;
  outline: none !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
  height: 48px !important;
  white-space: nowrap;
  padding: 0 18px !important;
  margin: 0 !important;
  border: none !important;
  box-shadow: none !important;
}

/* Icon buttons (🔎 y ✕) */
.tt24vf button.tw-w-11,
.tt24vf .tw-w-11.tw-h-11 {
  width: 48px !important;
  height: 48px !important;
  min-width: 48px !important;
  min-height: 48px !important;
  padding: 0 !important;
  flex-shrink: 0;
}

/* Primary buttons */
.tt24vf .tt24vf-search,
.tt24vf .tt24vf-do-kba,
.tt24vf .tt24vf-do-vin,
.tt24vf .btn-primary {
  background: #2563eb !important;
  color: #fff !important;
  min-width: 120px;
}

.tt24vf .tt24vf-search:hover:not(:disabled),
.tt24vf .tt24vf-do-kba:hover:not(:disabled),
.tt24vf .tt24vf-do-vin:hover:not(:disabled),
.tt24vf .btn-primary:hover:not(:disabled) {
  background: #1d4ed8 !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25) !important;
}

/* Clear button */
.tt24vf .tt24vf-clear,
.tt24vf .btn-clear {
  background: #fff !important;
  color: #475569 !important;
  border: 2px solid #e5e7eb !important;
}

.tt24vf .tt24vf-clear:hover,
.tt24vf .btn-clear:hover {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
}

.tt24vf button:disabled {
  opacity: 0.5;
  cursor: not-allowed !important;
  transform: none !important;
}

/* Button container alignment */
.tt24vf .tw-items-end {
  align-items: flex-end !important;
  display: flex !important;
  gap: 8px !important;
  margin: 0 !important;
}

/* ========== INFO BOXES ========== */
.tt24vf .tw-bg-blue-50 {
  background-color: #eff6ff !important;
  border: 1px solid #bfdbfe !important;
  border-radius: 8px !important;
  padding: 16px !important;
  margin-bottom: 20px;
}

.tt24vf .tw-bg-blue-50 p {
  margin: 0 !important;
  color: #1e40af !important;
  font-size: 14px !important;
  line-height: 1.6 !important;
}

.tt24vf .tw-bg-blue-50 strong {
  color: #1e40af !important;
  font-weight: 600;
}

/* ========== TAB PANELS ========== */
.tt24vf [role="tabpanel"] {
  padding-top: 4px;
}

.tt24vf [role="tabpanel"][hidden] {
  display: none !important;
}

/* ========== RESULTS ========== */
.tt24vf-results,
.tt24vf-kba-out,
.tt24vf-vin-out { 
  min-height: 40px;
  margin-top: 28px;
}

.tt24vf-loading { 
  padding: 24px; 
  text-align: center;
  color: #64748b;
  font-size: 14px;
}

/* ========== PRODUCT GRID ========== */
.tt24vf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}

.tt24vf-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 14px;
  text-decoration: none;
  background: #fff;
  transition: all 0.2s ease;
}

.tt24vf-card:hover { 
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
  transform: translateY(-2px);
  border-color: #cbd5e1;
}

.tt24vf-thumb { 
  width: 100%; 
  aspect-ratio: 1/1; 
  object-fit: contain; 
  background: #f8fafc; 
  border-radius: 8px;
}

.tt24vf-thumb.ph { 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  font-size: 32px; 
  color: #94a3b8;
}

.tt24vf-title { 
  color: inherit !important;
  font-weight: 600; 
  font-size: 14px; 
  line-height: 1.3; 
  min-height: 38px;
}

.tt24vf-price { 
  color: inherit !important;
  font-weight: 700; 
  font-size: 16px;
}

/* ========== PAGINATION ========== */
.tt24vf-pager { 
  display: flex; 
  gap: 8px; 
  margin-top: 24px; 
  justify-content: center;
  flex-wrap: wrap;
}

.tt24vf-pager button {
  border: 2px solid #e5e7eb; 
  background: #fff; 
  padding: 10px 14px; 
  border-radius: 8px; 
  cursor: pointer;
  transition: all 0.15s ease;
  font-weight: 500;
  font-size: 14px;
  min-width: 40px;
}

.tt24vf-pager button:hover:not(.on) {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.tt24vf-pager button.on { 
  background: #2563eb; 
  color: #fff; 
  border-color: #2563eb;
}

/* ========== ANIMATIONS ========== */
.tt24vf-shake { 
  animation: tt24vfshake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes tt24vfshake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-6px); }
  40%, 60% { transform: translateX(6px); }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .tt24vf {
    padding: 20px !important;
  }
  
  .tt24vf-tabs > div {
    gap: 24px !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .tt24vf-tab {
    font-size: 14px !important;
    padding: 12px 6px 10px 6px !important;
  }
  
  .tt24vf .tw-grid {
    gap: 12px !important;
  }
  
  .tt24vf-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
  }
}

@media (max-width: 480px) {
  .tt24vf {
    padding: 16px !important;
  }
  
  .tt24vf-head {
    font-size: 16px;
  }
  
  .tt24vf-tabs > div {
    gap: 18px !important;
  }
}

/* ========== DEBUG ========== */
.tt24vf-pre { 
  background: #0f172a; 
  color: #e2e8f0; 
  padding: 16px; 
  border-radius: 8px; 
  max-height: 300px; 
  overflow: auto;
  font-family: 'SF Mono', 'Monaco', monospace;
  font-size: 13px;
  line-height: 1.5;
}

/* ========== UTILITY FIXES ========== */
.tt24vf * {
  box-sizing: border-box;
}

.tt24vf .tw-gap-2 { gap: 8px !important; }
.tt24vf .tw-gap-3 { gap: 16px !important; }
.tt24vf .tw-mb-3 { margin-bottom: 12px !important; }
.tt24vf .tw-mb-4 { margin-bottom: 20px !important; }
.tt24vf .tw-mt-3 { margin-top: 12px !important; }
.tt24vf .tw-mt-4 { margin-top: 20px !important; }

/* =========================================
   VIN POPUP — LISTADO A 1 COLUMNA
   ========================================= */

/* Contenedor SweetAlert2 (mantén tus estilos previos) */
.swal2-popup.tt24vf-swal {
  border-radius: 16px;
  padding: 0;
  overflow: hidden;
}

/* El listado de vehículos siempre en una sola columna */
.tt24vf-vehicle-list {
  list-style: none;
  margin: 10px 2px 2px 2px;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;   /* <-- 1 COLUMNA SIEMPRE */
  gap: 10px;
}

/* Tarjeta */
.tt24vf-vehicle-list > li {
  display: grid;
  grid-template-columns: 1fr auto; /* texto + CTA */
  gap: 8px;
  align-items: center;
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 12px;
  padding: 12px 12px;
  transition: box-shadow .2s ease, border-color .2s ease, transform .06s ease;
}
.tt24vf-vehicle-list > li:hover {
  border-color: #93c5fd;
  box-shadow: 0 4px 14px rgba(15,23,42,.06);
}
.tt24vf-vehicle-list > li:active { transform: translateY(1px); }

.tt24vf-vehicle-list > li > strong,
.tt24vf-vehicle-list > li .model {
  display: block;
  font-weight: 700;
  color: #111827;
  line-height: 1.25rem;
  margin-bottom: 4px;
  word-break: break-word;
}

.tt24vf-vehicle-list > li .meta,
.tt24vf-vehicle-list > li .badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tt24vf-vehicle-list > li .fuel,
.tt24vf-vehicle-list > li .cc,
.tt24vf-vehicle-list > li .power,
.tt24vf-vehicle-list > li .years,
.tt24vf-vehicle-list > li .engine,
.tt24vf-vehicle-list > li .engine_codes {
  display: inline-block;
  font-size: 11px;
  line-height: 18px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f8fafc;
  color: #1f2937;
  border: 1px solid #e5e7eb;
}

.tt24vf-vehicle-list > li .fuel {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}
.tt24vf-vehicle-list > li .fuel:empty { display: none; }

.tt24vf-vehicle-list > li .tt24vf-select-vehicle {
  justify-self: end;
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #1f2937;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .2s ease, color .2s ease, background .2s ease;
}
.tt24vf-vehicle-list > li .tt24vf-select-vehicle:hover {
  border-color: #60a5fa;
  color: #1d4ed8;
  background: #eff6ff;
}

/* Forzar centrado vertical del contenedor SweetAlert2 */
.swal2-container.tt24vf-swal-center {
  align-items: center !important;
}

/* Popup pulido (bordes suaves + ancho fijo bonito) */
.swal2-popup.tt24vf-swal {
  border-radius: 16px;
  padding: 0;
  overflow: hidden;
  width: 920px !important; /* coincide con JS */
  max-width: 92vw;
}

/* Body con scroll interno y sin desbordar viewport */
.swal2-html-container.tt24vf-swal-body {
  margin: 0 !important;
  padding: 12px 12px 14px 12px;
  max-height: 70vh;      /* scroll interno */
  overflow: auto;
}

/* (ya tienes) 1 columna siempre */
.tt24vf-vehicle-list { grid-template-columns: 1fr; }

/* Botón seleccionar con mejor hit-area (opcional) */
.tt24vf-vehicle-list > li .tt24vf-select-vehicle {
  min-width: 120px;
}

