/* --- Estilos de la Modal y Botones --- */
.open-modal-trigger {
  margin-top: auto;
  /* Empuja el botón al final de la tarjeta */
  padding: 12px;
  background-color: #4c6793;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: bold;
  transition: background-color 0.3s;
}

.open-modal-trigger:hover {
  background-color: #3b5072;
}

.modal-container {
  display: none;
  justify-content: center;
  align-items: center;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
}

.modal-container.active {
  display: flex;
}

.modal-vehiculo {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  width: 85%;
  max-width: 667px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  display: flex;
  flex-direction: column;
  transition: all 0.4s ease;
}

.modal-vehiculo::-webkit-scrollbar {
  width: 6px;
}

.modal-vehiculo::-webkit-scrollbar-thumb {
  background: rgba(76, 103, 147, 0.3);
  border-radius: 10px;
}

.modal-vehiculo::-webkit-scrollbar-thumb:hover {
  background: rgba(76, 103, 147, 0.5);
}

.modal-vehiculo::-webkit-scrollbar-track {
  background: transparent;
}


.modal-scroll-content-vehiculo {
  flex-grow: 1;
  padding: 20px;
  background-color: #f0f4f9;
}

.modal-img {
  width: auto;
  height: auto;
  display: block;
  object-fit: cover;
}

.modal-title {
  color: #4c6793;
  font-size: 2em;
  font-weight: bold;
  margin-bottom: 10px;
}

.modal-description {
  color: #555;
  font-size: 1em;
  line-height: 1.5;
  margin-bottom: 20px;
}

.modal-close-btn {
  position: absolute;
  top: 10px;
  right: 15px;
  background: transparent;
  border: none;
  font-size: 2em;
  color: #555;
  cursor: pointer;
  z-index: 10;
}

.modal-close-btn:hover {
  color: #000;
}

.caracteristicas-grid {
  display: grid;
  gap: 15px;
  margin-bottom: 20px;
}

.caracteristica {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #4c6793;
}

.caracteristica i {
  width: 24px;
  text-align: center;
  margin-right: 8px;
}

.caracteristica span {
  flex: 1;
}

/* --- Estilos del Formulario de Cotización --- */
.btn-cotizacion {
  width: 100%;
  padding: 15px;
  background: linear-gradient(90deg, #b25895 0%, #4c6793 100%);
  color: white;
  font-size: 1.2em;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  transition: background 0.3s ease, transform 0.2s ease;
}

.btn-cotizacion:hover {
  transform: scale(1.02);
}

.btn-cotizacion.hidden {
  display: none;
}

.formulario-cotizacion {
  display: none;
  grid-template-columns: 1fr;
  gap: 15px;
  padding-top: 20px;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.formulario-cotizacion.active {
  display: grid;
  opacity: 1;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-weight: bold;
  margin-bottom: 5px;
  color: #4c6793;
}

.form-group input,
.form-group select {
  width: 100%;
  box-sizing: border-box;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 5px;
}

.input-telefono {
  display: flex;
  gap: 5px;
}

.input-telefono select#codigo-area {
  flex-grow: 0;
  width: auto;
  background-color: #fff;
  cursor: pointer;
}

.input-telefono input#telefono {
  flex-grow: 1;
}

.form-buttons {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.btn-enviar {
  flex: 1;
  min-width: 150px;
  padding: 12px;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  transition: transform 0.2s ease;
}

.btn-enviar.whatsapp {
  background-color: #25d366;
}

.btn-enviar.email {
  background-color: #1A3F7A;
}

.btn-enviar.regresar {
  background-color: #6c757d;
}

.btn-enviar:hover {
  transform: scale(1.02);
}

/* ---------------------------------------------------- */
/* Sección Principal & Encabezado                       */
/* ---------------------------------------------------- */

.vehicles-section {
  font-family: "Montserrat", sans-serif;
  background-color: var(--primary-color-light);
  padding: 40px 0;
  /* Ajustado para dar espacio al scroll */
}

.vehicles-header-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  /* Padding para el header */
}

.section-header {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 0;
  margin-bottom: 30px;
  position: relative;
}

.header-title-wrapper {
  width: 100%;
  text-align: center;
}

.header-filter-wrapper {
  width: 100%;
  margin-top: 20px;
}

.page-title {
  font-size: 3.4em;
  background-image: linear-gradient(90deg,
      var(--primary-color-pink) 47%,
      var(--primary-color-blue) 78%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: bold;
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 0;
}

.filter-controls {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: flex-end;
  /* Alinea el filtro a la derecha */
}

.filter-button {
  display: flex;
  align-items: center;
  gap: 20px;
  background-color: #e6e6e6;
  color: var(--primary-color-blue);
  border: none;
  padding: 10px 35px;
  border-radius: 5px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 400;
  font-size: 1em;
  transition: background-color 0.3s, color 0.3s;
}

.filter-button.open {
  background-color: var(--primary-color-blue);
  color: var(--primary-color-light);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.filter-dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  /* Asegura que el dropdown esté alineado a la derecha */
  background-color: var(--primary-color-light);
  border: 1px solid #ddd;
  border-top: none;
  border-bottom-left-radius: 5px;
  border-bottom-right-radius: 5px;
  width: 180px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  z-index: 10;
  display: none;
}

.filter-dropdown-menu.open {
  display: block;
}

.filter-option {
  display: block; /* Importante para que los enlaces ocupen todo el ancho */
  padding: 10px 15px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 400;
  font-size: 0.9em;
  color: #333;
  text-decoration: none; /* Quita el subrayado de los enlaces */
  transition: background-color 0.2s ease-in-out;
}

.filter-option:hover {
  background-color: #e9ecef;
  color: #333; /* Mantiene el color del texto al hacer hover */
  text-decoration: none; /* Asegura que no aparezca subrayado en hover */
}

/* ---------------------------------------------------- */
/* Cuadrícula de Vehículos                              */
/* ---------------------------------------------------- */

.vehicles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 20px;
  max-width: 1400px;
  margin: 0 auto;
  justify-items: center;
}

