
/* ============================================================ */
/* 1. MENSAJES                                                  */
/* ============================================================ */
.mensaje {
    padding: 10px;
    margin: 10px 0;
    border-radius: 4px;
}
.exito { background-color: #d4edda; color: #155724; }
.error { background-color: #f8d7da; color: #721c24; }

.mensaje-inicial {
    background: #fff3cd; border-left: 4px solid #ffc107;
    padding: 10px 15px; border-radius: 6px; margin: 10px 0;
    color: #856404; font-weight: bold;
}

.alert-info {
    background-color: #e7f5ff;
    color: #0c63e4;
    padding: 10px;
    border-radius: 4px;
}

/* ============================================================ */
/* 2. BOTÓN ATRÁS Y RECARGAR                                    */
/* ============================================================ */
.btn-atras {
    position: fixed; top: 10px; left: 10px;
    background: #ff9800; color: white;
    padding: 10px 18px; border-radius: 30px;
    text-decoration: none; font-size: 14px; font-weight: bold;
    font-family: sans-serif; transition: all 0.2s;
    z-index: 9999; box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.btn-atras:hover {
    background: #e68900;
    transform: scale(1.05);
    color: white;
}

.btn-recargar {
    display: inline-block; margin-top: 6px;
    background: #ff9800; color: white;
    padding: 8px 16px; border-radius: 20px;
    text-decoration: none; font-weight: bold; font-size: 14px;
    transition: all 0.2s;
}
.btn-recargar:hover {
    background: #e68900;
    transform: scale(1.05);
    color: white;
}

/* ============================================================ */
/* 3. GRUPO DE ACCIÓN / FILTROS                                 */
/* ============================================================ */
.grupo-accion {
    width: 100%;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #f9f9f9;
}

/* Tabla de filtros: scroll horizontal si no entra */
.grupo-accion table {
    border-collapse: separate;
    border-spacing: 10px 8px;
    width: 100%;
    margin: 0 0 10px 0;
    table-layout: auto;
}

.grupo-accion td {
    padding: 0;
    text-align: left;
    vertical-align: top;
}

/* Botones SOLO dentro de grupo-accion */
.grupo-accion button {
    cursor: pointer;
    font-weight: bold;
    border: none;
    border-radius: 4px;
}

/* Asegurar que .consultar gane sobre .grupo-accion button */
.grupo-accion button.consultar {
    padding: 10px 50px;
    background-color: #17a2b8;
    color: white;
    font-size: 15px;
    transition: all 0.2s;
}
.grupo-accion button.consultar:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
.grupo-accion button.consultar:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Label solo dentro de grupo-accion */
.grupo-accion label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.grupo-accion input:not([type="checkbox"]),
.grupo-accion textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* ============================================================ */
/* 4. CELDA DE FILTRO (tdConsul)                                */
/* ============================================================ */
.tdConsul {
    background-color: #ffffff;
    padding: 12px !important;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    vertical-align: top;
    min-width: 130px;
    font-size: 14px;
    font-weight: 600;
    color: #4a5568;
    text-align: left;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.tdConsul:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.tdConsul select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background-color: #f8fafc;
    color: #1a202c;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    margin-top: 6px;
}
.tdConsul select:hover {
    border-color: #cbd5e1;
    background-color: #f1f5f9;
}
.tdConsul select:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66,153,225,0.2);
    background-color: #fff;
}

/* ============================================================ */
/* 5. CELDA DE OPERADOR/VALOR + BOTONES (tdConsulMas)           */
/*    -> Es una <td> normal que contiene 2 selects y los botones */
/*       en una fila separada. NO usar display:flex aquí.        */
/* ============================================================ */
.tdConsulMas {
    padding: 12px !important;
    background: linear-gradient(to right, #b9d3eb, #109a27);
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    vertical-align: middle; /* Mejor que top para alinear con los botones */
    text-align: center;
}

.tdConsulMas select {
    padding: 8px 12px;
    border: 1px solid rgba(255,255,255,0.5);
    border-radius: 5px;
    background-color: #ffffff;
    color: #333;
    font-size: 13px;
    cursor: pointer;
    min-width: 100px;
    margin: 0 4px;
}
.tdConsulMas select:hover {
    background-color: rgba(255,255,255,1);
    border-color: rgba(255,255,255,0.8);
}
.tdConsulMas select:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.6);
    background-color: #fff;
}

