/**
 * Estilos para Reporte ECU
 * Asegurar que no interfieran con base.php
 */

/* Ocultar scrollbar en el body y html cuando está en reporte-ecu */
html:has(body.app.reporte-ecu-page),
html body.app.reporte-ecu-page {
    overflow-x: hidden !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

html:has(body.app.reporte-ecu-page)::-webkit-scrollbar,
html body.app.reporte-ecu-page::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    background: transparent !important;
}

body.app.reporte-ecu-page {
    overflow-x: hidden !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

body.app.reporte-ecu-page #mainContent .container-fluid {
    padding: 20px;
    background: transparent !important;
}

/* Ocultar scrollbars - Vista general y contenedores principales con máxima especificidad */
html body.app.reporte-ecu-page .page-container,
html body.app.reporte-ecu-page .main-content,
html body.app.reporte-ecu-page #mainContent,
body.app.reporte-ecu-page .page-container,
body.app.reporte-ecu-page .main-content,
body.app.reporte-ecu-page #mainContent {
    scrollbar-width: none !important; /* Firefox */
    -ms-overflow-style: none !important; /* IE y Edge */
    overflow-y: auto !important; /* Mantener funcionalidad */
    overflow-x: hidden !important;
}

html body.app.reporte-ecu-page .page-container::-webkit-scrollbar,
html body.app.reporte-ecu-page .main-content::-webkit-scrollbar,
html body.app.reporte-ecu-page #mainContent::-webkit-scrollbar,
body.app.reporte-ecu-page .page-container::-webkit-scrollbar,
body.app.reporte-ecu-page .main-content::-webkit-scrollbar,
body.app.reporte-ecu-page #mainContent::-webkit-scrollbar {
    display: none !important; /* Chrome, Safari, Opera */
    width: 0 !important;
    height: 0 !important;
    background: transparent !important;
}

/* Ocultar scrollbars en todos los elementos hijos pero mantener funcionalidad */
body.app.reporte-ecu-page * {
    scrollbar-width: none !important; /* Firefox */
    -ms-overflow-style: none !important; /* IE y Edge */
}

body.app.reporte-ecu-page *::-webkit-scrollbar {
    display: none !important; /* Chrome, Safari, Opera */
    width: 0 !important;
    height: 0 !important;
    background: transparent !important;
}

/* Excepciones: mantener scrollbar funcional solo en contenedores específicos que lo necesiten */
body.app.reporte-ecu-page .placas-list::-webkit-scrollbar,
body.app.reporte-ecu-page select[size]::-webkit-scrollbar {
    display: block !important;
    width: 6px !important;
    background: transparent !important;
}