.car-card {
  display: flex;
  flex-direction: column;
  background-color: #f8f9fa;
  border-radius: 25px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 402px;
  height: auto;
  overflow: hidden;
  transition: transform 0.3s ease;
}

.car-image-container {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 25px 0;
  background-color: var(--primary-color-light);
}

.car-image {
  width: 295px;
  height: auto;
  display: block;
}

.info-icon {
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: 24px;
  cursor: pointer;
  background: linear-gradient(90deg, var(--primary-color-pink) 0%, #5E1D38 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  transition: transform 0.2s ease;
  /* Añadido para suavizar la animación */
}

.info-icon:hover {
  transform: scale(1.1);
}

.car-details {
  padding: 20px 30px;
  flex-grow: 1;
  background-color: #f1f1f1;
}

.car-title {
  font-size: 2em;
  font-weight: 700;
  color: var(--primary-color-blue);
  margin: 0 0 5px;
  font-family: inherit;
}

.car-subtitle {
  font-size: 1.1em;
  font-weight: 600;
  color: rgba(136, 136, 136, 1);
  margin: 0 0 20px;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-family: inherit;
}

.features-list {
  list-style: none;
  padding: 0;
  margin: 0;
  color: #333;
}

.features-list li {
  display: flex;
  align-items: center;
  margin-bottom: 15px;
  font-size: 16px;
  font-weight: 400;
}

.features-list li i {
  color: var(--secondary-color-aqua);
  width: 25px;
  height: 25px;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 15px;
}

.is-invalid {
  border: 1px solid rgb(252, 159, 159) !important;
  background-color: #ffe6e6 !important;
}

/* ---------------------------------------------------- */
/* Media Queries                                        */
/* ---------------------------------------------------- */

@media (min-width: 1200px) {
  .modal {
    max-width: 1000px;
  }

  .formulario-cotizacion {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* --- Estilos para PC / Laptop (más de 1023px) --- */
@media (min-width: 1024px) {
  .page-title {
    font-size: 3.4em;
  }

  /* En PC, el grid se mantiene como está definido originalmente */
}

/* --- ESTILOS PARA SCROLL HORIZONTAL EN TABLETS Y SMARTPHONES --- */
@media (max-width: 1023px) {
  .page-title {
    font-size: 3em;
  }

  .vehicles-grid {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    width: auto;
    max-width: 100%;
    padding: 0 20px 20px 20px;
    margin: 0;
    grid-template-columns: none;
    justify-items: unset;
  }

  /* Estilos para la barra de scroll */
  .vehicles-grid::-webkit-scrollbar {
    height: 8px;
  }

  .vehicles-grid::-webkit-scrollbar-thumb {
    background: rgba(26, 63, 122, 0.6);
    border-radius: 10px;
  }

  .vehicles-grid::-webkit-scrollbar-track {
    background: #e0e0e0;
    border-radius: 10px;
  }

  .car-card {
    /* 4. LA CORRECCIÓN CLAVE: Respetamos el ancho original de la tarjeta */
    flex: 0 0 350px;
    /* No se encoge, no crece, y tiene una base de 350px */
    scroll-snap-align: start;
    /* Se alinea al inicio al hacer scroll */
    /* Anulamos el max-width solo en este contexto para que flex-basis funcione */
    max-width: none;
  }

}

@media (min-width: 768px) {
  .formulario-cotizacion {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-buttons {
    grid-column: 1 / -1;
  }
}

/* Ajuste de fuente para el H1 en el móvil más pequeño */
@media (max-width: 767px) {
  .page-title {
    font-size: 2.6em;
  }

  .caracteristicas-grid {
    gap: 15px;
  }

  .caracteristica span {
    font-size: 13px;
  }

  .car-card {
    flex: 0 0 280px;
    /* más angosta para pantallas pequeñas */
    margin-right: 12px;
    border-radius: 18px;
  }

  .car-image {
    width: 220px;
  }

  .car-title {
    font-size: 1.4em;
  }

  .car-subtitle {
    font-size: 0.9em;
  }

  .features-list li {
    margin-bottom: 5px;
    font-size: 13px;
  }

  .open-modal-trigger {
    font-size: 0.9rem;
    padding: 10px;
  }

  .filter-button {
    font-size: 0.7em;
  }

  .filter-option {
    font-size: 0.7em;
  }

}