/**
 * Mapa section styles — Sector 134
 */

/* ─── Section: Top ───────────────────────── */
.mapa-top {
    padding: 0 clamp(20px, 12px + 2.5vw, 60px);
}

.mapa-top__title {
    font-size: clamp(32px, 28px + 1.25vw, 52px);
    font-weight: 700;
    text-transform: uppercase;
    margin: 0 0 clamp(18px, 15.2px + 0.875vw, 32px) 0;
    line-height: 1;
}

/* ── Filters ── */
.mapa-filters {
    display: flex;
    gap: clamp(8px, 6.857px + 0.357vw, 12px);
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.mapa-filters__select {
    padding: 8px 32px 8px 12px;
    border: 1px solid var(--wp--preset--color--black);
    border-radius: 4px;
    font-family: var(--wp--preset--font-family--body-font);
    font-size: var(--wp--preset--font-size--small);
    color: var(--wp--preset--color--black);
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 0 1 1.06 0L10 11.94l3.72-3.72a.75.75 0 1 1 1.06 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L5.22 9.28a.75.75 0 0 1 0-1.06Z" clip-rule="evenodd" /></svg>');
    background-repeat: no-repeat;
    background-size: 16px; 
    background-position: right 12px center;
    background-color: var(--wp--preset--color--off-white);
    appearance: none;
    cursor: pointer;
    min-width: 140px;
}
@media(min-width:768px) {
    .mapa-filters__select {
        min-width: auto;
        width: 150px;
    }
}

.mapa-filters__select:focus {
    outline: none;
    border-color: #999;
}

.mapa-filters__clear {
    padding: 8px 16px;
    border: 1px solid var(--wp--preset--color--border, #ddd);
    border-radius: 4px;
    font-family: inherit;
    font-size: var(--wp--preset--font-size--small);
    color: var(--wp--preset--color--foreground-secondary, #555);
    background: transparent;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    text-transform: uppercase;
    font-weight: 700;
}

.mapa-filters__clear:hover {
    border-color: var(--wp--preset--black);
    color: var(--wp--preset--black);
}

/* ── Meta (total + legend) ── */
.mapa-top__meta {
    margin-bottom: 16px;
}
@media(min-width:480px) {
    .mapa-top__meta {
        display: flex;
        align-items: center;
        gap: 20px;
    }
}

.mapa-top__total {
    font-size: clamp(32px, 28px + 1.25vw, 52px);
    font-weight: 700;
    line-height: 1;
}

.mapa-top__legend {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: var(--wp--preset--font-size--xs);
    color: var(--wp--preset--color--black);
}

.mapa-top__legend-dot {
    display: inline-block;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
}

.mapa-top__legend-dot--id {
    background: var(--wp--preset--color--lilac-light);
}

.mapa-top__legend-dot--no-id {
    background: var(--wp--preset--color--green-light);
}

/* ── Circles grid: 4 rows, horizontal scroll ── */
.mapa-circles {
    display: grid;
    grid-auto-flow: column;
    grid-template-rows: repeat(4, 44px);
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 12px;
    margin-bottom: 12px;
    scrollbar-width: thin;
    scroll-behavior: smooth;
    justify-content: start;
    padding: 4px 4px 16px;
    position: relative;
    -webkit-mask-image: linear-gradient(to right, #f7f7f7 90%, transparent 100%);
    mask-image: linear-gradient(to right, #f7f7f7 90%, transparent 100%);
}

.mapa-circles::-webkit-scrollbar {
    height: 4px;
}

.mapa-circles::-webkit-scrollbar-thumb {
    background: var(--wp--preset--color--lilac-light);
    border-radius: 2px;
}

.mapa-circles__item {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--wp--preset--color--lilac-light);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    position: relative;
    flex-shrink: 0;
    background-blend-mode: multiply; /* Mezcla el color con la imagen */
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mapa-circles__initials {
    font-size: 1rem;
    font-weight: 700;
    color: var(--wp--preset--color--white);
    letter-spacing: 0.02em;
    pointer-events: none;
    user-select: none;
}

.mapa-circles__item:hover {
    transform: scale(1.12);
    z-index: 50;
    border: 3px solid var(--wp--preset--color--lilac-dark);
}

.mapa-circles__item--active {
    border-color: var(--wp--preset--color--lilac-dark);
    box-shadow: 0 0 0 2px var(--wp--preset--black);
    z-index: 49;
    border: 3px solid var(--wp--preset--color--lilac-dark);
}

.mapa-circles__item--no-id {
    background: var(--wp--preset--color--green-light);
}
.mapa-circles__item--no-id:hover,
.mapa-circles__item--active.mapa-circles__item--no-id {
    border: 3px solid var(--wp--preset--color--green-dark);
}

.mapa-circles__item img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* ── Floating tooltip (appended to body, position:fixed) ── */
.mapa-tooltip-float {
    position: fixed;
    background: var(--wp--preset--color--black);
    color: #fff;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 0.75rem;
    line-height: 1.6;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    max-width: 340px;
}

.mapa-tooltip-float::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--wp--preset--color--black);
}

.mapa-tooltip-float--below::after {
    top: auto;
    bottom: 100%;
    border-top-color: transparent;
    border-bottom-color: var(--wp--preset--color--black);
}

.mapa-tooltip-float--visible {
    opacity: 1;
}

.mapa-tooltip-float__title {
    font-weight: 700;
    margin-bottom: 2px;
}

.mapa-tooltip-float__title--id {
    color: var(--wp--preset--color--lilac-dark);
}

.mapa-tooltip-float__title--no-id {
    color: var(--wp--preset--color--green-dark);
}


/* ─── Section: Map ───────────────────────── */
.mapa-main {
    background: var(--wp--preset--color--off-white);
    padding: 0 clamp(20px, 12px + 2.5vw, 60px);
}

.mapa-main__inner {
    display: grid;
    grid-template-columns: 330px 1fr;
    gap: clamp(8px, 6.857px + 0.357vw, 12px);
    align-items: start;
}

/* ── Panel ── */
.mapa-panel {
    min-height: 500px;
    max-height: 720px;
    overflow-y: auto;
    scrollbar-width: thin;
    padding-right: clamp(16px, 13.714px + 0.714vw, 24px);
}

.mapa-panel::-webkit-scrollbar { width: 3px; }
.mapa-panel::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }

.mapa-panel__placeholder {
    color: var(--wp--preset--color--off-white);
    font-size: var(--wp--preset--font-size--medium);
}

/* ── Back link ── */
.mapa-panel__back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 16px;
    color: var(--wp--preset--color--black);
    cursor: pointer;
    margin-bottom: 16px;
    transition: color ease .3s;
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
}

.mapa-panel__back svg {
    height: 20px;
    width: 20px;
}

.mapa-panel__back:hover {
    color: var(--wp--preset--color--lilac-dark);
}

/* ── Person detail ── */
.person-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.person-photo {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--wp--preset--color--lilac-light);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
    overflow: hidden;
    position: relative;
}

