﻿.mapa_body { font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif, Arial; margin: 20px; line-height: 1.6; font-size: 12px; }

/* Formulario en Grid de 2 columnas en escritorio */
.mapa_form {
    background: #f4f4f4;
    padding: 20px;
    border-radius: 5px;
    margin-bottom: 20px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    column-gap: 20px;
    row-gap: 14px;
}
.mapa_grid_full { grid-column: 1 / -1; }
.mapa_form_group {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
}
.mapa_form_botones {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.mapa_esp { display: inline-block; }
.mapa_label { font-weight: bold; display: block; margin-bottom: 5px; }
.mapa_checkbox_group label { display: inline; font-weight: normal; margin-right: 15px; }
.mapa_select, .mapa_text { width: 100%; padding: 8px; box-sizing: border-box; font-size: 12px; }

.mapa_button, .mapa_btn { background: #0056b3; color: white; padding: 8px 13px; border: none; border-radius: 6px; -webkit-border-radius: 6px; cursor: pointer; margin-right: 6px; margin-top: 2px; font-size: 13px; }
.mapa_btn { background-color: #0074d9; }
.mapa_button:hover { background: #004085; }
.mapa_btn:hover { background: #004085; }

.mapa_svg_icon { width: 14px; height: 14px; vertical-align: middle; flex-shrink: 0; }

/* Barra superior de resultados y botones de acción */
.mapa_barra_resultados {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.mapa_barra_resultados h3 { margin: 0; }

.mapa_acciones_resultados {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.mapa_acciones_resultados .mapa_btn {
    margin-right: 0;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
}

/* En escritorio (> 990px) el conmutador de vista permanece oculto */
.mapa_btn_vista { display: none !important; }

/* Contenedor de tabla con scroll horizontal y flechas flotantes < > */
.mapa_tabla_wrapper {
    position: relative;
    width: 100%;
    margin-top: 8px;
}
.mapa_tabla_scroll {
    width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}
.mapa_tabla_scroll .mapa_table {
    margin-top: 0;
    min-width: 900px;
}

.mapa_scroll_controles {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 25;
}
.mapa_scroll_btn {
    position: sticky;
    top: 50vh;
    pointer-events: auto;
    width: 34px;
    height: 36px;
    border: none;
    border-radius: 6px;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    user-select: none;
}
.mapa_scroll_btn:hover { background: rgba(0, 0, 0, 0.6); }
.mapa_scroll_izq { float: left; margin-left: 6px; }
.mapa_scroll_der { float: right; margin-right: 6px; }

/* En dispositivos táctiles ocultamos las flechas laterales */
@media (hover: none) and (pointer: coarse) {
    .mapa_scroll_controles { display: none !important; }
}

.mapa_table { width: 100%; border-collapse: collapse; margin-top: 20px; clear: both; }
.mapa_table th, .mapa_table td { border: 1px solid #ddd; padding: 10px; text-align: left; font-size: 12px; word-break: normal; overflow-wrap: break-word; white-space: normal; }
.mapa_table th { background-color: #0056b3; color: white; }
.mapa_table thead th { position: sticky; top: 0; z-index: 10; box-shadow: 0 2px 5px rgba(0,0,0,0.15); background-color: rgba(0, 86, 179, 0.80); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); user-select: none; }
.mapa_table thead th:hover { background-color: rgba(0, 70, 150, 0.9); }
.mapa_table tr:nth-child(even) { background-color: #f9f9f9; }
.mapa_table thead th.columna-activa { font-weight: 900; color: #fff; background-color: rgba(0, 60, 130, 0.95); border-bottom: 3px solid #ffcc00; }
.mapa_no_results { color: #c0504d; font-weight: bold; margin-top: 20px; }
.mapa_titulo { font-size: 16px; font-weight: bold; color: #0056b3; display: block; }

.mapa_peq { font-size: 11px; font-weight: normal; }
.mapa_right { text-align: right; }
.mapa_input_contenedor { position: relative; display: flex; align-items: center; }
.mapa_input_contenedor input, .mapa_input_contenedor select { padding-right: 30px; }

.mapa_limpiar_btn {
    position: absolute;
    right: 24px;
    top: 0;
    bottom: 0;
    margin: auto 0;
    height: 20px;
    width: 20px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #000;
    font-size: 22px;
    line-height: 20px;
    text-align: center;
    user-select: none;
    display: none;
}

.mapa_input_contenedor input:not(:placeholder-shown) + .mapa_limpiar_btn,
.mapa_input_contenedor select.tiene-valor + .mapa_limpiar_btn {
    display: flex;
}

.mapa_limpiar_btn:hover { color: #0056b3; }
.mapa_tipo { display: inline-block; padding: 3px 8px; font-size: 9px; font-weight: bold; border-radius: 4px; -webkit-border-radius: 4px; text-transform: uppercase; letter-spacing: 0.5px; cursor: default; }
.mapa_publica { background-color: #e6f0fa; color: #004085; border: 1px solid #b8daff; }
.mapa_privada { background-color: #f8f9fa; color: #495057; border: 1px solid #dee2e6; }
.mapa_sep_line { padding-bottom: 10px; }
.mapa_color_estado_verde { background: #ecf7d4; border: 1px solid #b1ce73; color: black; padding: 6px 9px; border-radius: 4px; -webkit-border-radius: 4px; font-size: 11px; }
.mapa_color_estado_naranja { background: #fcefc7; border: 1px solid #ffc000; color: black; padding: 6px 9px; border-radius: 4px; -webkit-border-radius: 4px; font-size: 11px; display: block; }
.mapa_link { cursor: pointer; color: #0056b3; text-decoration: underline; }
.mapa_link:hover { color: black; text-decoration: underline; }
.mapa_div_ordenarPor { margin-bottom: 4px; }
#mapa_contenedorOrdenMovil { display: none; }

@media (max-width: 1100px) {
    .mapa_btn, .mapa_button { font-size: 12px; }
}

@media screen and (max-width: 990px) {
    .mapa_body { line-height: 1.2; font-size: 12px; }
    .mapa_table th, .mapa_table td { font-size: 10px; }
    .mapa_button, .mapa_btn { font-size: 12px; }
    .mapa_peq { font-size: 10px; }
    .mapa_tipo { margin-top: 3px; font-size: 8px; }
    .mapa_color_estado_verde { margin-top: 10px; font-size: 10px; }
    .mapa_color_estado_naranja { display: block; font-size: 10px; }

    /* Activamos los botones de conmutador Tarjetas / Tabla */
    .mapa_btn_vista { display: inline-flex !important; }
    .mapa_btn_vista[style*="display:none"],
    .mapa_btn_vista[style*="display: none"] {
        display: none !important;
    }

    /* El selector de orden móvil solo aparece cuando se activa la vista tarjetas */
    #mapa_contenedorOrdenMovil { display: none; }
    body.modo-tarjetas #mapa_contenedorOrdenMovil {
        display: block;
        margin-top: 5px;
        margin-bottom: 5px;
    }

    /* Transformación de la tabla a tarjetas solo cuando tiene .vista-tarjetas */
    .mapa_tabla_wrapper.vista-tarjetas .mapa_scroll_controles { display: none !important; }
    .mapa_tabla_wrapper.vista-tarjetas .mapa_tabla_scroll { overflow-x: visible; }
    .mapa_tabla_wrapper.vista-tarjetas .mapa_table { min-width: 0; }

    .mapa_tabla_wrapper.vista-tarjetas .mapa_table,
    .mapa_tabla_wrapper.vista-tarjetas .mapa_table thead,
    .mapa_tabla_wrapper.vista-tarjetas .mapa_table tbody,
    .mapa_tabla_wrapper.vista-tarjetas .mapa_table th,
    .mapa_tabla_wrapper.vista-tarjetas .mapa_table td,
    .mapa_tabla_wrapper.vista-tarjetas .mapa_table tr {
        display: block;
    }

    .mapa_tabla_wrapper.vista-tarjetas .mapa_table thead tr {
        position: absolute; top: -9999px; left: -9999px;
    }

    .mapa_tabla_wrapper.vista-tarjetas .mapa_table tr {
        border: 1px solid #e0e0e0;
        margin-bottom: 20px;
        padding: 15px;
        background: #ffffff;
        border-radius: 10px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
        transition: transform 0.2s ease;
    }

    .mapa_tabla_wrapper.vista-tarjetas .mapa_table td {
        border: none;
        border-bottom: 1px solid #f0f0f0;
        position: relative;
        padding: 10px 10px 10px 24%;
        text-align: left;
        min-width: 0 !important;
    }

    .mapa_tabla_wrapper.vista-tarjetas .mapa_table td:last-child {
        border-bottom: none;
    }

    .mapa_tabla_wrapper.vista-tarjetas .mapa_table td:nth-child(1):before { content: "CCAA"; position: absolute; left: 10px; font-weight: bold; color: #555; }
    .mapa_tabla_wrapper.vista-tarjetas .mapa_table td:nth-child(2):before { content: "Provincia"; position: absolute; left: 10px; font-weight: bold; color: #555; }
    .mapa_tabla_wrapper.vista-tarjetas .mapa_table td:nth-child(3):before { content: "Centro"; position: absolute; left: 10px; font-weight: bold; color: #555; }
    .mapa_tabla_wrapper.vista-tarjetas .mapa_table td:nth-child(4):before { content: "Familia"; position: absolute; left: 10px; font-weight: bold; color: #555; }
    .mapa_tabla_wrapper.vista-tarjetas .mapa_table td:nth-child(5):before { content: "Titularidad"; position: absolute; left: 10px; font-weight: bold; color: #555; }
    .mapa_tabla_wrapper.vista-tarjetas .mapa_table td:nth-child(6):before { content: "Grados"; position: absolute; left: 10px; font-weight: bold; color: #555; }
    .mapa_tabla_wrapper.vista-tarjetas .mapa_table td:nth-child(7):before { content: "Másteres"; position: absolute; left: 10px; font-weight: bold; color: #555; }
}

@media (max-width: 700px) {
    .mapa_titulo { font-size: 12px; }
    .mapa_btn, .mapa_button { font-size: 10px; }
    .mapa_texto_icono { display: none; }
    .mapa_select, .mapa_text { font-size: 11px }
}

@media (max-width: 550px) {
    .mapa_form { grid-template-columns: 1fr; }
}

@media (max-width: 400px) {
    .mapa_body { line-height: 1.2; font-size: 9px; }
    .mapa_select, .mapa_text { font-size: 10px; }
    .mapa_table th, .mapa_table td { font-size: 9px; }
    .mapa_button, .mapa_btn { font-size: 9px; }
    .mapa_peq { font-size: 8px; }
    .mapa_tipo { margin-top: 3px; font-size: 8px; }
    .mapa_color_estado_verde { margin-top: 10px; font-size: 9px; display: block; }
    .mapa_color_estado_naranja { display: block; font-size: 9px; }

    .mapa_tabla_wrapper.vista-tarjetas .mapa_table td:nth-child(1):before { content: "CA"; }
    .mapa_tabla_wrapper.vista-tarjetas .mapa_table td:nth-child(2):before { content: "Pro"; }
    .mapa_tabla_wrapper.vista-tarjetas .mapa_table td:nth-child(3):before { content: "Cen"; }
    .mapa_tabla_wrapper.vista-tarjetas .mapa_table td:nth-child(4):before { content: "Fam"; }
    .mapa_tabla_wrapper.vista-tarjetas .mapa_table td:nth-child(5):before { content: "Tit"; }
    .mapa_tabla_wrapper.vista-tarjetas .mapa_table td:nth-child(6):before { content: "Gra"; }
    .mapa_tabla_wrapper.vista-tarjetas .mapa_table td:nth-child(7):before { content: "Mas"; }
}