/* Estilos para las tarjetas */
body.app.reporte-ecu-page .card {
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

body.app.reporte-ecu-page .card-header {
    background: white;
    color: #333;
    border: 1px solid #000;
    border-bottom: 2px solid #000;
    border-radius: 8px 8px 0 0;
    padding: 15px 20px;
}

body.app.reporte-ecu-page .card-header h4 {
    margin: 0;
    font-weight: 600;
}

body.app.reporte-ecu-page .card-body {
    padding: 20px;
}

/* Estilos para formularios */
body.app.reporte-ecu-page .form-label {
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

body.app.reporte-ecu-page .form-control {
    border-radius: 6px;
    border: 1px solid #ddd;
    padding: 10px 15px;
    transition: all 0.3s ease;
}

body.app.reporte-ecu-page .form-control:focus {
    border-color: #4299e1;
    box-shadow: 0 0 0 0.2rem rgba(66, 153, 225, 0.25);
}

body.app.reporte-ecu-page .input-group .form-control {
    border-radius: 0;
}

body.app.reporte-ecu-page .input-group .form-control:first-child {
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
}

body.app.reporte-ecu-page .input-group .form-control:last-child {
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
}

/* Botones */
body.app.reporte-ecu-page .btn-primary {
    background: linear-gradient(135deg, #4299e1 0%, #2b6cb0 100%);
    border: none;
    border-radius: 6px;
    padding: 10px 20px;
    font-weight: 600;
    transition: all 0.3s ease;
}

body.app.reporte-ecu-page .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(66, 153, 225, 0.3);
}

/* Contenedores de gráficas */
body.app.reporte-ecu-page .grafica-container {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    min-height: 400px;
}

/* Alertas */
body.app.reporte-ecu-page .alert {
    border-radius: 6px;
    padding: 15px 20px;
    margin-bottom: 20px;
}

/* Modo oscuro */
body.app.reporte-ecu-page.dark-mode .card,
[data-theme="dark"] body.app.reporte-ecu-page .card {
    background: #20232a !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

body.app.reporte-ecu-page.dark-mode .card-header,
[data-theme="dark"] body.app.reporte-ecu-page .card-header {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    border-bottom: 1px solid #4a5568;
}

body.app.reporte-ecu-page.dark-mode .form-control {
    background: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
}

body.app.reporte-ecu-page.dark-mode .form-label {
    color: #e2e8f0;
}

body.app.reporte-ecu-page.dark-mode .grafica-container,
[data-theme="dark"] body.app.reporte-ecu-page .grafica-container {
    background: #20232a !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

body.app.reporte-ecu-page.dark-mode .alert {
    background: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
}

/* Estilos para Opción C: Layout Compacto */
body.app.reporte-ecu-page .card-body h6 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

[data-theme="dark"] body.app.reporte-ecu-page .card-body h6 {
    color: #a0aec0;
}

body.app.reporte-ecu-page .card-body h6 i {
    color: #4299e1;
    margin-right: 0.5rem;
}

[data-theme="dark"] body.app.reporte-ecu-page .card-body h6 i {
    color: #63b3ed;
}

/* Form controls más compactos */
body.app.reporte-ecu-page .form-control-sm {
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
}

body.app.reporte-ecu-page .form-label.small {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

/* Input groups compactos */
body.app.reporte-ecu-page .input-group-sm .form-control {
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
}

/* Selector múltiple más compacto */
body.app.reporte-ecu-page #y_axes {
    min-height: 300px;
    font-size: 0.875rem;
}

/* Botón más compacto */
body.app.reporte-ecu-page .btn-sm {
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
}

/* Selector múltiple más grande en columna derecha */
body.app.reporte-ecu-page #y_axes {
    min-height: 400px;
}

/* Grid moderno de variables (flex para centrar última fila) */
.variables-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    padding: 10px 0;
    justify-content: center;
}

.variables-grid .variable-card {
    flex: 0 1 210px;
}

/* Lista moderna para selección de placas */
.placas-list {
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

[data-theme="dark"] .placas-list {
    border-color: #2d3748;
    background: rgba(255, 255, 255, 0.05);
}

.placas-empty {
    text-align: center;
    padding: 20px 10px;
    color: #718096;
    font-size: 0.9rem;
}

[data-theme="dark"] .placas-empty {
    color: #a0aec0;
}

.placa-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(99, 179, 237, 0.08);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #2d3748;
    font-weight: 500;
}

.placa-item:hover {
    border-color: #4299e1;
    background: rgba(66, 153, 225, 0.08);
}

[data-theme="dark"] .placa-item {
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.04);
}

[data-theme="dark"] .placa-item:hover {
    background: rgba(66, 153, 225, 0.08);
}

.placa-item.checked {
    border-color: #3182ce;
    background: rgba(49, 130, 206, 0.12);
}

[data-theme="dark"] .placa-item.checked {
    background: rgba(66, 153, 225, 0.15);
}

[data-theme="dark"] .placa-item {
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.04);
}

.placa-item input[type="checkbox"] {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #cbd5f5;
    border-radius: 4px;
    background: transparent;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
}

[data-theme="dark"] .placa-item input[type="checkbox"] {
    border-color: #4a5568;
}

.placa-item input[type="checkbox"]:checked {
    border-color: #63b3ed;
    background: #63b3ed;
}

.placa-item input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.placa-item .placa-label {
    flex: 1;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
}

