/* ============================================================
   NEWS MAP PRO — style.css v9.4  |  Fluid & Responsive FIXED
   ============================================================ */

:root {
    --nmp-primary:   #0b3d55;
    --nmp-accent:    #d49500;
    --nmp-light:     #6baaaf;
    --nmp-white:     #ffffff;
    --nmp-text:      #222222;
    --nmp-muted:     #555555;

    /* FIX: panel-h más conservador para evitar overflow en ambos extremos */
    --nmp-panel-h:   clamp(480px, 70vh, 900px);
    --nmp-img-h:     clamp(180px, 22vw, 420px);

    --nmp-fs-title:  clamp(16px, 1.4vw, 28px);
    --nmp-fs-body:   clamp(13px, 1vw, 18px);
    --nmp-fs-btn:    clamp(12px, 0.85vw, 16px);
    --nmp-fs-tag:    clamp(10px, 0.75vw, 13px);
    --nmp-fs-pill:   clamp(12px, 0.9vw, 18px);
}

/* ── RESET ── */
.nmp-wrapper,
.nmp-wrapper * {
    box-sizing: border-box;
}

/* ── WRAPPER PRINCIPAL ── */
.nmp-wrapper {
    display: flex;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    margin: 0;
    padding: clamp(12px, 2vw, 40px);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    align-items: flex-start;
    gap: clamp(12px, 2vw, 32px);
    /* FIX: crea un stacking context aislado para que z-index internos
       no compitan con el header del tema (sticky/fixed con z-index alto) */
    isolation: isolate;
    position: relative;
    z-index: 0;
}

/* ── COLUMNA NOTICIAS ── */
.nmp-news {
    flex: 0 0 33%;
    width: 33%;
    min-width: 0;
    height: var(--nmp-panel-h);
    overflow: hidden;
    position: relative;
    /* FIX: stacking context local para que los controles absolutos
       queden contenidos dentro del panel y no escalen hacia el header */
    z-index: 1;
}

/* ── CONTROLES ── */
.nmp-controls {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.nmp-control-btn {
    width:  clamp(36px, 2.8vw, 50px);
    height: clamp(36px, 2.8vw, 50px);
    background: rgba(11, 61, 85, 0.90);
    color: var(--nmp-white);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(11, 61, 85, 0.30);
}

.nmp-control-btn:hover {
    background: var(--nmp-primary);
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(11, 61, 85, 0.45);
}

.nmp-control-btn:active { transform: scale(0.95); }

.nmp-control-btn svg {
    width:  clamp(14px, 1.4vw, 22px);
    height: clamp(14px, 1.4vw, 22px);
}

/* ── TRACK DE CARDS ── */
.nmp-track {
    display: flex;
    flex-direction: column;
    gap: clamp(14px, 1.5vw, 28px);
    will-change: transform;
    transition: none;
}

/* ── CARD ── */
.nmp-card {
    background: var(--nmp-white);
    border-radius: clamp(10px, 1vw, 18px);
    box-shadow: 0 8px 28px rgba(0,0,0,0.10);
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
    flex-shrink: 0;
}

.nmp-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 40px rgba(0,0,0,0.16);
}

/* ── IMAGEN ── */
.nmp-img-box { position: relative; }

.nmp-img-box img {
    width: 100%;
    height: var(--nmp-img-h);
    object-fit: cover;
    display: block;
}

/* ── PLACEHOLDER (sin imagen destacada) ── */
.nmp-img-placeholder {
    position: relative;
    width: 100%;
    height: calc(var(--nmp-img-h) * 0.5);
    min-height: 80px;
    background: linear-gradient(135deg, #e8f4f6 0%, #d0e8ec 100%);
    display: flex;
    align-items: flex-start;
    padding: clamp(10px, 0.9vw, 20px);
}

/* ── SIN POSTS ── */
.nmp-no-posts {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 24px;
    text-align: center;
    color: var(--nmp-muted);
    height: 100%;
    min-height: 200px;
}

.nmp-no-posts svg {
    opacity: 0.35;
    color: var(--nmp-primary);
}

.nmp-no-posts p {
    font-size: var(--nmp-fs-title);
    font-weight: 600;
    margin: 0;
    color: var(--nmp-primary);
}

.nmp-no-posts small {
    font-size: var(--nmp-fs-body);
    opacity: 0.7;
}

/* ── TAG CATEGORÍA ── */
.nmp-tag {
    position: absolute;
    top: clamp(10px, 0.9vw, 20px);
    left: clamp(10px, 0.9vw, 20px);
    background: rgba(11, 61, 85, 0.95);
    color: var(--nmp-white);
    padding: clamp(5px, 0.45vw, 10px) clamp(10px, 0.9vw, 20px);
    border-radius: 30px;
    font-size: var(--nmp-fs-tag);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.20);
}

/* ── CONTENIDO CARD ── */
.nmp-content {
    padding: clamp(14px, 1.5vw, 32px);
}

.nmp-content h3 {
    margin: 0 0 clamp(8px, 0.8vw, 16px);
    font-size: var(--nmp-fs-title);
    color: var(--nmp-text);
    font-weight: 700;
    line-height: 1.3;
}

.nmp-content p {
    margin-bottom: clamp(12px, 1vw, 24px);
    line-height: 1.65;
    font-size: var(--nmp-fs-body);
    color: var(--nmp-muted);
}

