@import url('/public/css/fonts.css');

/* Variables de colores */
:root {
  --primary-color: #0d315e;
  --primary-hover: #3b4a6b;
  --secondary-color: #f8f9fa;
  --border-color: #dee2e6;
  --text-color: #333;
  --text-light: #6c757d;
  --success-color: #28a745;
  --error-color: #dc3545;
  --box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  --border-radius: 8px;
  --transition: all 0.3s ease;
}

/* Reset y estilos base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Animaciones */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(10px); }
}

/* Estructura del modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1050;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease-in-out;
  padding: 1rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal.active {
  opacity: 1;
  pointer-events: auto;
  backdrop-filter: blur(5px);
}

/* Contenido del modal */
.modal-content {
  position: relative;
  background: white;
  border-radius: var(--border-radius);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  min-height: 200px; /* Altura mínima para el indicador de carga */
  overflow-y: auto;
  box-shadow: var(--box-shadow);
  animation: fadeIn 0.3s ease-out forwards;
  transform: translateY(-20px);
  opacity: 0;
  transition: var(--transition);
  -webkit-overflow-scrolling: touch;
}

/* Estilos para el indicador de carga y mensajes de error */
.loading-indicator,
.error-message {
  padding: 2rem;
  text-align: center;
  color: #333;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 150px;
}

.loading-indicator {
  font-size: 1.1rem;
  font-weight: 500;
}

.loading-indicator::after {
  content: "...";
  animation: dots 1.5s steps(5, end) infinite;
  display: inline-block;
  width: 20px;
  text-align: left;
}

@keyframes dots {
  0%, 20% { content: "."; }
  40% { content: ".."; }
  60%, 100% { content: "..."; }
}

.error-message {
  color: #721c24;
  background-color: #f8d7da;
  border: 1px solid #f5c6cb;
  border-radius: 4px;
  margin: 1rem;
  padding: 1.5rem;
}

.error-message p {
  margin-bottom: 1rem;
  font-size: 1rem;
}

.error-message button {
  background: var(--primary-color, #0d315e);
  color: white;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 4px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background-color 0.2s;
}

.error-message button:hover {
  background-color: #1a4a8a;
}

/* Mejoras para móviles */
@media (max-width: 768px) {
  .modal {
    padding: 0.5rem;
    align-items: flex-start;
    padding-top: 2rem;
  }
  
  .modal-content {
    max-height: 90vh;
    max-width: 100%;
    margin: 0.5rem;
  }
  
  .loading-indicator,
  .error-message {
    padding: 1.5rem 1rem;
  }
}

.modal.active .modal-content {
  animation: fadeIn 0.3s ease-out forwards;
  transform: translateY(0);
  opacity: 1;
}

/* Botón de cierre */
.modal .close {
  position: absolute;
  right: 1.5rem;
  top: 1rem;
  font-size: 1.8rem;
  color: var(--text-light);
  cursor: pointer;
  background: none;
  border: none;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition);
  z-index: 10;
}

.modal .close:hover {
  color: var(--primary-color);
  background-color: rgba(0, 0, 0, 0.05);
}

/* Encabezado del modal */
.modal-header {
  padding: 1.5rem 2rem 1rem;
  border-bottom: 1px solid var(--border-color);
  position: relative;
}

.modal-header h2 {
  color: var(--primary-color);
  font-size: 1.5rem;
  margin: 0;
  font-weight: 600;
}

/* Cuerpo del formulario */
.modal-body {
  padding: 1.5rem 2rem;
}

/* Grupos de campos */
.form-group {
  margin-bottom: 1.5rem;
  position: relative;
}

/* Etiquetas */
label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-color);
  font-size: 0.95rem;
}

/* Campos de formulario */
input[type="text"],
input[type="tel"],
input[type="email"],
select,
textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 1rem;
  transition: var(--transition);
  background-color: #fff;
  color: var(--text-color);
}

input[type="text"]:focus,
input[type="tel"]:focus,
input[type="email"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.2rem rgba(13, 49, 94, 0.25);
}

/* Estilos para select personalizado */
.select-wrapper {
  position: relative;
}

.select-wrapper::after {
  content: '▼';
  position: absolute;
  top: 50%;
  right: 1rem;
  transform: translateY(-50%);
  color: var(--text-light);
  pointer-events: none;
  font-size: 0.7rem;
}

select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: none;
  padding-right: 2.5rem;
}

/* Estilos para checkboxes personalizados */
.checkbox-group {
  margin-top: 0.5rem;
}

.checkbox-item {
  display: flex;
  align-items: center;
  margin-bottom: 0.75rem;
  cursor: pointer;
}

.checkbox-item input[type="checkbox"] {
  display: none;
}

.checkbox-custom {
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--border-color);
  border-radius: 4px;
  margin-right: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}