[data-theme="dark"] .placa-item .placa-label {
    color: #e2e8f0;
}

.placas-list::-webkit-scrollbar {
    width: 6px;
}

.placas-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}

.placas-list::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #63b3ed 0%, #3182ce 100%);
    border-radius: 10px;
}

[data-theme="dark"] .placas-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.placas-list::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #90cdf4 0%, #63b3ed 100%);
}

.variable-card {
    position: relative;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-height: 120px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.variable-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
    border-color: #4299e1;
}

.variable-card.selected {
    border-color: #4299e1;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.3);
}

.variable-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    color: white;
    font-size: 24px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.variable-content {
    flex: 1;
    width: 100%;
}

.variable-name {
    font-weight: 600;
    font-size: 14px;
    color: #1a202c;
    margin-bottom: 4px;
}

.variable-unit {
    font-size: 11px;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.variable-check {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #4299e1;
    color: white;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    box-shadow: 0 2px 4px rgba(66, 153, 225, 0.4);
}

.variable-card.selected .variable-check {
    display: flex;
}

/* Modo oscuro */
[data-theme="dark"] .variable-card {
    background: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
}

[data-theme="dark"] .variable-card:hover {
    border-color: #4299e1;
    background: #2d3748;
}

[data-theme="dark"] .variable-card.selected {
    background: linear-gradient(135deg, #1e3a5f 0%, #2d4a6f 100%);
    border-color: #4299e1;
}

[data-theme="dark"] .variable-name {
    color: #e2e8f0;
}

[data-theme="dark"] .variable-unit {
    color: #a0aec0;
}

/* Responsive */
@media (max-width: 768px) {
    .variables-grid {
        gap: 10px;
    }
    
    .variables-grid .variable-card {
        flex: 1 1 calc(50% - 10px);
        min-width: 150px;
    }
    
    .variable-card {
        min-height: 100px;
        padding: 12px;
    }
    
    .variable-icon {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
}

/* Responsive */
@media (max-width: 768px) {
    body.app.reporte-ecu-page #mainContent .container-fluid {
        padding: 10px;
    }
    
    body.app.reporte-ecu-page .card-body {
        padding: 15px;
    }
    
    body.app.reporte-ecu-page .grafica-container {
        padding: 15px;
        min-height: 300px;
    }
    
    body.app.reporte-ecu-page #y_axes {
        min-height: 300px;
    }
}

/* Estilos adicionales para tema oscuro - controles de formulario */
[data-theme="dark"] body.app.reporte-ecu-page .form-control {
    background-color: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
}

[data-theme="dark"] body.app.reporte-ecu-page .form-control:focus {
    background-color: #2d3748;
    border-color: #4299e1;
    color: #e2e8f0;
}

[data-theme="dark"] body.app.reporte-ecu-page .form-control::placeholder {
    color: #a0aec0;
}

[data-theme="dark"] body.app.reporte-ecu-page select.form-control[size] {
    background-color: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
}

[data-theme="dark"] body.app.reporte-ecu-page select.form-control option {
    background-color: #2d3748;
    color: #e2e8f0;
}

[data-theme="dark"] body.app.reporte-ecu-page select.form-control option:checked {
    background-color: #4299e1;
    color: #ffffff;
}

[data-theme="dark"] body.app.reporte-ecu-page .form-label {
    color: #e2e8f0;
}

[data-theme="dark"] body.app.reporte-ecu-page .form-label small {
    color: #a0aec0;
}

[data-theme="dark"] body.app.reporte-ecu-page .card {
    background-color: #20232a !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

[data-theme="dark"] body.app.reporte-ecu-page .card-body {
    background-color: #20232a !important;
    color: #e2e8f0 !important;
}

[data-theme="dark"] body.app.reporte-ecu-page .btn-primary {
    background-color: #4299e1;
    border-color: #4299e1;
    color: #ffffff;
}

[data-theme="dark"] body.app.reporte-ecu-page .btn-primary:hover {
    background-color: #3182ce;
    border-color: #3182ce;
}

[data-theme="dark"] body.app.reporte-ecu-page .alert {
    background-color: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
}

[data-theme="dark"] body.app.reporte-ecu-page .alert-warning {
    background-color: #744210;
    border-color: #975a16;
    color: #fbd38d;
}

[data-theme="dark"] body.app.reporte-ecu-page .alert-danger {
    background-color: #742a2a;
    border-color: #9b2c2c;
    color: #fc8181;
}

[data-theme="dark"] body.app.reporte-ecu-page .alert-info {
    background-color: #2c5282;
    border-color: #2b6cb0;
    color: #90cdf4;
}

[data-theme="dark"] body.app.reporte-ecu-page .grafica-container {
    background-color: #20232a !important;
}

/* Estilos para el selector múltiple */
[data-theme="dark"] body.app.reporte-ecu-page select.form-control[size]::-webkit-scrollbar {
    width: 8px;
}

[data-theme="dark"] body.app.reporte-ecu-page select.form-control[size]::-webkit-scrollbar-track {
    background: #2d3748;
}

[data-theme="dark"] body.app.reporte-ecu-page select.form-control[size]::-webkit-scrollbar-thumb {
    background: #4a5568;
    border-radius: 4px;
}

[data-theme="dark"] body.app.reporte-ecu-page select.form-control[size]::-webkit-scrollbar-thumb:hover {
    background: #718096;
}

/* Estilos para inputs de fecha y hora */
[data-theme="dark"] body.app.reporte-ecu-page input[type="date"],
[data-theme="dark"] body.app.reporte-ecu-page input[type="time"] {
    background-color: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
}

[data-theme="dark"] body.app.reporte-ecu-page input[type="date"]:focus,
[data-theme="dark"] body.app.reporte-ecu-page input[type="time"]:focus {
    background-color: #2d3748;
    border-color: #4299e1;
    color: #e2e8f0;
}

/* Estilos para selects normales */
[data-theme="dark"] body.app.reporte-ecu-page select.form-control:not([size]) {
    background-color: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
}

[data-theme="dark"] body.app.reporte-ecu-page select.form-control:not([size]):focus {
    background-color: #2d3748;
    border-color: #4299e1;
    color: #e2e8f0;
}

/* Estilos para input-group */
[data-theme="dark"] body.app.reporte-ecu-page .input-group .form-control {
    background-color: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
}

[data-theme="dark"] body.app.reporte-ecu-page .input-group .form-control:focus {
    background-color: #2d3748;
    border-color: #4299e1;
    color: #e2e8f0;
}

/* Estilos para el texto de ayuda */
[data-theme="dark"] body.app.reporte-ecu-page .text-muted {
    color: #a0aec0 !important;
}

[data-theme="dark"] body.app.reporte-ecu-page .text-danger {
    color: #fc8181 !important;
}

/* Estilos para el spinner de carga */
[data-theme="dark"] body.app.reporte-ecu-page .fa-spinner {
    color: #4299e1;
}

/* Estilos para el contenedor de la gráfica */
[data-theme="dark"] body.app.reporte-ecu-page #plotlyChart {
    background-color: #1a202c;
}

/* Estilos para tabs en modo oscuro */
[data-theme="dark"] body.app.reporte-ecu-page #plotlyChart .tab-container {
    background-color: #1a202c !important;
    border-color: #4a5568 !important;
}

[data-theme="dark"] body.app.reporte-ecu-page #plotlyChart .tabcontent {
    background-color: #1a202c !important;
}

[data-theme="dark"] body.app.reporte-ecu-page #plotlyChart .graph-container {
    background-color: #1a202c !important;
}

/* Ocultar solo el logo/enlace de Plotly (último grupo del modebar) */
body.app.reporte-ecu-page #plotlyChart .plotly .modebar .modebar-group:last-child a[href*="plotly.com"],
body.app.reporte-ecu-page #plotlyChart .plotly .modebar .modebar-group:last-child a[href*="plot.ly"],
body.app.reporte-ecu-page #plotlyChart .plotly .modebar .modebar-group:last-child {
    display: none !important;
}