.nmp-btn {
    background: var(--nmp-primary);
    color: var(--nmp-white);
    padding: clamp(8px, 0.7vw, 14px) clamp(16px, 1.5vw, 30px);
    border-radius: 40px;
    text-decoration: none;
    font-size: var(--nmp-fs-btn);
    font-weight: 600;
    display: inline-block;
    transition: all 0.3s;
}

.nmp-btn:hover {
    background: #094257;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(11, 61, 85, 0.40);
}

/* ── WRAPPER MAPA + PASTILLAS ── */
.wrapper-interactivo {
    flex: 1 1 0%;
    min-width: 0;
    max-width: 67%;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: clamp(10px, 1.2vw, 24px);
    background: var(--nmp-white);
    padding: 0;
    overflow: hidden;
    /* FIX: misma altura que .nmp-news para alinearse correctamente */
    height: var(--nmp-panel-h);
}

/* ── MAPA ── */
#chartdiv {
    flex: 1 1 0%;
    min-width: 0;
    /* FIX: 100% del contenedor padre (wrapper-interactivo tiene altura definida) */
    height: 100% !important;
    /* FIX: mínimo absoluto para que nunca desaparezca */
    min-height: 300px;
    border-radius: clamp(10px, 1vw, 18px);
    overflow: hidden;
    box-shadow: 0 8px 28px rgba(0,0,0,0.10);
}

/* ── PASTILLAS ── */
.contenedor-pastillas {
    flex: 0 0 clamp(120px, 11vw, 220px);
    width: clamp(120px, 11vw, 220px);
    display: flex;
    flex-direction: column;
    gap: clamp(8px, 0.9vw, 18px);
    overflow: visible;
}

.pastilla {
    background-color: var(--nmp-primary);
    color: var(--nmp-white);
    padding: clamp(10px, 1vw, 22px) clamp(8px, 0.8vw, 16px);
    border-radius: 60px;
    text-align: center;
    font-size: var(--nmp-fs-pill);
    font-weight: 800;
    box-shadow: 0 6px 18px rgba(11, 61, 85, 0.22);
    transition: all 0.3s;
    line-height: 1.3;
    word-break: break-word;
}

.pastilla:hover {
    transform: translateY(-4px) scale(1.03);
    box-shadow: 0 12px 30px rgba(11, 61, 85, 0.38);
}

/* ================================================================
   BREAKPOINTS
   ================================================================ */

/* Pantallas muy grandes */
@media (min-width: 1920px) {
    :root {
        --nmp-panel-h: clamp(700px, 68vh, 1100px);
        --nmp-img-h:   clamp(260px, 18vw, 500px);
    }
}

@media (min-width: 2560px) {
    :root {
        --nmp-panel-h: clamp(800px, 65vh, 1300px);
        --nmp-img-h:   clamp(300px, 15vw, 600px);
    }
}

@media (max-width: 1919px) and (min-width: 1401px) {
    :root {
        --nmp-panel-h: clamp(600px, 72vh, 1000px);
    }
}

@media (max-width: 1400px) {
    :root {
        --nmp-panel-h: clamp(520px, 70vh, 860px);
        --nmp-img-h:   clamp(180px, 22vw, 380px);
    }
}

/* Tablet */
@media (max-width: 1100px) {
    .nmp-wrapper {
        flex-direction: column;
        padding: clamp(10px, 3vw, 24px);
    }

    .nmp-news {
        width: 100%;
        flex: none;
        max-width: 100%;
        height: clamp(420px, 65vh, 700px);
    }

    .wrapper-interactivo {
        flex-direction: column;
        width: 100%;
        max-width: 100%;
        flex: none;
        /* FIX: en layout vertical, altura auto para que el mapa respire */
        height: auto;
        align-items: stretch;
    }

    /* FIX: altura explícita cuando wrapper es auto */
    #chartdiv {
        width: 100%;
        height: clamp(380px, 55vw, 680px) !important;
        min-height: 380px;
        flex: none;
    }

    .contenedor-pastillas {
        flex: none;
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }

    .pastilla {
        flex: 1 1 calc(33.333% - 14px);
        min-width: 130px;
    }
}

/* Móvil */
@media (max-width: 767px) {
    .nmp-wrapper {
        padding: 12px;
        gap: 16px;
    }

    .nmp-news {
        height: clamp(360px, 75vw, 520px);
    }

    /* FIX PRINCIPAL: el mapa en móvil necesita altura concreta y un mínimo garantizado */
    #chartdiv {
        height: clamp(280px, 80vw, 440px) !important;
        min-height: 280px;
        border-radius: 12px;
    }

    .nmp-controls {
        top: 8px;
        right: 8px;
    }

    .pastilla {
        flex: 1 1 calc(50% - 8px);
        min-width: 100px;
        font-size: clamp(11px, 3.5vw, 14px);
        padding: 10px 8px;
    }
}

/* Móvil muy pequeño */
@media (max-width: 380px) {
    .nmp-news {
        height: clamp(300px, 90vw, 420px);
    }

    #chartdiv {
        height: clamp(240px, 85vw, 340px) !important;
        min-height: 240px;
    }

    .pastilla {
        flex: 1 1 100%;
    }
}
