body {
    background: #f0f0f0;
}

.refugios-vista {
    display: flex;
    flex-wrap: wrap;
    padding: 10px 0;
    background: #f0f0f0;
    min-height: calc(100vh - 60px);
    position: relative;
    z-index: 1;
}

.refugios-vista>.divFiltros {
    width: 100%;
}

.refugios-vista .btn-primary {
    background-color: #008000;
    border-color: #008000;
}

.refugios-vista .btn-primary:hover,
.refugios-vista .btn-primary:focus {
    background-color: #085e08;
    border-color: #085e08;
}

#filtrosForm {
    margin: 5px 0 15px;
    padding: 10px 10px 14px;
    background-color: #eeeff2;
    border: 1px solid #d8d8d8;
    border-radius: 5px;
    -webkit-box-shadow: 3px 4px 3px -1px rgba(0, 0, 0, 0.34);
    box-shadow: 3px 4px 3px -1px rgba(0, 0, 0, 0.34);
}

#filtrosForm .filtrosFlex {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-column-gap: 30px;
    grid-row-gap: 6px;
    margin: 0 20px;
}

#filtrosForm label {
    width: 100%;
    font-weight: 600;
    font-size: 12px;
    margin-bottom: 4px;
}

#filtrosForm label small {
    font-weight: normal;
    color: #808080;
}

#filtrosForm .select2-container {
    width: 100% !important;
    padding: 0;
    font-weight: normal;
}

#filtrosForm .select2-container-multi .select2-choices {
    width: 100% !important;
}

#filtrosForm .check-zona {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
    cursor: pointer;
}

#filtrosForm .check-zona input {
    margin: 0;
}

#filtrosForm .col-slider .label-slider {
    font-weight: 600;
    font-size: 12px;
}

#filtrosForm .col-slider small {
    color: #808080;
}

#filtrosForm .noUi-target {
    width: 90% !important;
    margin: 10px;
}

#filtrosForm .noUi-horizontal .noUi-handle {
    left: auto !important;
}

#filtrosForm .noUi-connect {
    background: #008000;
}

#filtrosForm .col-btn-filtrar {
    grid-column: 1 / -1;
    text-align: right;
    margin-top: 6px;
}

@media (max-width: 1200px) {
    #filtrosForm .filtrosFlex {
        grid-template-columns: repeat(2, 1fr);
        grid-column-gap: 15px;
    }
}

@media (max-width: 767px) {
    #filtrosForm .filtrosFlex {
        grid-template-columns: 1fr;
        margin: 0 5px;
    }

    #filtrosForm .noUi-target {
        width: auto !important;
        margin: 10px;
    }
}

/* ---------- Tarjetas (DataTables con una columna) ---------- */
#listado_refugios.cargando {
    opacity: 0.5;
    pointer-events: none;
}

#listado_refugios .dataTables_wrapper .dataTables_filter input {
    margin-left: 6px;
}

#tablarefugios.cards thead {
    display: none !important;
}

#tablarefugios.cards tbody tr {
    display: block;
    margin: 0 0 12px;
    border: 1px solid rgba(0, 0, 0, 0.125);
    border-radius: 0.25rem;
    box-shadow: 0.25rem 0.25rem 0.5rem rgba(0, 0, 0, 0.25);
}

#tablarefugios.cards tbody td {
    display: block;
    padding: 0 !important;
    border: 0 !important;
}

#tablarefugios.cards tbody tr:nth-child(2n+1) td {
    background: #E5E7F1 !important;
}

#tablarefugios.cards tbody tr:nth-child(2n) td {
    background: #EEEFF2 !important;
}

#tablarefugios.cards td.dataTables_empty {
    padding: 20px !important;
    text-align: center;
    color: #808080;
}

.refugio-card {
    padding: 12px 14px;
    border-radius: 0.25rem;
}

.refugio-card.abierta {
    outline: 2px solid #008000;
}

.refugio-cab {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
}

.refugio-titulo strong {
    font-size: 15px;
    display: block;
}

.refugio-titulo small {
    color: #808080;
}

.refugio-distancia {
    white-space: nowrap;
    color: #008000;
    font-weight: 600;
}

.refugio-datos {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 22px;
    margin: 10px 0;
}

.refugio-datos .dato {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
}

.refugio-datos .dato b {
    font-size: 14px;
}

.refugio-datos .dato small {
    color: #808080;
    font-size: 11px;
    margin-top: 3px;
}