/* ============================================================ */
/* 6. BOTONES CONSULTAR / GRAFICAR (fallback fuera de grupo)   */
/* ============================================================ */
.consultar {
    padding: 10px 50px;
    background-color: #17a2b8;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}
.consultar:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
.consultar:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ============================================================ */
/* 7. CHECKBOX PROMEDIAR                                        */
/* ============================================================ */
.promediar-checkbox {
    margin-left: 15px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f5f5f5;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
}
.promediar-checkbox input {
    width: 18px; height: 18px;
    cursor: pointer;
    margin: 0;
}
.promediar-checkbox label {
    margin: 0;
    cursor: pointer;
    font-weight: normal;
    display: inline;
}

/* ============================================================ */
/* 8. RESULTADOS Y TABLA DE LA CONSULTA                         */
/* ============================================================ */
.resultado-container {
    margin-top: 20px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #f9f9f9;
    min-height: 60px;
    color: #666;
}
.resultado-consulta .table {
    margin-bottom: 0;
    font-size: 13px;
}
.resultado-consulta .table th {
    background: #4CAF50;
    color: white;
    font-weight: 600;
    cursor: default;
}
.resultado-consulta .table th:hover { background: #4CAF50; }

.table-responsive {
    max-height: 500px;
    overflow-y: auto;
    margin-bottom: 15px;
}

/* ============================================================ */
/* 9. MODAL FLOTANTE                                            */
/* ============================================================ */
.floating-modal {
    position: fixed; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 90%; max-width: 1200px; height: 85vh;
    background: white; border-radius: 15px;
    box-shadow: 0 10px 50px rgba(0,0,0,0.3);
    z-index: 9999; display: none; overflow: hidden;
    animation: modalAppear 0.3s ease-out;
}
@keyframes modalAppear {
    from { opacity: 0; transform: translate(-50%, -60%) scale(0.9); }
    to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.modal-header {
    background: linear-gradient(135deg, #4CAF50, #2E7D32);
    color: white; padding: 10px 20px;
    border-radius: 15px 15px 0 0;
    display: flex; justify-content: space-between; align-items: center;
}
.modal-header h3 {
    margin: 0; font-size: 2.4rem;
    color: black; font-weight: bold;
}

.close-modal {
    background: rgba(255,255,255,0.2);
    border: none; color: white;
    width: 40px; height: 40px;
    border-radius: 50%; font-size: 1.5rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.3s;
}
.close-modal:hover {
    background: rgba(255,255,255,0.3);
    transform: rotate(90deg);
}

.modal-body {
    height: calc(100% - 70px);
    padding: 2px; overflow-y: auto;
}

.modal-overlay {
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
    z-index: 9998; display: none;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ============================================================ */
/* 10. GRÁFICO Y CONTROLES                                      */
/* ============================================================ */
.chart-container {
    width: 100%; height: 400px;
    border: 1px solid #e0e0e0; border-radius: 10px;
    padding: 10px; margin-bottom: 20px;
    position: relative;
}

.controls-bar {
    background: #f1f8e9; padding: 10px;
    border-radius: 8px; margin-bottom: 10px;
    display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
}
.control-btn {
    padding: 4px 8px;
    background: #4CAF50; color: white;
    border: none; border-radius: 3px;
    cursor: pointer; transition: all 0.3s;
}
.control-btn:hover {
    background: #45a049;
    transform: translateY(-2px);
}
.control-btn[onclick*="changeChartType"] {
    min-width: 120px !important;
    padding: 4px 8px !important;
    font-size: 1.1rem !important;
}

/* ============================================================ */
/* 11. TARJETAS DE ESTADÍSTICAS                                 */
/* ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px; margin-bottom: 10px;
}
.stat-card {
    background: #f8f9fa; padding: 8px 12px;
    border-radius: 8px; border-left: 4px solid #4CAF50;
}
.stat-card h4 {
    margin: 0 0 5px 0; color: #555;
    font-size: 0.9rem; text-transform: uppercase;
}
.stat-value {
    font-size: 1.8rem; font-weight: bold;
    color: #2E7D32;
}

/* ============================================================ */
/* 12. INFO DE SELECCIÓN EN EL GRÁFICO                          */
/* ============================================================ */
.selection-info {
    position: absolute; top: 10px; left: 10px;
    background: rgba(33,150,243,0.1);
    padding: 12px 25px;
    border-radius: 20px;
    border-left: 4px solid #2196F3;
    font-size: 1.1rem; color: #0d47a1;
    z-index: 100;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    backdrop-filter: blur(5px);
    font-weight: bold; line-height: 1.6;
}
.selection-info .info-principal { font-size: 1.2rem; font-weight: bold; }
.selection-info .info-secundaria { font-size: 1rem; font-weight: normal; opacity: 0.85; }
.selection-info .info-advertencia { font-size: 1rem; font-weight: bold; color: #FF6B6B; }
.selection-info .numero-destacado { font-size: 1.3rem; font-weight: bold; color: #1565C0; }

/* ============================================================ */
/* 13. SPINNER                                                  */
/* ============================================================ */
.spinner-border {
    vertical-align: middle;
    margin-right: 5px;
}

/* ============================================================ */
/* 14. TOOLTIP amCharts                                         */
/* ============================================================ */
.amcharts-tooltip {
    background-color: #000000 !important;
    color: #ffffff !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    font-weight: bold !important;
}