/* ==========================================================================
   ESTILOS GLOBALES - TEMA OSCURO DE ALTA VISIBILIDAD (RISEUP DASHBOARDS)
   ========================================================================== */

/* --- 1. FONDO GLOBAL Y RESET --- */
html, body {
    background-color: #0b0e14 !important;
    color: #f8fafc !important;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

#_dash-app-content, 
#page-content, 
.dash-page-container,
.container, 
.container-fluid {
    background-color: #0b0e14 !important;
    color: #f8fafc !important;
}

/* --- 2. SIDEBAR Y NAVEGACIÓN --- */
#sidebar-dinamico {
    background-color: #000000 !important;
    border-right: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.accordion-button {
    background-color: transparent !important;
    color: #f8fafc !important;
    box-shadow: none !important;
}

.accordion-button:not(.collapsed) {
    background-color: rgba(255, 255, 255, 0.05) !important;
    color: #38bdf8 !important;
}

.accordion-item {
    background-color: transparent !important;
    border: none !important;
}

.accordion-button::after {
    filter: invert(1) grayscale(100%) brightness(200%);
}

.nav-link:focus { 
    outline: none; 
    box-shadow: none; 
}

/* --- 3. TARJETAS (CARDS) Y CONTENEDORES --- */
.card, .card-body {
    background-color: #111827 !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #f8fafc !important;
    border-radius: 12px;
}

/* Contenedores con estilos inline transparentes en las páginas */
div[style*="background-color: rgba(255, 255, 255, 0.05)"],
div[style*="backgroundColor: rgba(255, 255, 255, 0.05)"] {
    background-color: #111827 !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3) !important;
}

/* --- 4. TEXTOS, FORMULAS Y MARKDOWN --- */
h1, h2, h3, h4, h5, h6 {
    color: #38bdf8;
    font-weight: 700;
}

p, span, label, li {
    color: #e2e8f0;
}

.text-muted {
    color: #94a3b8 !important;
}

/* Markdown en Dash (Teoría, Explicaciones, Listas) */
.dash-markdown {
    color: #f1f5f9 !important;
}

.dash-markdown h1,
.dash-markdown h2,
.dash-markdown h3,
.dash-markdown h4 {
    color: #38bdf8 !important;
    margin-top: 15px;
    margin-bottom: 10px;
}

.dash-markdown p,
.dash-markdown li,
.dash-markdown span,
.dash-markdown div {
    color: #e2e8f0 !important;
    line-height: 1.6;
}

.dash-markdown strong,
.dash-markdown b {
    color: #ffffff !important;
    font-weight: 700;
}

.dash-markdown code {
    background-color: rgba(56, 189, 248, 0.15) !important;
    color: #38bdf8 !important;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}

.dash-markdown blockquote {
    border-left: 4px solid #38bdf8 !important;
    background: rgba(56, 189, 248, 0.05) !important;
    color: #cbd5e1 !important;
    padding: 10px 15px;
    border-radius: 0 8px 8px 0;
}

/* Soporte para KaTeX / Fórmulas Matemáticas */
.katex, .katex-display, .katex-html {
    color: #f8fafc !important;
}

/* --- 5. TABS / PESTAÑAS (dcc.Tabs y dbc.Tabs) --- */
.nav-tabs {
    border-bottom: 1px solid rgba(255, 255, 255, 0.15) !important;
}

.nav-tabs .nav-link {
    color: #94a3b8 !important;
    background-color: transparent !important;
    border: 1px solid transparent !important;
}

.nav-tabs .nav-link.active {
    background-color: rgba(56, 189, 248, 0.15) !important;
    color: #38bdf8 !important;
    border-color: rgba(56, 189, 248, 0.3) !important;
    border-bottom-color: transparent !important;
}

/* dcc.Tab nativo */
.tab {
    background-color: #161e2e !important;
    color: #94a3b8 !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.tab--selected {
    background-color: #0284c7 !important;
    color: #ffffff !important;
    border: 1px solid #38bdf8 !important;
}

/* --- 6. CONTROLES: DROPDOWNS, INPUTS, BOTONES --- */
/* Dropdowns de Dash (react-select) */
.Select-control {
    background-color: #1e293b !important;
    border: 1px solid #334155 !important;
    color: #ffffff !important;
    border-radius: 8px !important;
    min-height: 42px;
}

.Select-value-label, 
.Select-placeholder, 
.Select-value {
    color: #f8fafc !important;
    line-height: 40px !important;
}

.Select-input > input {
    color: #ffffff !important;
}

.Select-menu-outer {
    background-color: #1e293b !important;
    border: 1px solid #334155 !important;
    color: #ffffff !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6) !important;
    z-index: 9999 !important;
}

.Select-option {
    background-color: #1e293b !important;
    color: #e2e8f0 !important;
    padding: 10px 15px !important;
}

.Select-option:hover, 
.Select-option.is-focused {
    background-color: #0284c7 !important;
    color: #ffffff !important;
}

.Select-arrow {
    border-color: #94a3b8 transparent transparent !important;
}

/* Inputs numéricos y de texto */
input[type="text"], 
input[type="number"], 
select, 
textarea {
    background-color: #1e293b !important;
    color: #ffffff !important;
    border: 1px solid #334155 !important;
    border-radius: 6px;
    padding: 6px 12px;
}

input[type="text"]:focus, 
input[type="number"]:focus, 
select:focus, 
textarea:focus {
    border-color: #38bdf8 !important;
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2) !important;
}

/* Sliders (dcc.Slider) */
.rc-slider-rail {
    background-color: #334155 !important;
}
.rc-slider-track {
    background-color: #38bdf8 !important;
}
.rc-slider-handle {
    border-color: #38bdf8 !important;
    background-color: #0b0e14 !important;
}
.rc-slider-mark-text {
    color: #94a3b8 !important;
}

/* Botones */
.btn-primary {
    background-color: #0284c7 !important;
    border-color: #0284c7 !important;
    color: #ffffff !important;
}
.btn-primary:hover {
    background-color: #0369a1 !important;
    border-color: #0369a1 !important;
}

.btn-dark {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}
.btn-dark:hover {
    background-color: #334155 !important;
    border-color: #475569 !important;
}

/* --- 7. TABLAS --- */
table, .table {
    color: #f1f5f9 !important;
    background-color: transparent !important;
}

.table th, .table td {
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: #f1f5f9 !important;
    background-color: transparent !important;
}

/* --- 8. GRAFICOS PLOTLY --- */
.js-plotly-plot, .plot-container {
    background-color: transparent !important;
}

.js-plotly-plot .plotly .main-svg {
    background-color: transparent !important;
}

.js-plotly-plot .plotly .bg {
    fill: transparent !important;
}

.js-plotly-plot .plotly text {
    fill: #e2e8f0 !important;
}