.refugio-lugar {
    background: #FFFFFF;
    border-radius: 5px;
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.refugio-lugar:hover {
    background-color: #90a4ae;
    color: #FFFFFF;
}

.refugio-lugar .flecha {
    margin-left: auto;
    transition: all 0.2s ease;
}

.refugio-card.abierta .refugio-lugar .flecha {
    transform: rotate(180deg);
}

.refugio-fotos-n {
    color: #808080;
    font-size: 12px;
}

.badge-ref {
    display: inline-block;
    border-radius: 16px;
    padding: 4px 12px;
    font-size: 12px;
    line-height: 1.2;
    color: #333333;
    border: 1px solid #d8d8d8;
    background: #FFFFFF;
}

.badge-ref-verde {
    background: #E8F5E9;
    border-color: #4CAF50;
}

.badge-ref-naranja {
    background: #FFF3E0;
    border-color: #FFB74D;
}

.badge-ref-azul {
    background: #E3F2FD;
    border-color: #90CAF9;
}

.badge-ref-rojo {
    background: #FFE5E5;
    border-color: #FF4444;
}

/* ---------- Detalle de la tarjeta ---------- */
.refugio-detalle {
    margin-top: 12px;
}

.det-bloque {
    background: #FFFFFF;
    border-radius: 5px;
    padding: 10px 12px;
    margin-bottom: 8px;
}

.det-titulo {
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    color: #808080;
    margin-bottom: 6px;
    letter-spacing: 0.3px;
}

.det-fila {
    display: flex;
    gap: 10px;
    padding: 3px 0;
    font-size: 13px;
}

.det-label {
    flex: 0 0 150px;
    color: #808080;
}

.det-valor {
    flex: 1;
    word-break: break-word;
}

.det-chips {
    margin-bottom: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.det-nota {
    color: #808080;
    margin-left: 6px;
}

.det-enlaces {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.det-enlaces a {
    background: rgba(0, 0, 0, 0.7);
    color: #FFFFFF;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 12px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.det-enlaces a:hover {
    background: #008000;
    color: #FFFFFF;
}

.btnAccion {
    text-align: right;
    margin-top: 10px;
}

.btnAccion .btn-group .btn.active {
    background-color: #085e08;
    border-color: #085e08;
}

/* Predicción AEMET: el HTML lo genera ApiAemet::toHTML, como en senderos */
.divTiempo {
    margin-top: 8px;
}

.cardTemp {
    display: flex;
    flex-flow: row wrap;
    justify-content: space-around;
    padding: 0;
    margin: 2px 0 0;
    list-style: none;
    font-size: 12px;
}

.boxTemp {
    width: 89px;
    text-align: center;
    margin-top: 10px;
}

.cardTemp .title {
    background-color: #4c4c4c;
    color: #FFFFFF;
    padding: 8px;
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
}

.boxTemp .body {
    background-color: #FFFFFF;
    border-bottom-left-radius: 5px;
    border-bottom-right-radius: 5px;
    padding: 5px;
}

.temp {
    display: flex;
    flex-direction: row;
    margin: 5px;
}

.temp > div {
    display: inline-flex;
}

.flexTemp {
    display: inline-grid;
    align-items: center;
}

.loadTiempo {
    text-align: center;
    padding: 20px;
    margin-top: 8px;
    border: 1px solid #8080801c;
    background: #FFFFFF;
    border-radius: 5px;
    color: #808080;
}

/* ---------- Mapa y fotos ---------- */
#panelMapa {
    position: -webkit-sticky;
    position: sticky;
    top: 70px;
    background-color: #eeeff2;
    border: 1px solid #d8d8d8;
    border-radius: 5px;
    padding: 10px;
    -webkit-box-shadow: 3px 4px 3px -1px rgba(0, 0, 0, 0.34);
    box-shadow: 3px 4px 3px -1px rgba(0, 0, 0, 0.34);
}

.mapa-cabecera {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-weight: 600;
}

#mapid {
    height: 600px;
    border-radius: 5px;
    z-index: 0;
}

.refugio-pin {
    background: transparent;
    border: 0;
}

.refugio-pin svg {
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
}

.refugio-popup {
    font-size: 12px;
    min-width: 160px;
}

#panel-fotos,
#panel-comentario {
    background: #FFFFFF;
    border-radius: 5px;
    padding: 12px;
    min-height: 320px;
}

.comentarioText {
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-line;
}

.fotos-grande {
    text-align: center;
    background: #FFFFFF;
    border-radius: 5px;
    padding: 6px;
}

