/* =====================================================
   FIBERPRADO - PAGINA DE COBERTURA
   No modifica styles.css principal
===================================================== */

:root {
    --cov-blue: #082fd0;
    --cov-orange: #ff4b0b;
    --cov-white: #ffffff;
    --cov-text: #102b78;
    --cov-gray: #666666;
}

/* BASE */
.coverage-main {
    width: 100%;
    background: #fff;
    overflow: hidden;
    padding-bottom: 35px;
}
.coverage-main * { box-sizing: border-box; }

/* TITULO */
.coverage-heading {
    width: 100%;
    text-align: center;
    padding: 38px 15px 0;
}
.coverage-heading h1 {
    margin: 0;
    color: var(--cov-orange);
    font-size: 36px;
    font-weight: 800;
    line-height: 1.2;
}
.coverage-heading p {
    margin-top: 19px;
    color: var(--cov-blue);
    font-size: 22px;
    font-style: italic;
    font-weight: 500;
}
.coverage-heading p strong { font-weight: 900; }

/* DISTRITOS */
.coverage-zones {
    width: min(1400px, calc(100% - 60px));
    margin: 73px auto 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 28px;
    align-items: start;
}
.zone-column { min-width: 0; }
.zone-column h2 {
    width: 100%;
    min-height: 55px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 0 20px;
    padding: 10px;
    border-radius: 40px;
    background: var(--cov-blue);
    color: white;
    font-size: 21px;
    font-weight: 800;
    text-align: center;
}

/* LISTAS NORMALES */
.district-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* LISTAS LARGAS: DOS COLUMNAS */
.district-list--two {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    column-gap: 12px;
    row-gap: 15px;
}

.district-pill {
    width: 100%;
    min-width: 0;
    min-height: 43px;
    display: grid;
    grid-template-columns: 23px minmax(0, 1fr);
    align-items: center;
    gap: 5px;
    padding: 6px 8px;
    background: white;
    border: none;
    border-radius: 0 0 18px 18px;
    box-shadow: 0 2px 2px rgba(0, 0, 0, .23);
    color: var(--cov-blue);
    font-family: inherit;
    font-size: 15px;
    font-weight: 800;
    line-height: 1.1;
    text-align: center;
    cursor: pointer;
    transition: .2s ease;
}
.district-pill:hover {
    color: var(--cov-orange);
    transform: translateY(-2px);
}
.district-pill.is-selected {
    color: var(--cov-orange);
    box-shadow: 0 0 0 2px rgba(255, 75, 11, .2);
}
.pin-icon {
    width: 18px;
    height: 22px;
    position: relative;
    display: block;
    justify-self: center;
    color: var(--cov-orange);
    font-size: 0;
}
.pin-icon::before {
    content: "";
    position: absolute;
    width: 12px;
    height: 12px;
    top: 2px;
    left: 2px;
    border: 2px solid currentColor;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
}
.pin-icon::after {
    content: "";
    position: absolute;
    width: 4px;
    height: 4px;
    top: 7px;
    left: 6px;
    border: 1.5px solid currentColor;
    border-radius: 50%;
}

/* MAPA Y TEXTO */
.coverage-map-section {
    width: min(1120px, calc(100% - 40px));
    min-height: 540px;
    margin: 35px auto 0;
    display: grid;
    grid-template-columns: .78fr 1.22fr;
    align-items: center;
    gap: 25px;
}
.coverage-map-copy {
    position: relative;
    z-index: 2;
    padding: 25px 0;
}
.map-kicker {
    margin-bottom: 10px;
    color: var(--cov-orange);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 1.5px;
}
.coverage-map-copy h2 {
    margin: 0;
    color: var(--cov-blue);
    font-size: 30px;
    font-weight: 500;
    line-height: 1.12;
}
.coverage-map-copy h2 strong { font-weight: 900; }
.map-description {
    max-width: 380px;
    margin-top: 18px;
    color: #555;
    font-size: 14px;
    line-height: 1.6;
}
.selected-district {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin: 20px 0;
}
.selected-label {
    color: #888;
    font-size: 12px;
    font-weight: 700;
}
.selected-district strong {
    color: var(--cov-blue);
    font-size: 20px;
}
.coverage-whatsapp {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 45px;
    padding: 12px 20px;
    border-radius: 30px;
    background: var(--cov-blue);
    color: white;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}
.coverage-whatsapp:hover { background: var(--cov-orange); }
.coverage-note {
    display: block;
    max-width: 350px;
    margin-top: 14px;
    color: #777;
    font-size: 11px;
    line-height: 1.5;
}