.person-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(100%);
    mix-blend-mode: multiply;
    position: absolute;
    top: 0;
    left: 0;
}

.person-photo__initials {
    position: relative;
    z-index: 0;
}

.person-photo--no-id {
    background: var(--wp--preset--color--accent-green, #7BA87B);
}

.nav-arrows {
    display: flex;
    gap: 6px;
}

.nav-arrow {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity ease .3s;
}

.nav-arrow:hover {
    opacity: .5;
}

.nav-arrow--disabled {
    opacity: 0.3;
    cursor: default;
    pointer-events: none;
}

.person-name {
    font-size: clamp(28px, 24.4px + 1.125vw, 46px);
    font-weight: 700;
    margin-bottom: 16px;
    line-height: 1;
    text-transform: uppercase;
}

.person-fields {
    font-size: clamp(16px, 15.429px + 0.179vw, 18px);
    line-height: 1.4;
    list-style: none;
    padding: 0;
    margin: 0;
}

.person-fields strong { font-weight: 700; }

.person-recorrido {
    margin-top: 12px;
    font-size: clamp(16px, 15.429px + 0.179vw, 18px);
    line-height: 1.6;
    list-style: none;
    padding: 0;
}

.person-recorrido__num {
    display: inline-block;
    font-weight: 700;
    margin-right: 2px;
}

.person-recorrido__hallazgo {
    font-weight: 700;
}

.person-recorrido__section-title {
    font-weight: 700;
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--wp--preset--color--foreground-secondary, #555);
    margin-top: 12px;
    margin-bottom: 4px;
    padding-top: 8px;
    border-top: 1px solid var(--wp--preset--color--border, #ddd);
}

.person-recorrido-item.localidad {
    margin-top: 12px;
    margin-bottom: 4px;
    padding-top: 8px;
    border-top: 1px solid var(--wp--preset--color--border, #ddd);
}

.person-recorrido-item.localidad strong {
    font-weight: 700;
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--wp--preset--color--foreground-secondary, #555);
}

.person-recorrido-item p {
    margin: 0;
}

/* ── List items (CCD, circuitos, personas) ── */
.mapa-list__title {
    font-size: clamp(18px, 16.286px + 0.536vw, 24px);
    font-weight: 700;
    margin-bottom: 16px;
}

.mapa-list__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-top: 1px solid var(--wp--preset--color--black);
    cursor: pointer;
    font-size: clamp(16px, 15.429px + 0.179vw, 18px);
    transition: color 0.15s;
    background: none;
    border-left: none;
    border-right: none;
    border-bottom: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
    color: inherit;
}

.mapa-list__item:hover {
    color: var(--wp--preset--color--lilac-dark);
}

.mapa-list__arrow {
    display: block;
    height: 20px;
    width: 20px;
}

/* ── Circuito list item ── */
.circuito-item {
    padding: 12px 0;
    border-top: 1px solid var(--wp--preset--color--black);
    cursor: pointer;
    font-size: clamp(16px, 15.429px + 0.179vw, 18px);
    line-height: 1.2;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    transition: opacity 0.15s;
}

.circuito-item:hover { opacity: 0.7; }

.circuito-item__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 6px;
}

.circuito-item__content { flex: 1; }

.circuito-item__steps {
    font-size: clamp(16px, 15.429px + 0.179vw, 18px);
    line-height: 1.2;
}

.circuito-item__step span {
    font-weight: 700;
    margin-right: 2px;
}


/* ─── Rectangular map with overlay buttons ── */
.mapa-map {
    position: relative;
}

.mapa-map__container {
    width: 100%;
    height: 720px;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}

#map {
    width: 100%;
    height: 100%;
}