.checkbox-item input[type="checkbox"]:checked + .checkbox-custom {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

.checkbox-item input[type="checkbox"]:checked + .checkbox-custom::after {
  content: '✓';
  color: white;
  font-size: 0.8rem;
}

.checkbox-label {
  font-weight: normal;
  color: var(--text-color);
  user-select: none;
}

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.5;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  vertical-align: middle;
  cursor: pointer;
  user-select: none;
  border: 1px solid transparent;
  border-radius: var(--border-radius);
  transition: var(--transition);
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn-secondary {
  background-color: #f8f9fa;
  color: var(--text-color);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: #e9ecef;
}

/* Mapa */
#map {
  width: 100%;
  height: 250px;
  border-radius: var(--border-radius);
  overflow: hidden;
  margin: 1rem 0;
  border: 1px solid var(--border-color);
}

/* Pie del modal */
.modal-footer {
  padding: 1rem 2rem 2rem;
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  border-top: 1px solid var(--border-color);
  background-color: #f8f9fa;
  border-bottom-left-radius: var(--border-radius);
  border-bottom-right-radius: var(--border-radius);
}

/* Mensajes de validación */
.invalid-feedback {
  color: var(--error-color);
  font-size: 0.8rem;
  margin-top: 0.25rem;
  display: none;
}

input:invalid + .invalid-feedback,
select:invalid + .invalid-feedback {
  display: block;
}

/* Transiciones suaves entre pasos */
.step {
  display: none;
  animation: fadeIn 0.3s ease-out;
}

.step.active {
  display: block;
}
  
  /* Cerrar */
  .modal-content .close {
    position: absolute;
    top: 0.5rem;
    right: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
  }
  
  /* Reset dentro */
  .modal-content *, 
  .modal-content *::before, 
  .modal-content *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }
  
  /* Formulario */
  #cotizador {
    width: 100%;
    padding: 1.5rem;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  }
  #cotizador h2 {
    margin-bottom: 1rem;
    color: #0d315e;
  }
  #cotizador label {
    display: block;
    margin-top: 1rem;
    font-weight: bold;
    font-family: 'Ghino', sans-serif;
  }
  
  /* — Solo inputs de texto y selects, NO checkbox — */
  #cotizador input[type="text"],
  #cotizador input[type="tel"],
  #cotizador .field-group {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
  }
  #cotizador .field {
    flex: 1;
    min-width: calc(50% - 1rem);
  }
  #cotizador .multiselect {
    position: relative;
    width: 100%;
    margin-top: 1rem;
}

/* Select element styling */
#cotizador select[name="ciudad"] {
    margin-top: 17px;
}

/* Map container styling */
#cotizador #map {
    height: 300px;
    margin-bottom: 1rem;
} 
  
  /* Agrupar Código de país + Celular lado a lado */
  .modal-content form#cotizador .field-group {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
  }
  .modal-content form#cotizador .field {
    flex: 1;
  }
  
  /* Placeholder */
  .modal-content form#cotizador input[name="nombre"]::placeholder {
    color: #999;
  }
  
  /* Botones */
  .modal-content form#cotizador button {
    margin-top: 1.5rem;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s;
    background: #0d315e;
    color: white;
    width: 100%;
  }
  .modal-content form#cotizador button:hover {
    background: #3b4a6b;
  }
  .modal-content #toStep2,
  .modal-content #backStep1 {
    background: #0d315e;
    margin-right: 0.5rem;
    color: white;
  }
  .modal-content #backStep1 {
    background: #ddd;
    color: #333;
  }
  
  /* Mapa */
  .modal-content #map {
    width: 100%;
    height: 250px;        /* un poco más pequeño */
    margin-top: 1rem;
    border: 1px solid #ccc;
    border-radius: 4px;
  }
  
  /* ——— Multiselect estilo tarjeta ——— */
  .selectBox {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: #F5F9FC;
    border: 1px solid #CFE2F3;
    border-radius: 6px;
    font-weight: 500;
    color: #0d315e;
    cursor: pointer;
    transition: box-shadow 0.2s;
    font-family: 'Ghino', sans-serif;
  }
  .selectBox.open {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  }
  .selectBox::after {
    content: "▾";
    font-size: 0.8rem;
    color: #0d315e;
    font-family: 'Ghino', sans-serif;
  }
  
  /* Contenedor de opciones */
  .checkboxes {
    display: none;
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    width: 100%;
    background: #FFF;
    border: 1px solid #CFE2F3;
    border-top: none;
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 10;
  }
  .checkboxes label {
    display: flex;
    align-items: center;
    padding: 0.6rem 1rem;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #E0EBF5;
  }
  .checkboxes label:last-child {
    border-bottom: none;
  }
  .checkboxes label:hover {
    background: #E8F3FF;
  }
  
  /* — Checkbox “fantasma” estilizado — */
  .checkboxes input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #0d315e;
    border-radius: 4px;
    margin-right: 0.75rem;
    position: relative;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s; 
  }
  /* checked */
  .checkboxes input[type="checkbox"]:checked {
    background-color: #0d315e;
    border-color: #0d315e;
  }
  .checkboxes input[type="checkbox"]:checked::after {
    content: "✔";
    position: absolute;
    top: 1px;
    left: 3px;
    font-size: 12px;
    color: #fff;
  }
  
