/* Geolocalización Movistar -> Personal.
   Alcance: selector del header, aviso de ubicación, modales y banner de fusión.
   Las imágenes van con ruta relativa al CSS: sirve igual en /assets y en
   /empresas/assets sin tocar nada. */

html {
  scrollbar-gutter: stable;
}

/* Bootstrap compensa el scrollbar con padding-right al abrir el modal.
   Eso corre la maqueta; reservamos el gutter y anulamos el padding. */
body.modal-open {
  padding-right: 0 !important;
}

body.modal-open header#navigation {
  padding-left: 0 !important;
  padding-right: 0 !important;
}

:root {
  --geo-blue: #0066ff;
  --geo-text: #1f1f1f;
  --geo-muted: #6b6c6f;
  --geo-border: #6b6c6f;
  --geo-soft-border: #e5e7eb;
  --geo-bg-soft: #f5f7fa;
  --geo-cyan: #00c8f0;
  --geo-error: #c10000;
  --geo-error-border: #e57373;
  /* Distancia al borde derecho del header. geo.js la ajusta al ancho real
     del botón de login de cada sitio (Individuos / Empresas). */
  --geo-top-right: 24px;
}

/* Mientras el sitio no esté en modo geo, nada de esto se ve. El modo se
   activa en el build (site.geo.enabled) o con ?geo=1 para la preview. */
html:not(.geo-on) #geo-top,
html:not(.geo-on) #geo-banner,
html:not(.geo-on) .promo-banner,
html:not(.geo-on) .geo-modal,
html:not(.geo-on) .geo-personal-modal {
  display: none !important;
}

header#navigation .pnt-pre-navbar {
  position: relative;
}

#geo-top {
  position: absolute;
  top: 0;
  right: var(--geo-top-right, 24px);
  z-index: 1035;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 44px;
  padding: 0 8px;
  color: #fff;
  font-family: "Roboto", Arial, sans-serif;
  font-size: 14px;
  line-height: 24px;
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.18s ease;
}

#geo-top:hover,
#geo-top:focus-visible {
  background-color: rgba(255, 255, 255, 0.12);
  outline: none;
}

#geo-top:focus-visible {
  box-shadow: 0 0 0 2px #fff;
}

#geo-top .geo-top-pin {
  width: 16px;
  height: 16px;
  display: block;
}

#geo-top .geo-top-label {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#geo-top .geo-top-caret {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  display: block;
}

.geo-banner {
  position: fixed;
  top: 45px;
  right: 16px;
  z-index: 1035;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  width: 500px;
  max-width: calc(100vw - 28px);
  padding: 16px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 18px rgba(11, 39, 57, 0.18);
  color: var(--geo-text);
  font-family: "Roboto", Arial, sans-serif;
}

.geo-banner.geo-hidden {
  display: none;
}

/* Ubicación asignada: sin ícono de alerta y con ancho al contenido. */
.geo-banner--assigned {
  width: auto;
  min-width: 320px;
}

/* Punta del aviso, espejada, alineada con el desplegable de ubicación. */
.geo-banner::before {
  content: "";
  position: absolute;
  top: -10px;
  right: var(--geo-banner-caret-right, 24px);
  width: 16px;
  height: 16px;
  background: url("../images/geo/geo-triangle.svg") center / contain no-repeat;
  transform: rotate(180deg);
  pointer-events: none;
}

.geo-banner-icon {
  flex: 0 0 auto;
  width: 28px;
  height: 40px;
  object-fit: contain;
  margin-top: 1px;
}

.geo-banner-icon--warning {
  width: 40px;
  height: 40px;
}

.geo-banner-copy {
  min-width: 0;
  padding-top: 1px;
  padding-right: 24px;
}

.geo-banner-text {
  margin: 0 0 6px;
  font-size: 16px;
  line-height: 22px;
  font-weight: 400;
  color: var(--geo-text);
}

.geo-banner-link {
  display: inline;
  padding: 0;
  color: var(--geo-blue);
  font: inherit;
  font-weight: 500;
  text-decoration: underline;
  background: none;
  border: 0;
  cursor: pointer;
}