.fotos-grande img {
    max-width: 100%;
    max-height: 380px;
    border-radius: 4px;
}

.fotos-miniaturas {
    display: flex;
    gap: 6px;
    margin-top: 6px;
    overflow-x: auto;
}

.fotos-miniaturas img {
    height: 64px;
    width: 90px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0.7;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.fotos-miniaturas img.activa,
.fotos-miniaturas img:hover {
    opacity: 1;
    border-color: #008000;
}

/* ---------- Una sola columna (tablet y móvil) ---------- */
@media (max-width: 991px) {

    .refugios-vista>.col-md-5,
    .refugios-vista>.col-md-7 {
        width: 100%;
    }

    #panelMapa {
        position: static;
        margin-top: 0;
    }

    #mapid {
        height: 420px;
    }

    .refugios-vista>.col-md-7 {
        order: -1;
    }

    #listado_refugios .dataTables_wrapper .dataTables_length,
    #listado_refugios .dataTables_wrapper .dataTables_filter,
    #listado_refugios .dataTables_wrapper .dataTables_info,
    #listado_refugios .dataTables_wrapper .dataTables_paginate {
        float: none;
        width: 100%;
        text-align: left;
        margin: 0 0 8px;
        padding: 0;
    }

    #listado_refugios .dataTables_wrapper .dataTables_filter label,
    #listado_refugios .dataTables_wrapper .dataTables_length label {
        display: block;
        width: 100%;
    }

    #listado_refugios .dataTables_wrapper .dataTables_filter input {
        display: block;
        width: 100%;
        margin: 4px 0 0;
    }

    #listado_refugios .dataTables_wrapper .dataTables_length select {
        width: auto;
    }

    #listado_refugios .dataTables_wrapper .dataTables_paginate {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 4px;
        margin-top: 8px;
    }

    #listado_refugios .dataTables_wrapper .dataTables_paginate .paginate_button {
        margin: 0;
        padding: 8px 12px;
        min-width: 38px;
        text-align: center;
    }
}

/* ---------- Móvil ---------- */
@media (max-width: 767px) {

    .refugios-vista {
        padding: 0 8px;
    }

    .refugios-vista>div {
        min-width: 0;
        max-width: 100%;
    }

    #tablarefugios.cards,
    #tablarefugios.cards tbody {
        display: block;
        width: 100%;
    }

    #tablarefugios.cards tbody td {
        max-width: 100%;
        overflow: hidden;
    }

    .det-valor {
        overflow-wrap: anywhere;
    }

    .cardTemp {
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
        gap: 8px;
        padding-bottom: 6px;
    }

    .boxTemp {
        flex: 0 0 84px;
        scroll-snap-align: start;
    }

    .cardTemp .title {
        padding: 6px 4px;
        font-size: 11px;
    }

    .det-fila {
        flex-direction: column;
        gap: 0;
        padding: 5px 0;
        border-bottom: 1px solid #f2f2f2;
    }

    .det-fila:last-child {
        border-bottom: 0;
    }

    .det-label {
        flex: none;
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.3px;
    }

    .det-nota {
        display: block;
        margin-left: 0;
    }

    .det-bloque {
        padding: 10px;
    }

    .det-enlaces a {
        flex: 1 1 auto;
        text-align: center;
        padding: 10px 12px;
    }

    .btnAccion {
        text-align: center;
    }

    .btnAccion .btn-group {
        display: flex;
        width: 100%;
    }

    .btnAccion .btn-group .btn {
        flex: 1;
        padding: 10px 6px;
        white-space: nowrap;
    }

    .refugio-cab {
        flex-wrap: wrap;
        gap: 4px;
    }

    .refugio-distancia {
        margin-left: 0;
    }

    .refugio-datos {
        gap: 6px 10px;
    }

    .refugio-datos .dato {
        flex: 1 1 40%;
    }

    #mapid {
        height: 320px;
    }

    #panelMapa {
        border-radius: 0;
        margin: 0 0 12px;
    }

    #listado_refugios .dataTables_wrapper .dataTables_paginate .paginate_button.first,
    #listado_refugios .dataTables_wrapper .dataTables_paginate .paginate_button.last {
        display: none;
    }

    .fotos-grande img {
        max-height: 240px;
    }

}

/* Versión embebible (iframe/listado_refugios.php): sin cabecera fija encima */
.refugios-iframe #panelMapa { top: 10px; }
