/* Estilos base y variables */
.pmap-wrap {
  --pmap-radius: 14px;
}
.pmap-title {
  margin: 25px 0;
  font-size: 28px;
  line-height: 1.25;
  color: #163e64;
  font-weight: 800;
}
.pmap-filtros {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin: 12px 0 0;
  width: 100%;
  position: relative;
  isolation: isolate;
  padding: 12px 0;
  justify-content: space-between;
  z-index: 50; /* asegura que los dropdowns estén por encima de las tarjetas */
}

.pmap-filtros::before,
.pmap-filtros::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 100vw;
  height: 1px;
  background: #cfd8e3;
  pointer-events: none;
}
.pmap-filtros::before {
  top: 0;
}
.pmap-filtros::after {
  bottom: 0;
}

/* Buscador */
.pmap-busqueda {
  position: relative;
  flex: 0 0 518px;
  width: 518px;
  max-width: 100%;
}
.pmap-busqueda input {
  width: 100%;
  padding: 12px 14px 12px 40px;
  border: 1px solid #e5edf4;
  border-radius: 24px;
  outline: none;
  background: #e5edf4; /* gris de fondo buscador */
  color: #163e64;
}
.pmap-busqueda input::placeholder {
  color: #163e64;
  opacity: 0.7;
}
.pmap-busqueda input:focus {
  border-color: var(--pmap-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--pmap-accent) 25%, transparent);
}
.pmap-icon-search {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  opacity: 0.55;
  background: no-repeat center/contain
    url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="%23666" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg>');
}

/* Selects estilo pill */
.pmap-select {
  position: relative;
}
.pmap-select select {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid #163e64;
  border-radius: 24px;
  padding: 10px 38px 10px 14px;
  background: #163e64;
  color: #fff;
  min-width: 180px;
}
.pmap-select select option {
  background: #163e64;
  color: #fff;
}
.pmap-busqueda + .pmap-select {
  margin-left: auto;
}
.pmap-select select {
  cursor: pointer;
}
.pmap-select select:focus {
  border-color: var(--pmap-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--pmap-accent) 25%, transparent);
}
.pmap-select::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  rotate: 45deg;
  pointer-events: none;
  opacity: 0.7;
}

/* Botón Reset filtros */
.pmap-reset {
  margin-left: 8px;
  border: 1px solid #163e64;
  background: transparent;
  color: #163e64;
  padding: 10px 16px;
  border-radius: 24px;
  cursor: pointer;
  font: inherit;
  transition: background-color 0.15s ease, border-color 0.15s ease,
    color 0.15s ease;
}
.pmap-reset:hover,
.pmap-reset:focus {
  background: #f56600;
  border-color: #f56600;
  color: #fff;
  outline: none;
}
/* Asegurar ocultación cuando no hay filtros */
.pmap-reset[hidden] {
  display: none !important;
}

/* Ocultar indicador del wrapper cuando el select está mejorado */
.pmap-select.is-enhanced::after {
  display: none;
}

/* Indicador en el botón mejorado (gira al abrir) */
.pmap-dd-button::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  opacity: 0.7;
  pointer-events: none;
  transition: transform 0.18s ease;
}
.pmap-dd.is-open .pmap-dd-button::after {
  transform: translateY(-50%) rotate(-135deg);
}

