:root {
    --primary-color: #3498db;
    --secondary-color: #2c3e50;
    --success-color: #2ecc71;
    --error-color: #e74c3c;
    --warning-color: #f39c12;
    --light-gray: #ecf0f1;
    --dark-gray: #7f8c8d;
    --white: #ffffff;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-header {
    text-align: center;
    margin-bottom: 2rem;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.app-logo {
    height: 50px;
    width: auto;
}

.app-header h1 {
    color: var(--secondary-color);
    font-size: 2rem;
    font-weight: 700;
}

.app-tagline {
    color: var(--dark-gray);
    font-size: 1rem;
    font-weight: 300;
}

.main-content {
    flex: 1;
}

.upload-card {
    background: var(--white);
    border-radius: 10px;
    padding: 2rem;
    box-shadow: var(--box-shadow);
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.card-header i {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.card-header h2 {
    color: var(--secondary-color);
    font-size: 1.5rem;
}

.alert {
    padding: 1rem;
    border-radius: 5px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert.error {
    background-color: #fdecea;
    color: var(--error-color);
    border-left: 4px solid var(--error-color);
}

.alert.success {
    background-color: #e8f5e9;
    color: var(--success-color);
    border-left: 4px solid var(--success-color);
}

.alert i {
    font-size: 1.25rem;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--success-color);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 5px;
    text-decoration: none;
    margin-top: 1rem;
    transition: all 0.3s;
    font-weight: 500;
}

.download-btn:hover {
    background-color: #27ae60;
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.upload-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.file-input-container {
    position: relative;
}

.file-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    border: 2px dashed var(--primary-color);
    border-radius: 8px;
    background-color: rgba(52, 152, 219, 0.05);
    cursor: pointer;
    transition: all 0.3s;
}

.file-label:hover {
    background-color: rgba(52, 152, 219, 0.1);
    transform: translateY(-2px);
}

.file-label i {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

#fileLabelText {
    font-size: 1rem;
    color: var(--dark-gray);
    text-align: center;
}

#fileInput {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    top: 0;
    left: 0;
}

.submit-btn {
    position: relative;
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.submit-btn:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.submit-btn:active {
    transform: translateY(0);
}

.btn-text {
    position: relative;
    z-index: 1;
}

.loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 0%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.3);
    transition: width 0.3s;
    display: none;
    align-items: center;
    justify-content: center;
}

.progress-container {
    display: none;
    flex-direction: column;
    gap: 0.5rem;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--dark-gray);
}

.progress-bar {
    height: 8px;
    background-color: var(--light-gray);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background-color: var(--primary-color);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Dashboard Styles */
.dashboard {
    margin-top: 2rem;
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: var(--box-shadow);
}

.dashboard h2 {
    color: var(--secondary-color);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chart-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-card, .stats-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.chart-card h3, .stats-card h3 {
    color: var(--secondary-color);
    margin-bottom: 1rem;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chart-card img {
    width: 100%;
    height: auto;
    border-radius: 5px;
    margin-bottom: 1rem;
    border: 1px solid var(--light-gray);
}

.stats-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--light-gray);
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-label {
    font-weight: 500;
    color: var(--dark-gray);
}

.stat-value {
    font-weight: 700;
    color: var(--secondary-color);
}

.success-text {
    color: var(--success-color) !important;
}

.error-text {
    color: var(--error-color) !important;
}

.warning-text {
    color: var(--warning-color) !important;
}

.export-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 5px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    justify-content: center;
}

.export-btn:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
}

.data-table {
    margin-top: 2rem;
}

.data-table h3 {
    color: var(--secondary-color);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--light-gray);
}

th {
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
}

tr:hover {
    background-color: rgba(52, 152, 219, 0.05);
}

.app-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1rem;
    color: var(--dark-gray);
    font-size: 0.9rem;
    border-top: 1px solid var(--light-gray);
}

/* Animaciones */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading .btn-text {
    visibility: hidden;
}

.loading .loader {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading .loader::after {
    content: "";
    display: block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

/* Responsive */
@media (max-width: 768px) {
    .app-container {
        padding: 1rem;
    }
    
    .chart-container {
        grid-template-columns: 1fr;
    }
    
    .upload-card, .dashboard {
        padding: 1.5rem;
    }
    
    th, td {
        padding: 8px 10px;
        font-size: 0.9rem;
    }
}

/* Mantener los estilos existentes y añadir estos nuevos */

/* Progress bar animations */
@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

.progress-fill.animated {
    animation: pulse 1.5s infinite;
}

/* WebSocket connection status */
.connection-status {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 10px 15px;
    border-radius: 5px;
    font-size: 0.9rem;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.connection-status.connected {
    background-color: #e8f5e9;
    color: #2ecc71;
    border-left: 4px solid #2ecc71;
}

.connection-status.disconnected {
    background-color: #fdecea;
    color: #e74c3c;
    border-left: 4px solid #e74c3c;
}

/* Batch processing info */
.batch-info {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Optimized table styles */
.table-container {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #ecf0f1;
    border-radius: 5px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Responsive improvements */
@media (max-width: 768px) {
    .chart-container {
        grid-template-columns: 1fr;
    }
    
    .upload-card, .dashboard {
        padding: 1rem;
    }
    
    .file-label {
        padding: 1.5rem;
    }
    
    .submit-btn {
        padding: 0.8rem;
    }
}

/* Agrega esto al final de tu archivo styles.css */

.no-chart {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background-color: #f8f9fa;
    border-radius: 5px;
    color: #6c757d;
}

.no-chart i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #adb5bd;
}

.no-data {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background-color: #f8f9fa;
    border-radius: 5px;
    color: #6c757d;
}

.no-data i {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: #ffc107;
}

.progress-fill.animated {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

/* Añadir al final del archivo existente */

.full-width {
    grid-column: 1 / -1;
}

.chart-actions {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

/* Mejoras para la tabla */
table td {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Estilos para tooltips */
.tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Responsive improvements */
@media (max-width: 768px) {
    .chart-container {
        grid-template-columns: 1fr;
    }
    
    .chart-card, .stats-card {
        padding: 1rem;
    }
    
    table td, table th {
        padding: 8px;
        font-size: 0.8rem;
    }
}

/* Añadir al final del archivo */

.chart-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    text-align: center;
}

.chart-card img {
    max-width: 100%;
    height: auto;
    border-radius: 5px;
    margin: 0 auto;
    display: block;
}

@media (max-width: 768px) {
    .chart-container {
        grid-template-columns: 1fr;
    }
}

/* Añade estos estilos al final del archivo existente */

/* Gráficos interactivos */
.plotly-graph {
    width: 100%;
    height: 400px;
    border-radius: 8px;
    background: white;
    margin-top: 10px;
}

.chart-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.chart-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.no-chart {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 300px;
    color: #6c757d;
    background: #f8f9fa;
    border-radius: 8px;
}

.no-chart i {
    font-size: 2rem;
    margin-bottom: 10px;
    color: #adb5bd;
}

/* Responsive */
@media (max-width: 768px) {
    .plotly-graph {
        height: 300px;
    }
    
    .chart-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}
/* Estilos para celdas con overflow */
.overflow-cell {
    position: relative;
}

.overflow-cell:hover::after {
    content: attr(title);
    position: absolute;
    left: 0;
    top: 100%;
    background: #333;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    z-index: 100;
    white-space: normal;
    width: max-content;
    max-width: 300px;
}

/* Estilo para columnas ocultas */
.hidden-column {
    display: none;
}

/* Resaltar columna al pasar el mouse */
th:hover {
    background-color: #e6e6e6;
    cursor: pointer;
}