/* MAPA */
.coverage-map-visual {
    position: relative;
    min-height: 540px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.map-circle {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    pointer-events: none;
}
.map-circle-outer {
    width: min(100%, 610px);
    aspect-ratio: 1;
    background: rgba(8, 47, 208, .055);
}
.map-circle-inner {
    width: min(78%, 475px);
    aspect-ratio: 1;
    background: rgba(8, 47, 208, .075);
}
#coverageMap {
    position: relative;
    z-index: 1;
    width: min(92%, 560px);
    height: 510px;
    border-radius: 50%;
    overflow: hidden;
    background: #e8ebf3;
}
.map-caption {
    position: absolute;
    z-index: 2;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: 90%;
    padding: 5px 10px;
    border-radius: 20px;
    background: rgba(255,255,255,.9);
    color: #666;
    font-size: 10px;
}

/* HEADER Y FOOTER */
.site-header .links a.coverage-active { color: var(--cov-orange); }
.site-header .links a.coverage-active::after {
    width: 100%;
    background: var(--cov-orange);
}
.coverage-main + .site-footer { margin-top: 0; }

/* TABLET */
@media(max-width: 1100px) {
    .coverage-zones {
        width: min(900px, calc(100% - 40px));
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 32px 25px;
    }
    .district-pill { font-size: 15px; }
    .coverage-map-section { margin-top: 45px; }
}

/* PANTALLAS MEDIANAS */
@media(max-width: 980px) {
    .zone-column h2 { font-size: 19px; }
    .coverage-map-section { grid-template-columns: 1fr 1fr; }
    .coverage-map-visual { min-height: 430px; }
    #coverageMap { height: 410px; }
}

/* CELULARES */
@media(max-width: 560px) {
    .coverage-heading { padding: 28px 15px 0; }
    .coverage-heading h1 { font-size: 30px; }
    .coverage-heading p { margin-top: 12px; font-size: 16px; }

    .coverage-zones {
        width: calc(100% - 30px);
        margin-top: 35px;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 25px 13px;
    }

    .zone-column h2 {
        min-height: 43px;
        margin-bottom: 13px;
        padding: 8px 5px;
        font-size: 15px;
    }

    .district-list { gap: 12px; }

    /* Una sola columna en móvil para conservar legibilidad */
    .district-list--two {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .district-pill {
        min-height: 39px;
        grid-template-columns: 20px minmax(0, 1fr);
        padding: 6px 5px;
        font-size: 13px;
        border-radius: 0 0 13px 13px;
    }

    .pin-icon { transform: scale(.85); }

    .coverage-map-section {
        width: calc(100% - 30px);
        margin-top: 35px;
        grid-template-columns: 1fr;
        gap: 5px;
    }

    .coverage-map-copy { padding: 12px 4px 0; }
    .coverage-map-copy h2 { font-size: 26px; }
    .map-description { font-size: 14px; }
    .coverage-map-visual { min-height: 340px; }

    #coverageMap {
        width: min(100%, 360px);
        height: 330px;
    }

    .map-circle-outer { width: min(100%, 370px); }
    .map-circle-inner { width: min(78%, 290px); }
    .map-caption { bottom: 0; }
}

/* PANTALLAS PEQUEÑAS */
@media(max-width: 380px) {
    .coverage-heading h1 { font-size: 27px; }
    .district-pill { font-size: 12px; }
    .zone-column h2 { font-size: 14px; }
}


/* =====================================================
   BUSCADOR DE DIRECCIONES - GEOAPIFY
===================================================== */

.coverage-search {
    position: relative;
    width: 100%;
    max-width: 440px;
    margin: 22px 0 18px;
    z-index: 20;
}

.coverage-search > label {
    display: block;
    margin-bottom: 8px;
    color: var(--cov-blue);
    font-size: 13px;
    font-weight: 800;
}

.coverage-search-control {
    display: flex;
    width: 100%;
    min-height: 48px;
    overflow: hidden;
    border: 1px solid #d9deeb;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
}

.coverage-search-control:focus-within {
    border-color: var(--cov-blue);
    box-shadow: 0 0 0 3px rgba(8, 47, 208, .10);
}

.coverage-search-control input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    padding: 0 13px;
    color: #222;
    background: transparent;
    font: inherit;
    font-size: 14px;
}

.coverage-search-control input::placeholder {
    color: #9298a5;
}

