/* ==========================================================================
   LABORATORIO ESTADÍSTICO PRO - HOJA DE ESTILOS MAESTRA (V16 CONSOLIDADA)
   ========================================================================== */

:root {
    --primary: #1a365d;       
    --primary-hover: #2c5282; 
    --accent: #2b6cb0;        
    --success: #27ae60;       
    --bg-page: #f8fafc;       
    --bg-card: #ffffff;       
    --border: #e2e8f0;        
    --text-main: #2d3748;     
    --text-light: #718096;    
    --whatsapp: #25D366;
    --coffee: #FFDD00; 
    --font-ui: 'Inter', system-ui, -apple-system, sans-serif;
    --font-math: 'Lora', 'Times New Roman', serif;
}

* { box-sizing: border-box; }

body {
    background-color: var(--bg-page);
    color: var(--text-main);
    font-family: var(--font-ui);
    margin: 0;
    padding-bottom: 80px;
    line-height: 1.6;
}

.container { 
    max-width: 950px; 
    margin: 0 auto; 
    padding: 20px; 
}

/* --- HEADER --- */
.site-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    margin-bottom: 2rem;
    position: sticky;
    top: 0;
    z-index: 1000;
}
.header-content {
    max-width: 950px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.brand h1 { margin: 0; font-size: 1.4rem; color: var(--primary); }
.brand p { margin: 0; font-size: 0.85rem; color: var(--text-light); }

/* --- BOTONES --- */
button {
    cursor: pointer;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-family: var(--font-ui);
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.btn-primary { background: var(--primary); color: white; }
.btn-secondary { background: white; border: 1px solid var(--border); color: var(--text-main); }
.btn-action { width: 100%; padding: 14px; background: var(--primary); color: white; margin-top: 15px; }

/* --- BANNER DE TUTORÍAS (RESPONSIVE) --- */
.promo-banner {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #bae6fd;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 1.5rem;
    border-radius: 12px;
    gap: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
}
.promo-content { display: flex; align-items: center; gap: 1rem; flex: 1; }
.promo-icon {
    background: #fff; width: 48px; height: 48px; min-width: 48px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    color: #0284c7; font-size: 1.3rem; box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.promo-text h3 { margin: 0; font-size: 1.05rem; color: #0c4a6e; }
.promo-text p { margin: 3px 0 0 0; font-size: 0.85rem; color: #475569; }
.promo-btn {
    background: #25D366; color: white !important; text-decoration: none;
    padding: 12px 20px; border-radius: 50px; font-weight: 700;
    display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
}

/* --- PANEL DE CONTROL --- */
.control-panel {
    background: var(--bg-card);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-bottom: 2rem;
}
select, input {
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 1rem;
    width: 100%;
}

/* --- REPORTE Y TARJETAS --- */
.report-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 2rem;
    overflow: hidden;
    page-break-inside: avoid;
}
.report-header {
    background: #f8fafc;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.report-body { padding: 25px; font-family: var(--font-math); }

/* --- TABLAS Y GRÁFICOS --- */
.table-wrapper { overflow-x: auto; margin: 1rem 0; border: 1px solid var(--border); border-radius: 8px; }
.data-table { width: 100%; border-collapse: collapse; text-align: center; font-size: 0.9rem; }
.data-table th { background: var(--primary); color: white; padding: 10px; }
.data-table td { border-bottom: 1px solid var(--border); padding: 8px; }

.split-layout { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.split-layout .table-wrapper { flex: 1; min-width: 280px; }
.split-layout .chart-container { flex: 1.2; min-width: 300px; }

.chart-snapshot { display: none; width: 100%; height: auto; } /* Oculta foto en web */

/* --- LISTA VERTICAL ("FACTURA") --- */
.vertical-sum-container { border-top: 2px solid var(--primary); padding-top: 10px; margin: 15px 0; }
.v-row { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px dashed #edf2f7; }
.v-total-line { font-weight: bold; border-top: 2px solid #000; margin-top: 10px; padding-top: 10px; display: flex; justify-content: space-between; }

/* --- BOTONES FLOTANTES --- */
.floating-actions { position: fixed; bottom: 25px; right: 25px; display: flex; flex-direction: column; gap: 10px; z-index: 2000; }
.float-btn {
    width: 50px; height: 50px; border-radius: 50%; display: flex; justify-content: center; align-items: center;
    color: white; text-decoration: none; box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
.float-btn.whatsapp { background: var(--whatsapp); font-size: 1.5rem; }
.float-btn.coffee { background: var(--primary); width: auto; padding: 0 15px; border-radius: 25px; }

/* --- PUBLICIDAD --- */
.ad-container { border: 1px dashed var(--border); text-align: center; color: var(--text-light); }

/* --- RESPONSIVO MÓVIL --- */
@media screen and (max-width: 768px) {
    .promo-banner { flex-direction: column; text-align: center; }
    .promo-content { flex-direction: column; }
    .promo-btn { width: 100%; justify-content: center; }
    .split-layout { flex-direction: column; }
    .header-content { flex-direction: column; gap: 10px; }
}

/* ==========================================================================
   LÓGICA DE IMPRESIÓN V16 (ELIMINA GRÁFICOS ROTOS, USA FOTOS)
   ========================================================================== */
.print-header-only, .print-footer-only { display: none; }

@media print {
    @page { margin: 1cm; size: letter; }
    .no-print, .site-header, .control-panel, .workspace, .floating-actions, .promo-banner, .web-footer { display: none !important; }
    .print-header-only, .print-footer-only { display: block; text-align: center; }
    
    body { background: white; font-size: 10pt; }
    .report-card { border: 1px solid #000; margin-bottom: 1cm; }
    
    /* OCULTA GRÁFICOS INTERACTIVOS (PLOTLY) */
    .js-plotly-plot, .plot-container { display: none !important; }
    
    /* MUESTRA LA FOTO PNG GENERADA POR CORE.JS */
    .chart-snapshot { display: block !important; margin: 0 auto; max-width: 400px; }
    
    .split-layout { display: flex !important; flex-direction: row !important; }
    .split-layout .table-wrapper { width: 45% !important; }
    .split-layout .chart-container { width: 50% !important; }
}