:root {
    /* Paleta de Colores Base */
    --bg-blue: #eef2f6;
    --text-main: #1d1d1f;
    --text-muted: #5e5e60;
    
    /* Variables de Cristal (Glassmorphism) */
    --glass-bg: rgba(255, 255, 255, 0.45);
    --glass-bg-solid: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(255, 255, 255, 0.8);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.08);
    --glass-shadow-hover: 0 15px 40px 0 rgba(31, 38, 135, 0.15);
    --glass-reflection: inset 0 2px 2px rgba(255, 255, 255, 0.9), inset 0 -1px 2px rgba(255, 255, 255, 0.3);
    
    /* Acentos */
    --accent-dark: #111111;
    --accent-blue: #0044cc;
    --accent-red: #cc0000;
    --accent-green: #008800;
    
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    
    --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* --- FONDO GEOMÉTRICO Y BASE --- */
body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-blue);
    /* Patrón de puntos geométricos minimalistas */
    background-image: radial-gradient(rgba(0, 0, 0, 0.06) 2px, transparent 2px);
    background-size: 24px 24px;
    color: var(--text-main);
    margin: 0; 
    padding: 40px 20px;
    display: flex; 
    flex-direction: column; 
    align-items: center;
    min-height: 100vh;
}

.container { width: 100%; max-width: 1100px; }

.main-title { 
    text-align: center;
    font-weight: 700;
    letter-spacing: -0.5px;
    font-size: 2.2rem;
    margin-bottom: 30px;
    color: var(--accent-dark);
    text-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

h2, h3 { font-weight: 600; margin-top: 0; letter-spacing: -0.3px; }

/* --- CONTENEDORES DE CRISTAL (AERO MODERNO) --- */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 2px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow), var(--glass-reflection);
    padding: 30px;
    margin-bottom: 30px;
    transition: var(--transition-smooth);
}

.glass-panel-inner {
    background: var(--glass-bg-solid);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 15px;
}

.settings-panel {
    background: var(--glass-bg-solid);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 15px 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
    transition: var(--transition-smooth);
}
.settings-panel:hover {
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    transform: translateY(-2px);
}

.accent-panel {
    border-left: 4px solid var(--accent-dark);
    background: linear-gradient(90deg, rgba(255,255,255,0.9) 0%, var(--glass-bg-solid) 100%);
}
.accent-text { color: var(--accent-dark); }

/* --- INPUTS Y CONTROLES --- */
label { 
    display: flex; 
    align-items: center; 
    margin-bottom: 10px; 
    cursor: pointer; 
    font-size: 14.5px;
    font-weight: 400;
}
input[type="radio"] { margin-right: 8px; transform: scale(1.1); }