.coverage-search-control button {
    width: 50px;
    flex: 0 0 50px;
    border: 0;
    background: var(--cov-blue);
    color: #fff;
    cursor: pointer;
    font-size: 27px;
    line-height: 1;
}

.coverage-search-control button:hover {
    background: var(--cov-orange);
}

.address-suggestions {
    position: absolute;
    top: calc(100% - 1px);
    left: 0;
    right: 0;
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid #dfe3ed;
    border-radius: 0 0 10px 10px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(0, 0, 0, .13);
    z-index: 1000;
}

.address-suggestions[hidden] {
    display: none;
}

.address-suggestion {
    display: block;
    width: 100%;
    padding: 11px 13px;
    border: 0;
    border-bottom: 1px solid #edf0f5;
    background: #fff;
    color: #26334d;
    text-align: left;
    font: inherit;
    font-size: 13px;
    line-height: 1.35;
    cursor: pointer;
}

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

.address-suggestion:hover,
.address-suggestion:focus {
    outline: 0;
    background: #f0f4ff;
    color: var(--cov-blue);
}

.search-message {
    display: block;
    margin-top: 7px;
    color: #707887;
    font-size: 11px;
    line-height: 1.45;
}

.coverage-status {
    max-width: 440px;
    margin: -5px 0 17px;
    padding: 10px 12px;
    border-left: 3px solid #9aa3b2;
    border-radius: 4px;
    background: #f4f6fa;
    color: #4d5666;
    font-size: 12px;
    line-height: 1.45;
}

.coverage-status.is-near-network {
    border-left-color: #16a34a;
    background: #effaf2;
    color: #176534;
}

.coverage-status.is-no-network {
    border-left-color: #e09b22;
    background: #fff8e9;
    color: #76500d;
}

.coverage-status.is-pending {
    border-left-color: var(--cov-blue);
    background: #f0f4ff;
    color: var(--cov-text);
}

/* Marcador de la dirección buscada */
.coverage-address-marker {
    width: 20px;
    height: 20px;
    border: 3px solid #fff;
    border-radius: 50% 50% 50% 0;
    background: var(--cov-orange);
    box-shadow: 0 2px 9px rgba(0, 0, 0, .35);
    transform: rotate(-45deg);
}

/* Líneas de fibra instaladas cargadas desde cobertura.geojson */
.leaflet-overlay-pane .fiber-installed-line {
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .25));
}

@media(max-width: 560px) {
    .coverage-search {
        max-width: none;
        margin-top: 18px;
    }

    .coverage-search-control {
        min-height: 46px;
    }

    .coverage-search-control input {
        font-size: 13px;
    }

    .coverage-status {
        font-size: 11px;
    }
}


/* =====================================================
   GOOGLE MAPS - AJUSTES DE PRESENTACIÓN
   Conserva el contenedor circular y el diseño original.
===================================================== */
#coverageMap {
    background: #e8ebf3;
    isolation: isolate;
}

#coverageMap .gm-style {
    font-family: inherit;
}

#coverageMap .gm-style-iw,
#coverageMap .gm-style-iw-d {
    color: #26334d;
}

#coverageMap button.gm-ui-hover-effect {
    outline-offset: 2px;
}

.coverage-address-marker {
    width: 18px;
    height: 18px;
    border: 3px solid #fff;
    border-radius: 50% 50% 50% 0;
    background: var(--cov-orange);
    box-shadow: 0 2px 9px rgba(0, 0, 0, .35);
    transform: rotate(-45deg);
}



/* =====================================================
   GOOGLE MAPS EMBED - IFRAME
   Mantiene el tamaño y la forma circular del mapa actual.
===================================================== */
#coverageMap.coverage-map-frame {
    position: relative;
    display: block;
    isolation: isolate;
    background: #e8ebf3;
}

#coverageMap.coverage-map-frame iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

/* En el mapa iframe no se utilizan estilos de Leaflet ni marcadores propios. */

/* CONTADOR VISITANTES */
let viewers=42;

setInterval(()=>{

  viewers+=Math.floor(Math.random()*7)-3;

  if(viewers<1)viewers=1;
  if(viewers>65)viewers=65;

  const el=document.getElementById("viewers");

  if(el)el.textContent=viewers;

},5000);


document.addEventListener("DOMContentLoaded",()=>{

  const viewers=document.getElementById("viewers");

  if(viewers){
    viewers.textContent=Math.floor(Math.random()*(80-25+1))+25;
  }

});