/* Dropdown personalizado accesible */
.pmap-dd-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.pmap-select .pmap-dd {
  position: relative;
  display: inline-block;
}
.pmap-dd-button {
  border: 1px solid #163e64;
  border-radius: 24px;
  padding: 10px 38px 10px 14px;
  min-width: 180px;
  background: #163e64;
  color: #fff;
  cursor: pointer;
  position: relative; /* para posicionar el indicador */
}
.pmap-dd-button:focus {
  outline: 3px solid
    color-mix(in srgb, var(--pmap-accent, #0ea5e9) 35%, transparent);
  outline-offset: 2px;
  background-color: #f56600;
}

/* Interacción: hover/abierto en naranja */
.pmap-dd-button:hover,
.pmap-dd.is-open .pmap-dd-button {
  background: #f56600;
  border-color: #f56600;
  color: #fff;
}

/* Fallback nativo: hover/focus en naranja */
.pmap-select select:hover,
.pmap-select select:focus {
  background: #f56600;
  border-color: #f56600;
  color: #fff;
}
.pmap-dd-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 250px; /* ancho solicitado */
  /* el scroll vive en .pmap-dd-scroll */
  overflow: visible;
  background: #163e64; /* fondo del dropdown */
  border-radius: 20px; /* radio solicitado */
  box-shadow: 0 12px 28px rgba(15, 46, 79, 0.35);
  padding: 8px 16px 8px 8px; /* más espacio a la derecha para la barra persistente */
  z-index: 100; /* por encima del contenido de tarjetas */
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}
/* Máscaras para ocultar flechas residuales en extremos de la scrollbar (WebKit) */
.pmap-dd-panel::before,
.pmap-dd-panel::after {
  content: "";
  position: absolute;
  right: 8px; /* coincide con padding-right del panel */
  width: 14px; /* ancho aprox. del canal + margen */
  height: 12px; /* sólo tapa el extremo superior/inferior */
  background: #163e64; /* mismo color del panel */
  pointer-events: none;
  z-index: 1;
}
.pmap-dd-panel::before {
  top: 8px;
  border-top-right-radius: 12px;
}
.pmap-dd-panel::after {
  bottom: 8px;
  border-bottom-right-radius: 12px;
}
.pmap-dd.is-open .pmap-dd-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
/* Scrollbar blanca, visible y separada del borde derecho */
/* Contenedor desplazable interno del dropdown */
.pmap-dd-scroll {
  max-height: 304px; /* 320 panel - 16 de padding */
  overflow-y: auto;
  overflow-x: hidden; /* evita esquina y barra horizontal */
  padding: 10px 0; /* separación arriba/abajo para que la barra no toque extremos */
  scrollbar-gutter: stable; /* reservar espacio, evitar overlay */
  position: relative; /* para colocar máscaras internas */
}
.pmap-dd-scroll::-webkit-scrollbar {
  width: 8px;
  background: #163e64; /* color base para evitar piezas visibles */
}
.pmap-dd-scroll::-webkit-scrollbar-track {
  background: #163e64; /* mismo azul del panel */
  margin: 0 3px 0 0; /* sólo separación derecha; sin espacio arriba/abajo */
  border-radius: 6px;
}
.pmap-dd-scroll::-webkit-scrollbar-thumb {
  background: #ffffff; /* pulgar blanco que se mueve */
  border-radius: 6px;
}
/* Máscaras en el contenedor scroll para tapar los extremos del track (WebKit) */
.pmap-dd-scroll::before,
.pmap-dd-scroll::after {
  content: "";
  position: absolute;
  right: 0;
  width: 14px; /* cubre el canal y el margen derecho */
  height: 10px; /* tapa sólo el extremo */
  background: #163e64;
  pointer-events: none;
}
.pmap-dd-scroll::before {
  top: 0;
}
.pmap-dd-scroll::after {
  bottom: 0;
}
/* Asegurar que las piezas del track entre botones usen el mismo color */
.pmap-dd-scroll::-webkit-scrollbar-track-piece {
  background: #163e64;
}
.pmap-dd-scroll::-webkit-scrollbar-track-piece:start {
  background: #163e64;
}
.pmap-dd-scroll::-webkit-scrollbar-track-piece:end {
  background: #163e64;
}
/* Ocultar botones/controles de la scrollbar (arriba/abajo) */
.pmap-dd-scroll::-webkit-scrollbar-button {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  background: #163e64 !important;
  background-image: none !important;
  color: transparent !important;
  border: none !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  opacity: 0 !important;
}
/* Forzar ocultado en vertical/horizontal y en todos los estados */
.pmap-dd-scroll::-webkit-scrollbar-button:vertical,
.pmap-dd-scroll::-webkit-scrollbar-button:horizontal,
.pmap-dd-scroll::-webkit-scrollbar-button:vertical:start:decrement,
.pmap-dd-scroll::-webkit-scrollbar-button:vertical:end:increment,
.pmap-dd-scroll::-webkit-scrollbar-button:horizontal:start:decrement,
.pmap-dd-scroll::-webkit-scrollbar-button:horizontal:end:increment,
.pmap-dd-scroll::-webkit-scrollbar-button:vertical:increment,
.pmap-dd-scroll::-webkit-scrollbar-button:vertical:decrement {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  background: #163e64 !important;
  border: none !important;
  opacity: 0 !important;
}
/* Ocultar todas las variantes conocidas de botones WebKit */
.pmap-dd-scroll::-webkit-scrollbar-button:single-button {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  background: #163e64 !important;
  background-image: none !important;
  color: transparent !important;
  border: none !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  opacity: 0 !important;
}
.pmap-dd-scroll::-webkit-scrollbar-button:start:decrement,
.pmap-dd-scroll::-webkit-scrollbar-button:end:increment,
.pmap-dd-scroll::-webkit-scrollbar-button:vertical:start:decrement,
.pmap-dd-scroll::-webkit-scrollbar-button:vertical:end:increment,
.pmap-dd-scroll::-webkit-scrollbar-button:horizontal:start:decrement,
.pmap-dd-scroll::-webkit-scrollbar-button:horizontal:end:increment,
.pmap-dd-scroll::-webkit-scrollbar-button:decrement,
.pmap-dd-scroll::-webkit-scrollbar-button:increment,
.pmap-dd-scroll::-webkit-scrollbar-button:active,
.pmap-dd-scroll::-webkit-scrollbar-button:hover {
  display: none;
  width: 0;
  height: 0;
  background: transparent;
  border: none;
}
.pmap-dd-scroll::-webkit-scrollbar-button:single-button:start:decrement,
.pmap-dd-scroll::-webkit-scrollbar-button:single-button:end:increment,
.pmap-dd-scroll::-webkit-scrollbar-button:single-button:vertical:start:decrement,
.pmap-dd-scroll::-webkit-scrollbar-button:single-button:vertical:end:increment,
.pmap-dd-scroll::-webkit-scrollbar-button:single-button:horizontal:start:decrement,
.pmap-dd-scroll::-webkit-scrollbar-button:single-button:horizontal:end:increment {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  background: #163e64 !important;
  border: none !important;
  opacity: 0 !important;
}
.pmap-dd-scroll::-webkit-scrollbar-corner {
  background: #163e64;
}
/* Firefox */
.pmap-dd-scroll {
  scrollbar-width: thin;
  scrollbar-color: #ffffff #163e64;
}

.pmap-dd-group-label {
  color: #fff;
  font-weight: 300; /* principal 300 */
  padding: 8px 10px 4px;
  opacity: 0.95;
  cursor: pointer;
}
.pmap-dd-option {
  color: #fff;
  font-weight: 700; /* secundaria 700 */
  padding: 8px 10px;
  border-radius: 10px;
  outline: none;
}
.pmap-dd-option:hover,
.pmap-dd-option:focus {
  background: rgba(255, 255, 255, 0.12);
}
.pmap-dd-option.is-current {
  background: rgba(255, 255, 255, 0.18);
}
.pmap-dd-option.is-child {
  margin-left: 20px;
  cursor: pointer;
}

/* Mapa */
.pmap-mapa {
  width: 100%;
  height: 520px;
  border-radius: 12px;
  overflow: hidden;
}

/* Lista de tarjetas */
.pmap-lista {
  margin-top: 40px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.pmap-card {
  background: #fff;
  overflow: hidden;
}
.pmap-card-link {
  display: block;
  color: inherit;
  text-decoration: none;
}
/* Nueva estructura: enlaces separados para imagen y título */
.pmap-card-title a {
  color: inherit;
  text-decoration: none;
}
.pmap-card-title a:hover,
.pmap-card-title a:focus {
  text-decoration: none;
}
.pmap-card-img a {
  display: block;
  width: 100%;
  height: 100%;
}
.pmap-card-img {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16/10;
  background: #f3f5f8;
  border-radius: 12px;
}
.pmap-card-img img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  filter: grayscale(0%) saturate(100%) opacity(1);
}
.pmap-card-img::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--overlay, #163e64);
  opacity: 1;
  mix-blend-mode: color;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.pmap-card-img:hover::after {
  opacity: 0;
}
.pmap-card.is-title-hover .pmap-card-img::after {
  opacity: 0;
}
.pmap-card-title {
  font-size: 18px !important;
  line-height: 1.25 !important;
  color: #163e64 !important;
  font-weight: 700 !important;
  margin-block-end: 5px;
}
.pmap-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #163e64;
  opacity: 0.9;
}
/* Enlaces en metadatos (actividad/área) */
.pmap-card-meta a {
  color: inherit;
  text-decoration: none;
}
.pmap-meta-area img {
  vertical-align: -2px;
}
.pmap-meta-actividad {
  font-size: 14px;
}
.pmap-meta-area {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
}

