/* =============================================
   MAPA CASOS DE ÉXITO — mapa.css
   ============================================= */

.mapa-section {
    padding: 70px 0 90px;
    background: #fff;
}

.mapa-section .container-fluid {
    padding: 0 50px;
    max-width: 1400px;
    margin: 0 auto;
}

.mapa-title {
    color: #1a1a1a;
    font-size: 40px;
    font-weight: 900;
    font-style: italic;
    margin-bottom: 8px;
    line-height: 1.1;
}

.mapa-subtitle {
    color: #1a1a1a;
    font-size: 32px;
    font-weight: 900;
    font-style: italic;
    margin-bottom: 12px;
    line-height: 1.2;
}

.mapa-descripcion {
    color: #1a1a1a;
    font-size: 14px;
    font-weight: 600;
    font-style: italic;
    margin-bottom: 50px;
    max-width: 900px;
    line-height: 1.5;
}

/* ---- Contenedor ---- */
.mapa-container {
    position: relative;
}

.mapa-svg-wrapper {
    position: relative;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto 50px;
    line-height: 0;
}

/* Grey base image */
.mapa-base {
    width: 100%;
    height: auto;
    display: block;
    pointer-events: none;
    user-select: none;
}

/* Interactive overlay SVG — covers the base image exactly */
#mapaMexico {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
}

/* ---- Popup ---- */
.popup-estado {
    display: none;
    position: absolute;
    z-index: 200;
    pointer-events: none;
}

.popup-estado.show {
    display: block;
}

.popup-content {
    position: absolute;
    background: #fff;
    min-width: 260px;
    pointer-events: all;
    box-shadow: 0 2px 16px rgba(0,0,0,0.12);
    padding: 18px 20px 14px;
}

.popup-estado-nombre {
    color: #1a1a1a;
    font-size: 17px;
    font-weight: 800;
    margin: 0 0 12px 0;
    font-style: italic;
}

.popup-lista {
    display: flex;
    flex-direction: column;
}

/* Collapsible category sections */
.popup-section {
    margin-bottom: 1px;
}

.popup-cat-header {
    display: flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    color: #1a1a1a;
    font-size: 13px;
    font-weight: 800;
    font-style: italic;
    padding: 4px 0 3px;
    user-select: none;
    border-bottom: 1px solid #f0f0f0;
}

.popup-cat-header:hover {
    color: #5cb800;
}

.popup-cat-arrow {
    color: #5cb800;
    font-size: 9px;
    display: inline-block;
    transition: transform 0.15s;
    line-height: 1;
    flex-shrink: 0;
}

.popup-cat-items {
    display: none;
    padding: 4px 0 2px 14px;
}

.popup-cat-items.open {
    display: block;
}

.popup-subitem {
    color: #444;
    font-size: 12.5px;
    font-weight: 500;
    font-style: normal;
    padding: 2px 0;
    line-height: 1.4;
    cursor: default;
}

.popup-subitem:hover {
    color: #5cb800;
}

.popup-close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: #999;
    line-height: 1;
    padding: 0;
    pointer-events: all;
}

.popup-close:hover {
    color: #333;
}

/* ---- Controles ---- */
.mapa-controles {
    max-width: 900px;
    margin: 0 auto;
}

.buscador {
    position: relative;
    margin-bottom: 20px;
    max-width: 200px;
    margin-left: auto;
    margin-right: auto;
}

.buscador input {
    width: 100%;
    padding: 8px 34px 8px 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.buscador input:focus {
    border-color: #5cb800;
}

.buscador .icono-buscar {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #888;
    pointer-events: none;
}

.filtros-botones {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.btn-filtro {
    padding: 7px 18px;
    border: 1px solid #ccc;
    background: #fff;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    white-space: nowrap;
    color: #333;
}

.btn-filtro:hover {
    border-color: #5cb800;
    color: #3d8a00;
}

.btn-filtro.active {
    background: #5cb800;
    color: #fff;
    border-color: #5cb800;
}

/* ---- Tabla ---- */
.tabla-resultados {
    margin-top: 36px;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.tabla-resultados table {
    width: 100%;
    border-collapse: collapse;
}

.tabla-resultados thead th {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 2px solid #1a1a1a;
    font-weight: 800;
    font-size: 15px;
}

.tabla-resultados tbody td {
    padding: 11px 12px;
    border-bottom: 1px solid #e8e8e8;
    font-size: 14px;
    color: #222;
}

.tabla-resultados tbody tr:hover td {
    background: #f7fbf0;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 992px) {
    .mapa-section { padding: 60px 0; }
    .mapa-section .container-fluid { padding: 0 30px; }
    .mapa-title   { font-size: 32px; }
    .mapa-subtitle{ font-size: 26px; }
    .mapa-descripcion { font-size: 13px; margin-bottom: 40px; }
}

@media (max-width: 768px) {
    /* On mobile the popup is centered and fixed so it never goes off-screen */
    .popup-estado.show {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%);
        width: calc(100vw - 40px);
        max-width: 320px;
        z-index: 9999;
    }
    .popup-content {
        position: relative !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100%;
        min-width: unset;
        box-sizing: border-box;
        max-height: 70vh;
        overflow-y: auto;
    }
}

@media (max-width: 576px) {
    .mapa-section { padding: 50px 0; }
    .mapa-section .container-fluid { padding: 0 20px; }
    .mapa-title   { font-size: 28px; }
    .mapa-subtitle{ font-size: 22px; }
    .mapa-descripcion { font-size: 12px; margin-bottom: 35px; }
    .filtros-botones { gap: 6px; }
    .btn-filtro { padding: 6px 12px; font-size: 12px; }
    .popup-content { padding: 14px 14px 10px; }
    .popup-estado-nombre { font-size: 15px; }
    .popup-item { font-size: 12px; }
}