.glass-input, textarea {
    background: rgba(255, 255, 255, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    color: var(--text-main);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
    transition: var(--transition-smooth);
    box-sizing: border-box;
}
.glass-input:focus, textarea:focus {
    outline: none;
    border-color: var(--text-muted);
    background: #fff;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02), 0 0 0 3px rgba(0,0,0,0.05);
}
.glass-input:disabled { opacity: 0.5; cursor: not-allowed; }

textarea { width: 100%; min-height: 120px; resize: vertical; line-height: 1.5; margin-top: 10px; }

/* Custom File Input */
.custom-file-input {
    width: 100%; margin: 15px 0; padding: 10px;
    background: var(--glass-bg-solid);
    border: 2px dashed #ccc;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-smooth);
}
.custom-file-input:hover { border-color: var(--text-main); background: rgba(255,255,255,0.9); }

/* --- LISTA DE ARCHIVOS --- */
.file-queue { margin-bottom: 20px; }
.file-queue ul { list-style: none; padding: 0; margin: 0; max-height: 200px; overflow-y: auto; }
.file-queue li { 
    display: flex; justify-content: space-between; align-items: center; 
    padding: 12px 15px; 
    border-bottom: 1px solid rgba(0,0,0,0.05); 
    font-size: 14px;
    background: var(--glass-bg-solid);
    margin-bottom: 5px;
    border-radius: var(--radius-sm);
}

/* --- BOTONES (AERO Y MODERNOS) --- */
button {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 14px;
    border-radius: var(--radius-md);
    padding: 12px 24px;
    cursor: pointer;
    transition: var(--transition-smooth);
    border: none;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    margin-right: 10px;
    margin-bottom: 10px;
}

button:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.1);
}
button:active:not(:disabled) { transform: translateY(0); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--accent-dark); color: #fff; }
.btn-primary:hover { background: #333; }

.btn-glass {
    background: var(--glass-bg-solid);
    color: var(--text-main);
    border: 2px solid var(--glass-border);
    backdrop-filter: blur(5px);
}
.btn-glass:hover { background: #fff; border-color: var(--text-muted); }

.btn-danger { background: var(--accent-red); color: #fff; }
.btn-danger:hover { background: #990000; }

.preview-btn { margin: 0; padding: 6px 12px; font-size: 12px; background: var(--text-muted); color: #fff; border-radius: var(--radius-sm); }
.preview-btn:hover { background: var(--accent-dark); }

/* Botones Variables Bivariadas */
.full-width { width: 100%; box-sizing: border-box; margin-bottom: 8px;}
.btn-x { background-color: var(--accent-blue); color: #fff; }
.btn-y { background-color: var(--accent-green); color: #fff; }

/* Botón Flotante */
.floating-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: rgba(17, 17, 17, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50px;
    padding: 15px 30px;
    font-size: 15px;
    z-index: 100;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    animation: bounceIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
.floating-btn:hover {
    background: var(--accent-dark);
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 35px rgba(0,0,0,0.3);
}
@keyframes bounceIn {
    0% { transform: translateY(100px) scale(0.5); opacity: 0; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* --- TABLAS (DISEÑO LIMPIO) --- */
table { width: 100%; border-collapse: separate; border-spacing: 0; margin-bottom: 30px; border-radius: var(--radius-md); overflow: hidden; box-shadow: 0 4px 15px rgba(0,0,0,0.03); }
th, td { padding: 12px 15px; text-align: center; border-bottom: 1px solid rgba(0,0,0,0.05); }
th { background-color: rgba(0,0,0,0.03); font-weight: 600; color: var(--text-main); font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px;}
tr { background-color: rgba(255,255,255,0.6); transition: background-color 0.2s; }
tr:hover { background-color: rgba(255,255,255,0.9); }
tr:last-child td { border-bottom: none; }

/* Tabla Cruzada (Bivariada) */
.cross-table th { background-color: rgba(0,0,0,0.05); border: 1px solid rgba(0,0,0,0.05); }
.cross-table td { border: 1px solid rgba(0,0,0,0.05); }
.cross-table .total-cell { font-weight: 700; background-color: rgba(0,0,0,0.02); }

/* --- CARRUSEL Y TARJETAS DE ESTADÍSTICAS --- */
.carousel-nav { display: flex; justify-content: space-between; align-items: center; padding: 15px 30px; border-radius: var(--radius-lg); margin-bottom: 20px;}
#carouselIndicator { font-weight: 700; letter-spacing: 1px; }

#resultsCarousel { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; gap: 40px; padding-bottom: 15px; }
.dataset-block { flex: 0 0 100%; scroll-snap-align: center; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; margin-bottom: 30px; }
.stat-card {
    background: var(--glass-bg-solid);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.02);
    transition: var(--transition-smooth);
}
.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.06);
}
.stat-card h3 { font-size: 14px; border-bottom: 2px solid rgba(0,0,0,0.05); padding-bottom: 10px; margin-bottom: 15px; text-transform: uppercase;}
.stat-row { display: flex; justify-content: space-between; margin-bottom: 10px; font-size: 14px; align-items: center; }

/* --- GRÁFICOS (AERO BOXES) --- */
.chart-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.chart-item {
    background: rgba(255,255,255,0.8);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 15px;
    height: 250px;
    display: flex; flex-direction: column; cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    transition: var(--transition-smooth);
}
.chart-item:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.08);
    background: #ffffff;
}
.chart-item h4 { text-align: center; text-transform: uppercase; font-size: 12px; color: var(--text-muted); border-bottom: 1px solid #eee; padding-bottom: 8px; margin-top: 0;}
.chart-canvas-wrapper { position: relative; flex-grow: 1; width: 100%; }

/* --- ACORDEÓN --- */
.chart-accordion { margin-top: 30px; width: 100%; }
.accordion-item { border: 1px solid var(--glass-border); border-radius: var(--radius-md); background: var(--glass-bg-solid); overflow: hidden; transition: var(--transition-smooth); box-shadow: 0 4px 10px rgba(0,0,0,0.02);}
.accordion-header {
    padding: 18px 20px; cursor: pointer; display: flex; justify-content: space-between; align-items: center;
    background: rgba(255,255,255,0.5); font-weight: 600; font-size: 14px; transition: background 0.2s;
}
.accordion-header:hover { background: rgba(255,255,255,0.9); }
.accordion-arrow { transition: transform 0.3s; font-size: 12px; }
.accordion-item.active .accordion-arrow { transform: rotate(180deg); }
.accordion-content { max-height: 0; overflow: hidden; transition: max-height 0.4s ease, padding 0.4s ease; padding: 0 20px; }
.accordion-item.active .accordion-content { max-height: 1000px; padding: 20px; border-top: 1px solid rgba(0,0,0,0.05); }

/* --- MODALES Y PIZARRA INTERACTIVA --- */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.4); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); z-index: 1000; display: flex; justify-content: center; align-items: center; }
.modal-content { 
    background: rgba(245, 247, 250, 0.95); 
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    width: 95%; max-width: 1300px; height: 90vh; 
    border: 1px solid rgba(255,255,255,0.8); 
    border-radius: var(--radius-lg); padding: 25px; 
    display: flex; flex-direction: column; 
    box-shadow: 0 25px 50px rgba(0,0,0,0.15);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid rgba(0,0,0,0.05); margin-bottom: 15px; padding-bottom: 10px;}
.close-btn { font-size: 28px; color: var(--text-muted); cursor: pointer; transition: color 0.2s;}
.close-btn:hover { color: var(--accent-red); }

.modal-instructions { margin-bottom: 5px; font-size: 14.5px;}
.modal-tip { font-size: 13px; color: var(--text-muted); margin-top: 0; margin-bottom: 15px; }

.bivariate-grid { display: flex; gap: 15px; flex-wrap: wrap; margin-bottom: 15px;}
.bivariate-box { flex: 1; min-width: 250px; padding: 15px; border-radius: var(--radius-md); background: rgba(255,255,255,0.7); border: 2px solid transparent;}
.box-x { border-color: rgba(0, 68, 204, 0.3); }
.box-y { border-color: rgba(0, 136, 0, 0.3); }
.data-count { font-size: 13px; font-weight: 600; margin-top: 8px; color: var(--text-muted);}

.table-glass-container { 
    flex-grow: 1; overflow: auto; 
    background: #fff; border-radius: var(--radius-md); 
    border: 1px solid rgba(0,0,0,0.1); 
    position: relative; user-select: none; 
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.02);
}
.table-glass-container table { width: max-content; margin: 0; box-shadow: none; border-radius: 0;}
.table-glass-container td, .table-glass-container th { padding: 8px 12px; min-width: 50px; cursor: cell; border-right: 1px solid rgba(0,0,0,0.05);}

/* Colores de Selección */
.cell-selected { background-color: rgba(0,0,0,0.1) !important; font-weight: 600; }
.cell-saved { background-color: var(--text-main) !important; color: #fff !important; }
.cell-saved-x { background-color: var(--accent-blue) !important; color: #fff !important; font-weight: 600; }
.cell-saved-y { background-color: var(--accent-green) !important; color: #fff !important; font-weight: 600; }

.range-badge { font-weight: 600; color: var(--text-muted); font-size: 14px; background: rgba(0,0,0,0.05); padding: 6px 12px; border-radius: 20px;}

/* --- MODAL DE PROCEDIMIENTO (CUADERNO DE NOTAS MODERNO) --- */
.procedure-body { flex-grow: 1; overflow-y: auto; padding: 10px 20px; font-size: 15px; line-height: 1.6; }
.procedure-step { margin-bottom: 30px; padding-bottom: 20px; border-bottom: 1px dashed rgba(0,0,0,0.1); }
.procedure-step h3 { color: var(--accent-dark); border-bottom: 2px solid var(--accent-dark); display: inline-block; padding-bottom: 5px; }
.math-formula {
    background: rgba(255,255,255,0.8);
    border-left: 4px solid var(--accent-dark);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    padding: 15px; margin: 10px 0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14.5px; overflow-x: auto;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}
.math-highlight { font-weight: bold; color: var(--accent-red); }

/* --- TOOLTIPS MODERNOS --- */
.tooltip { position: relative; display: inline-block; border-bottom: 1px dotted var(--text-muted); cursor: help; }
.tooltip .tooltiptext {
    visibility: hidden; width: max-content; max-width: 280px;
    background-color: rgba(17, 17, 17, 0.9); color: #fff; text-align: center;
    border-radius: var(--radius-sm); padding: 10px 14px; position: absolute;
    z-index: 10; bottom: 130%; left: 50%; transform: translateX(-50%);
    opacity: 0; transition: opacity 0.3s;
    font-family: 'Inter', sans-serif; font-size: 12px; font-weight: normal; letter-spacing: 0;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
.tooltip .tooltiptext::after { content: ""; position: absolute; top: 100%; left: 50%; margin-left: -6px; border-width: 6px; border-style: solid; border-color: rgba(17, 17, 17, 0.9) transparent transparent transparent; }
.tooltip:hover .tooltiptext { visibility: visible; opacity: 1; }

/* Utilidades */
.hidden { display: none !important; }
.mt-15 { margin-top: 15px; }
.ml-15 { margin-left: 15px; }

/* Custom Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,0.02); border-radius: 10px;}
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.3); }