/* Layer buttons overlaid on map */
.mapa-layers {
    position: absolute;
    top: 16px;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
}

.mapa-layers__btn {
    padding: 12px 18px;
    background: var(--wp--preset--color--black);
    color: var(--wp--preset--color--white);
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    border: none;
    cursor: pointer;
    text-align: left;
    line-height: 1.3;
    transition: background 0.3s;
    min-width: 150px;
    font-family: var(--wp--preset--font-family--body-font);
    border-radius: 4px;
}

.mapa-layers__btn:hover {
    background: var(--wp--preset--color--lilac-dark);
}

.mapa-layers__btn--active {
    background: var(--wp--preset--color--lilac-dark);
}

/* Leaflet overrides */
.leaflet-control-attribution { display: none !important; }

.leaflet-popup-content-wrapper {
    border-radius: 6px !important;
    font-family: var(--wp--preset--font-family--body-font) !important;
    font-size: 0.78rem !important;
}

.leaflet-popup-content {
    margin: 8px 20px !important;
}

.leaflet-popup-content strong {
    color: var(--wp--preset--color--black);
    font-weight: 700;
}

/* ── Leaflet markers ── */
.numbered-marker {
    background: none !important;
    border: none !important;
}

.marker-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--wp--preset--font-family--body-font);
    font-weight: 800;
    font-size: 0.7rem;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.marker-ccd {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--wp--preset--color--lilac-dark);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.marker-hallazgo {
    width: 10px;
    height: 10px;
    background: var(--wp--preset--color--green-dark);
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}


/* ─── Section: Footer ────────────────────── */
.mapa-footer {
    padding: 0 clamp(20px, 12px + 2.5vw, 60px);
    margin-top: clamp(20px, 12px + 2.5vw, 60px);
}

.mapa-footer__title {
    font-size: clamp(14px, 13.6px + 0.125vw, 16px);
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 16px;
}

.mapa-footer__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: clamp(16px, 12.8px + 1vw, 32px);
    font-size: clamp(14px, 13.6px + 0.125vw, 16px);
    color: var(--wp--preset--color--black);
    line-height: 1.3;
    margin-bottom: 20px;
}

.mapa-footer__grid strong {
    font-weight: 700;
}

.mapa-footer__source {
    font-size: clamp(14px, 13.6px + 0.125vw, 16px);
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
}


/* ─── Responsive ─────────────────────────── */
@media (max-width: 1100px) {
    .mapa-main__inner {
        grid-template-columns: 250px 1fr;
    }
}

@media (max-width: 900px) {
    .mapa-main__inner {
        grid-template-columns: 1fr;
    }

    .mapa-map__container {
        height: 320px;
    }

    .mapa-panel { 
        max-height: 320px; 
        min-height: auto; 
        order: 1;
        overflow: auto;
        -webkit-mask-image: linear-gradient(to bottom, #f7f7f7 80%, transparent 100%);
        mask-image: linear-gradient(to bottom, #f7f7f7 80%, transparent 100%);
        padding-bottom: 2rem;
    }

    .mapa-footer__grid {
        grid-template-columns: 1fr 1fr;
    }
    .person-header {
        display: grid;
        grid-template-columns: 100px 1fr;
        gap: clamp(8px, -0.828px + 2.759vw, 24px);
        align-items: center;
        padding-right: 70px;
        position: relative;
    }
    .nav-arrows {
        position: absolute;
        right: 0;
    }
}

@media (max-width: 600px) {
    .mapa-top {
        padding: 24px 20px 0;
    }

    .mapa-map__container {
        height: 320px;
    }

    .mapa-footer__grid {
        grid-template-columns: 1fr;
    }

    .mapa-layers__btn {
        font-size: 0.7rem;
        padding: 10px 14px;
        min-width: 120px;
    }
}