/* InfoWindow ajuste */
.gm-style .gm-style-iw-c {
  border-radius: 12px !important;
  padding: 8px !important;
  box-shadow: 0 8px 24px rgba(15, 46, 79, 0.18) !important;
}
.gm-style .gm-style-iw-c .pmap-iw-title {
  /* dar espacio a la derecha para que no toque el botón de cerrar */
  padding-right: 26px; /* ancho aproximado del botón (32px) - padding interno */
}
.gm-style .gm-style-iw-c a {
  color: var(--pmap-accent);
  font-weight: 600;
  text-decoration: none;
}

/* Responsive columns */
@media (max-width: 1024px) {
  .pmap-lista {
    grid-template-columns: repeat(2, 1fr);
  }
  .pmap-busqueda {
    flex: 1 1 100%;
    width: 100%;
    max-width: 100%;
  }
  .pmap-busqueda + .pmap-select {
    margin-left: 0;
  }
}
@media (max-width: 767px) {
  .pmap-title {
    font-size: 22px;
  }
  .pmap-lista {
    grid-template-columns: 1fr;
  }
  .pmap-mapa {
    height: 250px;
  }
  .pmap-mapa.pmap-mapa--oficinas {
    height: 360px;
  }
  .pmap-busqueda {
    flex: 1 1 100%;
    width: 100%;
    max-width: 100%;
  }
  .pmap-filtros .pmap-reset {
    width: 100%;
  }
  /* Dropdown a ancho completo de pantalla con 20px de padding lateral */
  .pmap-dd-panel {
    position: fixed;
    top: var(--pmap-dd-top, 72px);
    width: calc(100vw - 40px);
    left: 50%;
    right: auto;
    padding-left: 20px;
    padding-right: 20px;
    transform: translate(-50%, -6px);
  }
  .pmap-dd.is-open .pmap-dd-panel {
    transform: translate(-50%, 0);
  }
}

/*Cambios en popup de google maps*/
.gm-style-iw-ch {
  padding-top: 8px;
}
button.gm-ui-hover-effect {
  width: 32px !important;
  height: 32px !important; /* antes 0, impedía clicks */
  pointer-events: auto !important;
}
.gm-style .gm-style-iw-c {
  padding: 12px !important;
}
.gm-style {
  font-family: "Lato";
}

/* Mapa de oficinas (shortcode) general sin borde y con 700px de alto */
.pmap-mapa.pmap-mapa--oficinas {
  border-radius: 0 !important;
  height: 700px;
}
/* Variante: mapa de laboratorios (oficinas con tag=laboratorios) con el mismo redondeado que proyectos */
.pmap-mapa.pmap-mapa--oficinas[data-tag="laboratorios"] {
  border-radius: 12px !important;
}

/* Hacer clicable el título, dirección y bloque meta en el loop de oficinas */
#oficinas-accordion .elementor-widget-theme-post-title,
#oficinas-accordion .elementor-element-de4e959,
#oficinas-accordion .elementor-element-35f9a99 {
  cursor: pointer;
}
