/* Matriz climática y su banner. Procede del módulo original de MeteoCarlet. */

        .panel-matriz {
            max-width: 1100px; margin: 0 auto 2rem; padding: 25px;
            background: var(--panel); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,0.35);
            border: 1px solid var(--borde);
        }
        
                .btn-volver {
            background: #38bdf8; color: #0f172a; text-decoration: none;
            padding: 8px 16px; border-radius: 6px; font-size: 13px; font-weight: bold;
            transition: all 0.2s ease; display: flex; align-items: center; gap: 6px;
        }
        .btn-volver:hover { background: #0ea5e9; color: #ffffff; transform: translateY(-1px); }
        .btn-volver svg { width: 16px; height: 16px; }

        .panel-matriz h2 { color: #38bdf8; margin-top: 0; margin-bottom: 15px; font-size: 1.4rem; letter-spacing: 0.5px; }
        
        .caja-controles {
            display: flex; flex-wrap: wrap; gap: 15px; margin-bottom: 20px; 
            background: #1f2937; padding: 15px; border-radius: 8px; align-items: flex-end;
            border: 1px solid #374151;
        }
        .grupo-control { display: flex; flex-direction: column; gap: 6px; }
        .grupo-control label { font-size: 11px; font-weight: bold; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.5px;}
        .grupo-control select, .grupo-control input {
            padding: 8px 12px; border-radius: 6px; border: 1px solid #475569;
            font-size: 14px; cursor: pointer; outline: none;
            background: #0f172a; color: #f8fafc; transition: all 0.2s;
        }
        .grupo-control select:hover, .grupo-control input:hover { border-color: #38bdf8; }
        
        #rangoDiaIni, #rangoDiaFin { width: 75px; }
        #rangoAnoIni, #rangoAnoFin { width: 85px; } 

        .sub-filtros { display: none; gap: 10px; align-items: flex-end; padding-left: 15px; border-left: 2px solid #475569; }
        .sub-filtros.activo { display: flex; }
        
        /* Bordes de color para identificar los sub-menús */
        #filtroUmbrales { border-left: 2px solid #8b5cf6; }
        #filtroUmbrales label { color: #a78bfa; }
        #filtroTmax { border-left: 2px solid #ef4444; }
        #filtroTmax label { color: #f87171; }
        #filtroTmin { border-left: 2px solid #38bdf8; }
        #filtroTmin label { color: #7dd3fc; }
        #filtroLluvia { border-left: 2px solid #06b6d4; }
        #filtroLluvia label { color: #22d3ee; }

        .mensaje-error { color: #fca5a5; font-weight: bold; display: none; background: #7f1d1d; padding: 10px; border-radius: 5px; margin-bottom: 15px; font-size: 13px;}
        
        .contenedor-tabla { overflow-x: auto; min-height: 100px; margin-bottom: 25px; display: block; }
        .tabla-clima { width: 100%; border-collapse: collapse; background: #1e293b; }
        .tabla-clima th, .tabla-clima td {
            border: 1px solid #334155; padding: 8px 4px; text-align: center; font-size: 13px;
        }
        .tabla-clima th { background: #0f172a; color: #cbd5e1; font-weight: bold; font-size: 11px; letter-spacing: 0.5px; }
        .col-ano { background: #0f172a; font-weight: bold; text-align: left !important; color: #f8fafc; width: 60px; padding-left: 10px !important; }
        .col-anual { border-left: 2px solid #475569 !important; font-weight: bold; }
        
        .fila-resumen-inicio td { 
            border-top: 4px solid #ffffff !important; 
            box-shadow: inset 0px 4px 6px -4px rgba(0,0,0,0.8); 
        }
        .col-resumen-label { 
            background: #0f172a !important; 
            font-size: 11px !important; 
            font-weight: 800;
            letter-spacing: 0.5px; 
            text-transform: uppercase; 
        }

        .celda-valor { font-weight: 700; transition: transform 0.1s ease; border-color: #334155; }
        .celda-valor:hover { transform: scale(1.15); box-shadow: 0px 4px 15px rgba(0,0,0,0.6); z-index: 10; position: relative; border-radius: 4px; cursor: crosshair; }
        
        .contenedor-grafico {
            background: #1e293b; border-radius: 8px; 
            padding: 10px 15px 5px 15px; 
            border: 1px solid #334155; display: none; height: 320px;
            position: relative;
        }

        .nota-ano-curso { color: #94a3b8; font-size: .8rem; text-align: center; margin: 6px 0 0; }

        .btn-reset-zoom {
            position: absolute; top: 15px; right: 20px;
            background: rgba(15, 23, 42, 0.85); color: #38bdf8;
            border: 1px solid #38bdf8; padding: 4px 10px; border-radius: 4px;
            font-size: 11px; font-weight: bold; cursor: pointer; display: none;
            z-index: 10; transition: all 0.2s;
        }
        .btn-reset-zoom:hover { background: #38bdf8; color: #0f172a; }

        /* Estilos del Visor NOAA con Técnica de Recorte Total */
        .visor-noaa {
            display: none; 
            margin: 25px auto 0 auto; 
            width: 880px; 
            max-width: 100%;
            border: 1px solid #374151;
            border-radius: 8px; 
            background: #ffffff; 
            overflow: hidden; 
            box-shadow: 0 10px 30px rgba(0,0,0,0.5);
        }
        .visor-cabecera {
            background: #1f2937; padding: 12px 15px; display: flex;
            justify-content: space-between; align-items: center;
            border-bottom: 1px solid #374151;
        }
        .visor-cabecera h3 {
            margin: 0; color: #38bdf8; font-size: 14px; font-weight: bold;
            letter-spacing: 0.5px;
        }
        .btn-cerrar-visor {
            background: #ef4444; color: white; border: none; border-radius: 4px;
            padding: 5px 12px; cursor: pointer; font-weight: bold; font-size: 12px;
            transition: background 0.2s;
        }
        .btn-cerrar-visor:hover { background: #dc2626; }
        
        .visor-contenido {
            width: 100%;
            height: 755px; /* La máscara de recorte exacta */
            overflow: hidden; /* CERO SCROLLS EN PC */
        }
        
        .visor-iframe { 
            width: 1000px; /* Totalmente sobredimensionado para matar barras internas */
            height: 900px; /* Totalmente sobredimensionado para matar el scroll del ratón */
            border: none; 
            background: #ffffff; 
            display: block;
        }

        .footer-matriz {
            text-align: center; margin-top: 25px; padding-top: 15px;
            border-top: 1px solid #1f2937; color: #64748b; font-size: 12px; font-weight: bold;
        }

        @media (max-width: 768px) {
            .panel-matriz { padding: 15px; margin: 10px; }
            .btn-volver { padding: 6px 10px; font-size: 11px; gap: 4px; } 
            .btn-volver svg { width: 14px; height: 14px; }

            .caja-controles { flex-direction: column; align-items: stretch; }
            .sub-filtros { flex-direction: column; align-items: stretch; padding-left: 0; border-left: none; border-top: 2px solid #475569; padding-top: 10px; }
            
            #filtroRango.sub-filtros, #filtroClimogramaRango.sub-filtros, #filtroUmbrales.sub-filtros, #filtroTmax.sub-filtros, #filtroTmin.sub-filtros, #filtroLluvia.sub-filtros { flex-direction: row; align-items: flex-end; gap: 8px; }
            #filtroRango .grupo-control, #filtroClimogramaRango .grupo-control, #filtroUmbrales .grupo-control, #filtroTmax .grupo-control, #filtroTmin .grupo-control, #filtroLluvia .grupo-control { flex: 1; min-width: 0; }
            #rangoDiaIni, #rangoDiaFin, #rangoMes, #rangoAnoIni, #rangoAnoFin, #selUmbral, #selTmaxModo, #selTminModo, #selLluviaModo { width: 100%; box-sizing: border-box; padding: 8px 4px; font-size: 13px; }
            #filtroRango .grupo-control label, #filtroClimogramaRango .grupo-control label, #filtroUmbrales .grupo-control label, #filtroTmax .grupo-control label, #filtroTmin .grupo-control label, #filtroLluvia .grupo-control label { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

            .tabla-clima th, .tabla-clima td { padding: 6px 2px; font-size: 12px; }
            .col-ano { width: 45px; }
            .contenedor-grafico { height: 280px; padding: 5px;} 
            
            .visor-noaa { width: 100%; }
            .visor-contenido {
                overflow-x: auto; /* Habilitamos deslizar el dedo en el móvil de lado a lado */
                -webkit-overflow-scrolling: touch;
            }
        }
    
/* Barra superior de la página (sustituye a la cabecera propia del módulo original) */
.mx-barra { display: flex; justify-content: flex-end; margin-bottom: 15px; padding-bottom: 15px; border-bottom: 1px solid #1f2937; }

/* Banner de la portada que lleva a la matriz */
.mx-banner { display: block; text-decoration: none; text-align: center; position: relative; overflow: hidden;
  max-width: 1100px; margin: 0 auto; padding: 1.6rem 1rem 1.4rem; border-radius: 12px; border: 1px solid var(--borde);
  background: linear-gradient(135deg, #162131, #101a29); }
.mx-banner svg { width: 38px; height: 38px; color: #38bdf8; }
.mx-banner h3 { color: #38bdf8; font-size: 1.35rem; letter-spacing: .5px; margin: .3rem 0 .2rem; }
.mx-banner p { color: #cbd5e1; font-weight: 600; font-size: .9rem; margin-bottom: .9rem; }
.mx-banner .mx-btn { display: inline-block; background: #0284c7; color: #fff; font-weight: 700; letter-spacing: .5px; padding: .6rem 2rem; border-radius: 4px; border: 1px solid #38bdf8; }
.mx-banner:hover .mx-btn { background: #0ea5e9; }
.mx-banner .mx-new { position: absolute; top: 12px; right: -34px; transform: rotate(35deg); background: linear-gradient(90deg, #f97316, #fb923c); color: #fff; font-weight: 800; font-size: .75rem; padding: 3px 38px; letter-spacing: 1px; }

@media (max-width: 768px) {
  .panel-matriz { margin: 0 0 1.5rem; padding: 12px; }
  .grupo-control { min-width: 0; }
  .grupo-control select { width: 100%; max-width: 100%; }
  #cajaClimogramaModo { box-sizing: border-box; max-width: 100%; }
  .panel-matriz h2 { font-size: 1.15rem; }
}
