/* generadordeReportes.css - Versión Final: Fondo Oscuro + PDF Moderno */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700&family=Roboto:wght@300;400;500&display=swap');

/* =========================================
   1. INTERFAZ DE PANTALLA (TU FONDO ORIGINAL)
   ========================================= */
body {
    background-color: #121212; /* Fondo oscuro original */
    color: #e0e0e0;
    font-family: 'Roboto', sans-serif;
    margin: 0;
    padding: 20px;
}

#vista-reportes {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

/* --- PANEL DE CONTROLES --- */
.controles-panel {
    background-color: #1e1e1e;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 25px;
    width: 100%;
    max-width: 900px;
    margin-bottom: 40px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    box-sizing: border-box; /* Asegura que el padding no rompa el ancho */
}

.controles-panel h2 {
    color: #00bcd4;
    font-family: 'Montserrat', sans-serif;
    font-size: 1.5rem;
    margin: 0 0 20px 0;
    border-bottom: 1px solid #333;
    padding-bottom: 15px;
    width: 100%;
}

.btn-volver {
    display: inline-block;
    color: #00bcd4;
    text-decoration: none;
    font-weight: bold;
    margin-bottom: 15px;
    transition: 0.3s;
}
.btn-volver:hover { text-decoration: underline; color: #fff; }

/* Contenedor flexible principal */
.filtros-flex {
    display: flex;
    flex-wrap: wrap; /* Permite que los elementos bajen si no caben */
    gap: 20px; /* Espacio seguro entre elementos */
    align-items: flex-end; /* Alinea los botones al fondo */
}

/* Inputs y sus contenedores */
.grupo-fecha {
    display: flex;
    flex-direction: column;
    gap: 8px;
    /* Esto es clave: */
    flex: 1 1 250px; /* Crece para llenar espacio, pero mínimo mide 250px */
    min-width: 0; /* Truco de Flexbox para evitar desbordes */
}

.grupo-fecha label {
    font-size: 0.85rem;
    color: #aaa;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.grupo-fecha input {
    background: #2a2a2a;
    border: 1px solid #444;
    color: white;
    padding: 12px 15px;
    border-radius: 6px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
    font-family: 'Roboto', sans-serif;
    
    /* CORRECCIÓN DEL ERROR DE INVASIÓN: */
    width: 100%; 
    box-sizing: border-box; /* Incluye el padding dentro del ancho total */
}

.grupo-fecha input:focus {
    border-color: #00bcd4;
    box-shadow: 0 0 0 2px rgba(0, 188, 212, 0.2);
}

/* Botones */
.btn-cyan, .btn-print {
    padding: 0 25px; /* Padding lateral */
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    border: none;
    height: 46px; /* Altura fija igual al input */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
    font-size: 0.95rem;
    
    /* CORRECCIÓN: Evita que el botón se aplaste o sea invadido */
    flex-shrink: 0; 
    white-space: nowrap; /* El texto no se rompe */
}

.btn-cyan {
    background: linear-gradient(135deg, #00bcd4, #0097a7);
    color: white;
    box-shadow: 0 4px 10px rgba(0, 188, 212, 0.3);
}

.btn-print {
    background: #444;
    color: #fff;
    border: 1px solid #555;
    /* Si quieres que este botón baje a otra línea si no hay espacio: */
    margin-left: auto; 
}

.btn-cyan:hover { transform: translateY(-2px); box-shadow: 0 6px 15px rgba(0, 188, 212, 0.4); }
.btn-print:hover { background: #555; }


/* =========================================
   2. DISEÑO DEL PDF (MODERNO Y LIMPIO)
   ========================================= */
.hoja-carta {
    background: white;
    color: #333; /* Gris oscuro para texto */
    width: 21.59cm;
    min-height: 27.94cm;
    padding: 2cm 2.5cm; /* Márgenes elegantes */
    margin: 0 auto 50px;
    box-shadow: 0 0 50px rgba(0,0,0,0.5); /* Sombra alrededor de la hoja */
    font-family: 'Montserrat', sans-serif; /* Tipografía moderna */
    position: relative;
    box-sizing: border-box;
}

/* Encabezado */
.header-logos {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    border-bottom: 3px solid #800040; /* Línea de marca */
    padding-bottom: 15px;
}
.header-logos img { height: 65px; object-fit: contain; }

/* Títulos */
.titulo-principal { text-align: center; margin-bottom: 35px; }
.titulo-principal h1 {
    font-size: 18pt;
    color: #800040; /* Guindo UP */
    font-weight: 800;
    margin: 0;
    text-transform: uppercase;
}
.titulo-principal h2 {
    font-size: 12pt;
    color: #666;
    font-weight: 600;
    margin-top: 5px;
    text-transform: uppercase;
}

/* Sección Resumen */
.resumen-texto {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 30px;
    background: #f9f9f9; /* Fondo muy sutil */
    padding: 15px;
    border-left: 4px solid #800040;
}
.resumen-texto p { margin: 3px 0; font-size: 10pt; }
.resumen-texto strong { color: #800040; }

/* Títulos H3 (Subtítulos) */
h3 {
    font-size: 11pt;
    color: #000;
    text-transform: uppercase;
    border-bottom: 2px solid #ddd; /* Línea suave */
    padding-bottom: 5px;
    margin-top: 30px;
    margin-bottom: 15px;
}

h4 { font-size: 10pt; color: #555; margin-bottom: 10px; }

/* --- TABLAS MODERNAS (SIN BORDES VERTICALES) --- */
.tabla-oficial, .tabla-lista {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 25px;
    font-size: 9pt;
    font-family: 'Roboto', sans-serif;
}

/* Cabeceras */
.tabla-oficial th, .tabla-lista th {
    background-color: #800040 !important;
    color: white !important;
    font-weight: 600;
    text-transform: uppercase;
    padding: 8px 10px;
    text-align: center;
    border: none; /* Sin borde */
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

/* Celdas */
.tabla-oficial td, .tabla-lista td {
    padding: 8px 10px;
    border-bottom: 1px solid #eee; /* Solo líneas horizontales */
    color: #333;
    text-align: center;
}

/* Filas cebra */
.tabla-oficial tr:nth-child(even), .tabla-lista tr:nth-child(even) {
    background-color: #f8f8f8 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

/* Clases de utilidad */
.text-left { text-align: left !important; }
.bold { font-weight: bold; }
.bg-gray {
    background-color: #e0e0e0 !important;
    color: black;
    font-weight: bold;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}
    

/* Gráficos */
.chart-container { width: 80%; margin: 15px auto; height: 220px; }

/* Firma */
.firma-box { margin-top: 60px; text-align: center; page-break-inside: avoid; }
.linea-firma {
    border-top: 1px solid #000;
    width: 250px;
    margin: 0 auto 10px;
}

.page-break { page-break-before: always; display: block; height: 1px; }

/* =========================================
   3. IMPRESIÓN (SIN UI, SOLO DOCUMENTO)
   ========================================= */
@media print {
    @page { size: letter; margin: 1.5cm; }
    
    body { background: white; margin: 0; padding: 0; }
    .no-print, .controles-panel, .btn-volver { display: none !important; }
    
    #vista-reportes { padding: 0; display: block; }
    
    .hoja-carta {
        box-shadow: none;
        margin: 0;
        width: 100%;
        max-width: 100%;
        padding: 0;
        border: none;
    }
    
    /* Forzar impresión de colores de fondo */
    * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
    
    /* Evitar cortes */
    tr, img, .chart-container, .firma-box { page-break-inside: avoid; }
}