.geo-banner-link:hover,
.geo-banner-link:focus-visible {
  color: #004ecc;
}

.geo-banner-close {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  color: #333;
  font-size: 20px;
  line-height: 1;
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

.geo-banner-close:hover,
.geo-banner-close:focus-visible {
  background: rgba(0, 0, 0, 0.05);
  outline: none;
}

.geo-banner-close-icon {
  width: 14px;
  height: 14px;
  display: block;
}

@media (min-width: 769px) {
  .geo-banner {
    gap: 16px;
  }

  .geo-banner-close {
    top: 4px;
    right: 4px;
  }
}

/* Banner de fusión Movistar y Personal. */
.promo-banner {
  position: relative;
  display: flex;
  align-items: center;
  width: calc(100% - 32px);
  max-width: 1140px;
  height: 96px;
  margin: 16px auto 0;
  overflow: hidden;
  background-color: #01C7E2;
  background-image:
    linear-gradient(to right, #01C7E2 0%, #01C7E2 56%, rgba(1, 199, 226, 0) 78%),
    url("../images/geo/banner-desktop.jpg");
  background-repeat: no-repeat, no-repeat;
  background-position: left top, right center;
  background-size: 100% 100%, auto 100%;
  border: 1px solid #005EEB;
  border-radius: 8px;
  text-decoration: none;
}

.promo-banner:focus-visible {
  outline: 3px solid var(--geo-blue);
  outline-offset: 2px;
}

.promo-banner-copy {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 16px;
  padding-left: 84px;
}

.promo-banner-text {
  color: #FFF;
  font-family: "Movistar Sans", "Telefonica", Arial, sans-serif;
  font-size: 45px;
  font-style: normal;
  font-weight: 500;
  line-height: normal;
  white-space: nowrap;
}

.promo-banner-logo {
  display: block;
  width: 279px;
  max-width: 279px;
  height: auto;
}

/* Modal base */
.modal.geo-modal,
.modal.geo-personal-modal {
  width: 100% !important;
  padding: 0 !important;
  background: transparent !important;
  text-align: left;
  overflow-x: hidden;
  overflow-y: auto;
  z-index: 1100;
}

.geo-modal .modal-dialog,
.geo-personal-modal .modal-dialog {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 680px;
  min-height: calc(100vh - 32px);
  margin: 16px auto;
}

.geo-personal-modal .modal-dialog {
  max-width: 688px;
}

.geo-modal .modal-content,
.geo-personal-modal .modal-content {
  width: 100%;
}

.geo-modal .modal-content {
  border: 0;
  border-radius: 8px;
  box-shadow: 0 12px 36px rgba(11, 39, 57, 0.24);
  overflow: visible;
}

.geo-modal .modal-backdrop,
.modal-backdrop.show {
  opacity: 0.5;
}

.geo-manual-backdrop {
  z-index: 1095;
}

.geo-modal-body {
  position: relative;
  padding: 36px 24px 28px;
  font-family: "Roboto", Arial, sans-serif;
  color: var(--geo-text);
}

.geo-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

.geo-modal-close:hover,
.geo-modal-close:focus-visible {
  opacity: 0.72;
  outline: none;
}

.geo-modal-close-icon {
  width: 28px;
  height: 28px;
  display: block;
}

.geo-modal-icon {
  display: block;
  width: 38px;
  height: 54px;
  margin: 16px auto 24px;
}

.geo-modal-title {
  max-width: 490px;
  margin: 0 auto 25px;
  color: var(--geo-text);
  font-size: 28px;
  line-height: 36px;
  font-weight: 400;
  text-align: center;
  letter-spacing: -0.01em;
}

.geo-field {
  position: relative;
  max-width: 490px;
  margin: 0 auto;
}

.geo-field-input {
  display: block;
  width: 100%;
  height: 60px;
  padding: 22px 16px 8px;
  color: var(--geo-text);
  font-family: inherit;
  font-size: 18px;
  line-height: 24px;
  background: #fff;
  border: 1px solid var(--geo-border);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.geo-field-input:focus {
  border-color: var(--geo-blue);
  box-shadow: 0 0 0 1px var(--geo-blue);
}

.geo-field.has-error .geo-field-input,
.geo-field.has-error .geo-field-input:focus {
  padding-right: 44px;
  border-color: var(--geo-error-border);
  box-shadow: 0 0 0 1px var(--geo-error-border);
}

.geo-field-error-icon {
  position: absolute;
  top: 30px;
  right: 16px;
  display: none;
  width: 24px;
  height: 24px;
  margin-top: -12px;
  object-fit: contain;
  pointer-events: none;
}

.geo-field.has-error .geo-field-error-icon {
  display: block;
}

/* Spinner de búsqueda: mismo slot que el ícono de error */
.geo-field.is-loading .geo-field-input,
.geo-field.is-loading .geo-field-input:focus {
  padding-right: 44px;
}

.geo-field-spinner {
  position: absolute;
  top: 30px;
  right: 16px;
  display: none;
  width: 24px;
  height: 24px;
  margin-top: -12px;
  pointer-events: none;
  animation: geo-spin 0.9s linear infinite;
}

.geo-field.is-loading .geo-field-spinner {
  display: block;
}

.geo-field.is-loading .geo-field-error-icon {
  display: none;
}

@keyframes geo-spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.geo-field-error {
  margin: 8px 0 0;
  padding-left: 2px;
  color: var(--geo-error);
  font-family: "Roboto", Arial, sans-serif;
  font-size: 12px;
  line-height: 16px;
  font-weight: 400;
}

.geo-field-error[hidden] {
  display: none;
}

.geo-field-label {
  position: absolute;
  top: 19px;
  left: 16px;
  color: var(--geo-muted);
  font-family: inherit;
  font-size: 16px;
  line-height: 20px;
  pointer-events: none;
  transition: top 0.14s ease, font-size 0.14s ease;
}

.geo-field-input:focus~.geo-field-label,
.geo-field-input.has-value~.geo-field-label {
  top: 8px;
  font-size: 14px;
  line-height: 16px;
}

.geo-suggestions {
  position: absolute;
  top: calc(100% + 1px);
  left: 0;
  right: 0;
  z-index: 20;
  display: none;
  max-height: 240px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
  background: #fff;
  border: 1px solid var(--geo-soft-border);
  border-top: 0;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 12px 24px rgba(11, 39, 57, 0.14);
}

.geo-suggestions.is-open {
  display: block;
}

.geo-suggestion {
  padding: 16px 20px;
  color: var(--geo-text);
  font-size: 16px;
  line-height: 22px;
  cursor: pointer;
  border-bottom: 1px solid var(--geo-soft-border);
}

.geo-suggestion:last-child {
  border-bottom: 0;
}

.geo-suggestion:hover,
.geo-suggestion.is-active {
  background: var(--geo-bg-soft);
}

.geo-suggestion-error {
  padding: 18px 20px 22px;
  color: var(--geo-error);
  font-family: "Roboto", Arial, sans-serif;
  font-size: 14px;
  line-height: 20px;
  font-weight: 400;
}

@media (min-width: 769px) {
  .geo-field-error {
    font-size: 14px;
    line-height: 20px;
  }

  .geo-suggestion-error {
    font-size: 16px;
    line-height: 22px;
  }
}

.geo-confirm {
  display: block;
  width: 136px;
  height: 48px;
  margin: 30px auto 0;
  padding: 0 20px;
  color: #fff;
  font-family: inherit;
  font-size: 18px;
  line-height: 24px;
  font-weight: 500;
  letter-spacing: normal;
  background: var(--geo-blue);
  border: 0;
  border-radius: 24px;
  cursor: pointer;
  transition: background-color 0.16s ease, opacity 0.16s ease;
}

.geo-confirm:hover:not(:disabled),
.geo-confirm:focus-visible:not(:disabled) {
  background: #0052cc;
  outline: none;
}

.geo-confirm:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Modal Personal */
.geo-personal-modal .modal-content {
  border: 0;
  border-radius: 16px;
  box-shadow: 0 12px 36px rgba(11, 39, 57, 0.24);
  overflow: hidden;
}

.geo-personal-hero {
  display: block;
  margin: 0;
  background: #01C7E2;
  color: #fff;
}

.geo-personal-hero-img {
  display: block;
  width: 100%;
  height: auto;
}

.geo-personal-body {
  padding: 28px 24px 24px;
  color: var(--geo-text);
  font-family: "Roboto", Arial, sans-serif;
  text-align: center;
}

.geo-personal-title {
  max-width: 490px;
  margin: 0 auto 20px;
  color: #262423;
  font-family: "Telefonica", Arial, sans-serif;
  font-size: 28px;
  line-height: 32px;
  font-style: normal;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.geo-personal-text {
  max-width: 490px;
  margin: 0 auto;
  color: #605E5C;
  font-family: "Roboto", Arial, sans-serif;
  font-size: 18px;
  line-height: 24px;
  font-style: normal;
  font-weight: 400;
}

.geo-personal-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-width: 194px;
  height: 48px;
  margin: 24px auto 0;
  padding: 0 24px;
  color: #fff;
  font-family: inherit;
  font-size: 18px;
  line-height: 24px;
  font-weight: 500;
  text-decoration: none;
  background: #0066FF;
  border: 0;
  border-radius: 28px;
  cursor: pointer;
}

.geo-personal-cta:hover,
.geo-personal-cta:focus-visible {
  color: #fff;
  text-decoration: none;
  background: #0052cc;
  outline: none;
}

.geo-personal-continue {
  display: block;
  width: fit-content;
  margin: 18px auto 0;
  padding: 0;
  color: #0066FF;
  font-family: "Roboto", Arial, sans-serif;
  font-size: 18px;
  line-height: 24px;
  font-style: normal;
  font-weight: 500;
  text-decoration: underline;
  background: none;
  border: 0;
  cursor: pointer;
}

.geo-personal-continue:hover,
.geo-personal-continue:focus-visible {
  color: #004ecc;
}

.geo-personal-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 24px;
}

.geo-personal-actions .geo-personal-cta,
.geo-personal-actions .geo-personal-continue {
  margin: 0;
}

@media (min-width: 769px) and (max-width: 1359px) {
  :root {
    --geo-top-right: 148px;
  }
}

@media (max-width: 991px) {
  .geo-banner {
    right: 14px;
    width: 420px;
  }
}

/* Desktop: el copy del banner arranca a 38px del borde izquierdo. */
@media (min-width: 769px) {
  .promo-banner {
    padding-left: 38px;
  }

  .promo-banner-copy {
    padding-left: 0;
  }
}

/* Desktop angosto: el copy completo no entra a 45px + 279px de logo */
@media (min-width: 769px) and (max-width: 1024px) {
  .promo-banner-copy {
    gap: 12px;
  }

  .promo-banner-text {
    font-size: 36px;
  }

  .promo-banner-logo {
    width: 220px;
    max-width: 220px;
  }
}

@media (max-width: 768px) {

  /* En mobile el selector de ubicación baja a una fila propia,
     debajo del header principal, alineado a la izquierda. */
  #geo-top {
    top: 125px;
    right: 0;
    left: 0;
    width: 100%;
    max-width: none;
    height: 32px;
    padding: 0 16px;
    justify-content: flex-start;
    gap: 8px;
    color: var(--geo-text);
    background: #f6f6f6;
    border-bottom: 1px solid var(--geo-soft-border);
    border-radius: 0;
  }

  #geo-top:hover,
  #geo-top:focus-visible {
    background: var(--geo-bg-soft);
  }

  #geo-top:focus-visible {
    box-shadow: inset 0 0 0 2px var(--geo-blue);
  }

  #geo-top .geo-top-pin,
  #geo-top .geo-top-caret {
    filter: brightness(0) saturate(100%);
  }

  #geo-top .geo-top-label {
    max-width: calc(100vw - 80px);
  }

  .geo-banner {
    top: 157px;
    right: 8px;
    left: 8px;
    width: auto;
    max-width: none;
    min-height: 0;
    margin-top: 5px;
    padding: 16px;
  }

  /* El ancho lo fijan left/right; el mínimo de desktop desbordaría a 320px. */
  .geo-banner--assigned {
    min-width: 0;
  }

  .geo-banner-text {
    font-size: 16px;
    line-height: 22px;
  }

  .geo-banner-link {
    font-size: 14px;
    line-height: 20px;
  }

  .promo-banner {
    height: 102px;
    max-width: calc(100vw - 32px);
    background-image: url("../images/geo/banner-mobile.jpg");
    background-position: right center;
    background-size: cover;
  }

  .promo-banner-copy {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 0;
    width: 100%;
    box-sizing: border-box;
    padding: 4px 16px;
  }

  .promo-banner-text {
    font-size: 22px;
    line-height: 24px;
    /* sobre las escalinatas claras de la foto, el blanco pierde contraste */
    text-shadow: 0 1px 2px rgba(0, 60, 120, 0.35);
  }

  .promo-banner-copy .promo-banner-text:last-child {
    margin-left: 142px;
    line-height: 10px;
  }

  .promo-banner-logo {
    width: 212px;
    max-width: 212px;
  }

  .modal.geo-modal,
  .modal.geo-personal-modal {
    padding: 0 14px !important;
  }

  .geo-modal .modal-dialog,
  .geo-personal-modal .modal-dialog {
    min-height: calc(100vh - 28px);
    margin: 14px auto;
  }

  .geo-modal-body {
    padding: 24px;
  }

  .geo-modal-title {
    font-size: 18px;
    line-height: 24px;
  }

  .geo-modal-icon {
    margin: 26px auto 24px;
  }

  .geo-field-input {
    height: 56px;
    font-size: 16px;
    line-height: 24px;
  }

  .geo-field-input:focus~.geo-field-label,
  .geo-field-input.has-value~.geo-field-label {
    font-size: 12px;
    line-height: 16px;
  }

  .geo-confirm {
    width: 100%;
    margin: 24px auto 0;
    font-size: 16px;
  }

  .geo-personal-title {
    font-family: "Roboto", Arial, sans-serif;
    font-size: 18px;
    line-height: 24px;
  }

  .geo-personal-text {
    font-size: 16px;
    line-height: 24px;
  }

  .geo-personal-continue {
    font-size: 14px;
    line-height: 20px;
  }

  .geo-personal-cta {
    font-size: 16px;
    line-height: 24px;
  }

  /* En mobile el CTA va arriba y "Continuar en esta página" abajo */
  .geo-personal-actions {
    flex-direction: column-reverse;
    align-items: center;
  }

  /* #geo-top es una fila más del header fijo (32px + 1px de borde debajo
     del header de 125px). Reservamos ese alto para que la fila gris no
     tape el buscador ni el título "consulta y soporte...". */
  html.geo-on .bc-home {
    margin-top: 33px;
  }

  /* En internas el contenido ya arranca debajo del header; si el aviso
     está visible, le damos aire para que no lo tape. */
  html.geo-on .bc-category,
  html.geo-on .bc-single {
    padding-top: 33px;
  }
}

/* Banner de fusión en categoría y pregunta: va después del contenido, a
   todo el ancho de la página, igual que en la home. */
.bc-category .promo-banner,
.bc-single .promo-banner {
  margin-bottom: 40px;
}

/* Debajo de 360px el banner promocional va a sangre, pegado al bloque
   de arriba, sin bordes ni esquinas redondeadas. */
@media (max-width: 359px) {
  .promo-banner {
    width: 100%;
    max-width: none;
    margin: 0;
    border: 0;
    border-radius: 0;
  }
}