/* ————————————————————————————————
   Estilos unificados para inputs & selects
   ———————————————————————————————— */
#cotizador input[type="text"],
#cotizador input[type="tel"],
#cotizador select {
  width: 100%;
  padding: 0.75rem 1rem;
  background: #F5F9FC;
  border: 1px solid #CFE2F3;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 500;
  color: #000000;
  box-sizing: border-box;
  appearance: none;         
  -webkit-appearance: none; 
}

/* Ocultar flecha default en IE/Edge */
#cotizador select::-ms-expand {
  display: none;
}

/* ————————————————————————————————
   Estilos para botones
   ———————————————————————————————— */
#cotizador button {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  margin-top: 1.25rem;
  background: #0d315e;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  transition: background 0.2s;
}

#cotizador button:hover {
  background: #3b4a6b;
}

/* ==========================================
   SOLO STYLES RESPONSIVE
   ========================================== */

/* Ultra-HD y grandes pantallas: ≥1920px */
@media screen and (min-width: 1920px) {
  .modal-content {
    max-width: 800px;
  }
  .modal-content #map {
    height: 300px;
  }
}

/* Pantallas grandes y widescreens: 1200px–1919px */
@media screen and (min-width: 1200px) and (max-width: 1919px) {
  .modal-content {
    max-width: 650px;
  }
  .modal-content #map {
    height: 280px;
  }
}

/* Desktop estándar: 1024px–1199px */
@media screen and (min-width: 1024px) and (max-width: 1199px) {
  .modal-content {
    max-width: 550px;
  }
  .modal-content #map {
    height: 250px;
  }
}

/* Tablets landscape y mini-desktops: 800px–1023px */
@media screen and (min-width: 800px) and (max-width: 1023px) {
  .modal-content {
    max-width: 500px;
    margin: 8% auto;
  }
  .modal-content #map {
    height: 220px;
  }
  .modal-content button {
    padding: 0.55rem 1.1rem;
    font-size: 0.95rem;
  }
}

/* Tablets portrait y móviles grandes: 600px–799px */
@media screen and (min-width: 600px) and (max-width: 799px) {
  .modal-content {
    max-width: 450px;
    margin: 6% auto;
  }
  .modal-content form#cotizador {
    padding: 1rem;
  }
  .modal-content #map {
    height: 200px;
  }
  .modal-content button {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }
  .modal-content .field-group {
    flex-direction: column;
  }
}

/* Móviles grandes: 401px–599px */
@media screen and (min-width: 401px) and (max-width: 599px) {
  .modal {
    position: fixed;
    z-index: 1000;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.5);
    overflow: auto;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }
  .modal.active {
    opacity: 1;
    pointer-events: auto;
  }

  .modal-content {
    background: #fff;
    max-width: 420px;
    width: 90%;
    margin: 10% auto;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  }

  .modal-content form#cotizador {
    padding: 0;
    box-shadow: none;
  }
  .modal-content h2 {
    font-size: 1.3rem;
  }
  .modal-content label {
    font-size: 0.95rem;
  }
  .modal-content input,
  .modal-content select {
    padding: 0.45rem;
    font-size: 0.9rem;
  }
  .modal-content #map {
    height: 180px;
  }
  .selectBox {
    padding: 0.6rem;
    font-size: 0.95rem;
    font-family: 'Ghino', sans-serif;
  }
  .checkboxes label {
    padding: 0.5rem;
    font-size: 0.9rem;
    font-family: 'Ghino', sans-serif;
  }
}

/* Móviles pequeños: ≤400px */
@media screen and (max-width: 400px) {
  .modal-content {
    max-width: 90%;
    margin: 4% auto;
    padding: 0.8rem;
  }
  .modal-content h2 {
    font-size: 1.15rem;
  }
  .modal-content label {
    font-size: 0.9rem;
  }
  .modal-content input,
  .modal-content select {
    padding: 0.4rem;
    font-size: 0.85rem;
  }
  .modal-content button {
    width: 15%;
    padding: 0.45rem;
    font-size: 1rem;
    border-radius: 10px;
  }
  .modal-content #map {
    height: 150px;
  }
  .modal-content .field-group {
    flex-direction: column;
    gap: 0.5rem;
  }
  .selectBox {
    padding: 0.5rem;
    font-size: 0.9rem;
    font-family: 'Ghino', sans-serif;
  }
  .checkboxes {
    position: static;
    max-height: 150px;
  }
}

/* Empujar modal al 50% de la altura en móviles ≤600px */
@media screen and (max-width: 600px) {
  .modal-content {
    margin: 10vh auto 1rem;
    transform: translateY(-50px);
  }
}

@media (max-width: 576px) {
  .modal {
    z-index: 2000 !important;
  }
  .modal-content {
    z-index: 2001 !important;
  }
}

