/* =========================
   LAYOUT COTIZADOR
========================= */

.cotizador{
  position: relative;
  max-width: 1200px;        /* ancho máximo del bloque */
  margin: 40px auto 48px;   /* centrado */
  padding: 0 16px 20px;     /* respirito lateral para mobile */
}

.cotizador-map{
  width: 100%;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

/* Panel como POPUP centrado en desktop */
.cotizador-panel{
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -48%);  /* un poquito más abajo del centro */

  width: min(520px, 100% - 40px);
  max-height: 70vh;
  overflow: auto;

  z-index: 9001;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #eee;
  box-shadow: 0 16px 40px rgba(0,0,0,.25);

  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity .18s ease, visibility .18s ease, transform .18s ease;
}

/* cuando esté cerrado, que desaparezca */
.cotizador.is-panel-closed .cotizador-panel{
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  display: none;
}

/* Fondo oscuro cuando el panel está abierto */
.cotizador::before{
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  opacity: 0;
  pointer-events: none;
  z-index: 9000;
  transition: opacity .18s ease;
}

/* Cuando el panel está abierto, muestra el fondo */
.cotizador:not(.is-panel-closed)::before{
  opacity: 1;
  pointer-events: auto;
}

.panel-head{
  padding: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #eee;
}

.panel-head h3{
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.panel-close{
  background: transparent;
  border: 1px solid #D1815B;
  color: #D1815B;
  padding: 6px 14px;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}

.panel-close:hover{
  background: #E99A75;
  color: #fff;
  border-color: #E99A75;
}

.panel-body{
  padding: 14px;
}

/* =========================
   PANEL: KV + SECCIONES
========================= */

.kvs{
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.kv{
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.kv span{ color: #666; }
.kv b{ font-weight: 700; }

.kv.single{
  flex-direction: column;
  align-items: flex-start;
}
.kv.single b{ margin-top: 6px; }

h4{
  margin: 14px 0 8px;
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #666;
}

/* Más espacio antes de "Campos adicionales" */
.panel-body .kvs + h4{
  margin-top: 26px;
  padding-top: 6px;
  border-top: 1px solid rgba(0,0,0,0.06);
}

.imgbox{
  border: 1px solid #eee;
  border-radius: 12px;
  padding: 10px;
}
.imgbox img{
  width: 100%;
  display: block;
  border-radius: 10px;
  background: #fafafa;
}

.fin{
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}
.fin th, .fin td{
  padding: 10px;
  border-bottom: 1px solid #eee;
  text-align: left;
}
.fin thead th{
  background: #f6c3a6;
}

/* =========================
   MAPA: SELECCIÓN / TEXTOS
========================= */

/* Solo borde del lote seleccionado */
.lot-selected{
  stroke: #1db954;
  stroke-width: 4px;
  stroke-opacity: 1;
  fill-opacity: 1;
}

/* Evita que textos/números del SVG reciban click */
#mapWrap svg text{
  pointer-events: none;
}

/* =========================
   HOVER LOTES (incluye Próximamente)
========================= */

svg .lot-hover{
  transition: filter 0.18s ease, opacity 0.18s ease;
}

.lot-status-vendido:hover{ filter: brightness(0.85);}
.lot-status-apartado:hover{ filter: brightness(0.85); }
.lot-status-disponible:hover{ filter: brightness(0.85); }
.lot-status-proximamente:hover{
  filter: brightness(0.85);
}

/* =========================
   ESTADOS DE LOTE
========================= */

.lot-status-vendido{      fill: #F44E4E !important; }
.lot-status-apartado{     fill: #FFC35C !important; }
.lot-status-proximamente{ fill: #B2B2B2 !important; }

/* =========================
   TOOLTIP / BADGE (si lo usas con JS)
========================= */

.lot-badge{
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 999px;
  font-weight: 800;
  letter-spacing: 0.1em;
  border: 2px solid;
  box-shadow: 0 10px 30px rgba(0,0,0,0.18);
  position: fixed;
  pointer-events: none;
  transform: translate(-50%, -130%);
  text-transform: uppercase; 
}

.lot-badge.is-vendido{
  background: rgba(255, 231, 231, .95);
  border-color: rgba(217, 92, 92, .35);
  color: #8a1f1f;
}

.lot-badge.is-apartado{
  background: rgba(255, 246, 222, .95);
  border-color: rgba(241, 194, 107, .55);
  color: #6a3c00;
}

.lot-badge.is-proximamente{
  background: #f3f3f3;
  border-color: #cfc9c2;
  color: #5a554e;
}

/* =========================
   LEYENDA TIPO BANDA
========================= */

.map-legend{
  width: 100%;
  margin-top: 18px;
  display: flex;
  justify-content: center;
}

.map-legend .legend-inner{
  position: relative;

  width: 100%;
  max-width: 1180px;        
  box-sizing: border-box;

  display: flex;
  align-items: center;
  justify-content: space-evenly;
  gap: 24px;
  
  background: rgba(255,255,255,.96);
  border-radius: 18px;
  padding: 18px 28px;

  border: 1px solid rgba(0,0,0,.04);
  box-shadow: 0 6px 14px rgba(0,0,0,.06);
  backdrop-filter: blur(6px);
}

.map-legend-label{
  position: absolute;
  top: -12px;
  left: 24px;

  padding: 3px 10px;
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;

  background: #fff7e9;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.06);
  color: #7b5a36;
}


/* Cada item */
.legend-item{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  white-space: nowrap;   /* desktop: no se parte el texto */
}

/* Desktop: el último igual que los demás */
.map-legend .legend-inner .legend-item:last-child{
  grid-column: auto;
  justify-self: auto;
}

/* Ajustes en pantallas muy pequeñas */
@media (max-width: 430px){
  .map-legend .legend-inner{
    padding: 14px 12px;
    gap: 8px 10px;
  }

  .legend-item{
    font-size: 13px;
  }
}

.legend-badge{
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  border: 2px solid #d6a44a;
  background: #f1c26b;
  color: #4b1f1f;
  flex-shrink: 0;
}

.legend-text{
  font-size: 15px;
  font-weight: 700;
  color: #4b1f1f;
}

/* =========================
   FORM COTIZACIÓN
========================= */

.quote-form{
  margin-top: 12px;
  padding: 14px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #eee;
  font-family: Inter, system-ui, sans-serif;
}

.quote-row{
  display: grid;
  grid-template-columns: 1fr 1fr;   /* desktop: 2 columnas */
  gap: 10px;
}

.quote-field{
  display: flex;
  flex-direction: column;
  margin-bottom: 10px;
}

.quote-field label{
  font-size: 12px;
  font-weight: 500;
  color: #7a7a7a;
  margin-bottom: 4px;
}

.quote-field input{
  height: 38px;
  padding: 0 10px;
  font-size: 14px;
  border-radius: 8px;
  border: 1px solid #ddd;
  background: #fafafa;
  transition: border-color .2s ease, box-shadow .2s ease;
}

.quote-field input:focus{
  outline: none;
  border-color: #b87b5a;
  box-shadow: 0 0 0 2px rgba(184, 123, 90, .15);
  background: #fff;
}

.quote-btn{
  width: 100%;
  margin-top: 8px;
  height: 42px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #b87b5a, #8c4b33);
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}

.quote-btn:hover{
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(0,0,0,.15);
  opacity: .95;
}

.quote-btn:active{
  transform: translateY(0);
  box-shadow: 0 3px 8px rgba(0,0,0,.12);
}

.quote-btn[disabled]{
  opacity: .75;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* =========================
   TOAST (éxito/error)
========================= */

.toast{
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 99999;
  max-width: 420px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff3f0;
  border: 1px solid #e79a86;
  color: #7a2d20;
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
  font-size: 13px;
  font-weight: 600;
}

.toast.ok{
  background: #effaf3;
  border-color: #7cc59a;
  color: #1c5b34;
}

/* =========================
   MENSAJES DE FORM / ERRORES
========================= */

.messages{margin:8px 0 14px;display:grid;gap:10px}
.msg{padding:12px 14px;border-radius:10px;font-size:14px;line-height:1.35}
.msg.success{background:#e9f6ee;color:#1f5d2e;border:1px solid #b8e1c3}
.msg.error{background:#fdecea;color:#7b241c;border:1px solid #f5c6c1}
.msg.info{background:#fff7e6;color:#6c4a0b;border:1px solid #f1d6a8}

.is-invalid{
  border-color:#d07653 !important;
  box-shadow:0 0 0 3px rgba(198,40,40,.12);
  outline:none;
}

/* =========================
   MAP WRAP / FONDO
========================= */

.map-wrap{
  position: relative;

  background-image: url("/static/resources/images/cotizador/Pasto_MapaValladolid.jpeg");
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;
  background-color: #fffaf2;

  width: 100%;
  height: min(80vh, 500px);
  min-height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.map-wrap svg{
  width: 100%;
  height: 100%;
}

/* Cuando el popup está abierto, bloquea el scroll del body */
body.modal-open{
  overflow: hidden;
}

/* =========================
   RESPONSIVE: TABLET / MOBILE
========================= */

/* Tablet y pantallas medianas */
@media (max-width: 1024px){
  .cotizador{
    margin: 28px auto 36px;
    padding: 0 12px 18px;
  }

  .map-wrap{
    height: 60vh;
    min-height: 320px;
  }

  .map-legend{
    margin-top: 14px;
  }

  .map-legend .legend-inner{
    max-width: 100%;
    padding: 16px 20px;
    gap: 18px;
    flex-wrap: wrap;
    justify-content: center;
  }

  .map-legend .legend-inner::before{
    left: 20px;
  }

  /* Panel como hoja desde abajo, ocupa todo el ancho */
  .cotizador-panel{
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    margin: 0;
    width: 100%;
    max-height: 80vh;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -10px 30px rgba(0,0,0,.25);
    transform: translate(0,0); /* ya no centrado */
  }

  .panel-head h3{
    font-size: 15px;
  }

  .panel-body{
    max-height: calc(80vh - 60px); /* resto para cabecera */
    overflow-y: auto;
  }

  /* Form en 1 columna en tablet más angosta */
  .quote-row{
    grid-template-columns: 1fr;
  }
}

/* Móviles <= 768px */
@media (max-width: 768px){
  .cotizador{
    margin: 24px auto 32px;
    padding: 0 10px 16px;
  }

  .map-wrap{
    height: 55vh;
    min-height: 260px;
  }

  

  .legend-item{
    font-size: 13px;
    white-space: normal;  /* que ya se pueda partir */
  }

  

  .quote-form{
    padding: 12px 10px 14px;
  }

  .toast{
    top: 12px;
    right: 12px;
    max-width: 90%;
    font-size: 12px;
  }
}

/* Móviles muy pequeños */
@media (max-width: 480px){
  .panel-head{
    padding: 10px 12px;
  }

  .panel-head h3{
    font-size: 14px;
  }

  .panel-body{
    padding: 10px 12px 12px;
  }

  .kv{
    flex-direction: column;
    align-items: flex-start;
  }

  .map-legend .legend-inner::before{
    left: 16px;
    font-size: 10px;
  }

  .quote-btn{
    height: 40px;
    font-size: 13px;
  }
}



/* ===== Estados de lote en la leyenda ===== */



.legend-color{
  width: 16px;
  height: 16px;
  border-radius: 6px;
  border: 1px solid rgba(0,0,0,.15);
  display: inline-block;
}

/* Tus colores */
.legend-color.sold{      background:#F44E4E; }
.legend-color.hold{      background:#FFC35C; }
.legend-color.available{ background:#AEDA95; }
.legend-color.soon{      background:#B2B2B2; }


.map-legend{
  width: 100%;
  margin-top: 12px;
  display: flex;
  flex-direction: column;       /* 👈 apila bandas */
  align-items: center;
  gap: 8px;                     /* espacio entre banda 1 y 2 */
}



/* ===== Overrides leyenda A–G + estados (desktop / tablet / mobile) ===== */

/* Mobile + tablet: estilo de la segunda banda (estados) */
@media (max-width: 1024px){
  .map-legend .legend-inner-states{
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px 24px;

    width: 100%;
    max-width: 1180px;
    box-sizing: border-box;

    background: rgba(255,255,255,.96);
    border-radius: 18px;
    padding: 10px 20px;

    border: 1px solid rgba(0,0,0,.04);
    box-shadow: 0 6px 14px rgba(0,0,0,.06);
    backdrop-filter: blur(6px);
  }
}

/* Desktop: ocultar completamente la banda de estados */
@media (min-width: 1025px){
  .map-legend .legend-inner-states{
    display: none !important;
  }
}

/* Tablet (768–1024): G alineada con el resto (sin centrado raro) */
@media (min-width: 768px) and (max-width: 1024px){
  .map-legend .legend-inner-main{
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 18px 30px;
  }

  .map-legend .legend-inner-main .legend-item:last-child{
    grid-column: auto;
    justify-self: flex-start;
  }
}

/* Mobile (<768): más espacio vertical entre items y estados */
@media (max-width: 767px){
  /* banda A–G en grid, con un poco más de aire vertical */
  .map-legend .legend-inner-main{
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 20px;
    justify-items: start;
  }

  .map-legend .legend-inner-main .legend-item{
    margin-bottom: 2px;
  }

  /* más espacio entre Sold / Reserved / Available / Coming soon */
  .map-legend .legend-inner-states{
    gap: 12px 28px;
  }
}



@media (max-width: 767px){
  /* Segunda banda (estados) en 2 columnas */
  .map-legend .legend-inner-states{
    display: grid;                         /* en vez de flex */
    grid-template-columns: repeat(2, 1fr); /* 👈 2 columnas */
    gap: 10px 24px;
    justify-items: start;
  }
}



/* En mobile / tablet permitimos los gestos (pinch-zoom con los dedos) */
@media (max-width: 1024px){
  .cotizador-map svg{
    touch-action: auto;   /* deja que el navegador maneje el pinch */
  }
}



