/* Estilos generales */
:root {
    --primary-color: #4a6fa5;
    --secondary-color: #6b8cae;
    --background-light: #f5f7fa;
    --text-light: #333;
    --text-dark: #f5f7fa;
    --background-dark: #1a1a2e;
    --card-bg: #fff;
    --border-color: #ddd;
    --success-color: #28a745;
    --error-color: #dc3545;
    --warning-color: #ffc107;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    background-color: var(--background-light);
    color: var(--text-light);
    transition: background-color 0.3s, color 0.3s;
}

/* Modo oscuro */
body.dark-mode {
    background-color: var(--background-dark);
    color: var(--text-dark);
}

/* Contenedor principal */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

/* Encabezado */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

h1 {
    color: var(--primary-color);
    font-size: 1.8rem;
}

/* Controles */
.controls {
    display: flex;
    gap: 0.5rem;
}

/* Botones */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    background-color: #e0e0e0;
    color: #333;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.btn.primary {
    background-color: var(--primary-color);
    color: white;
}

.btn.primary:hover {
    background-color: var(--secondary-color);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Sección de entrada */
.input-section {
    background-color: var(--card-bg);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.file-upload {
    margin-bottom: 1rem;
}

.file-input {
    display: none;
}

.csv-input {
    margin-bottom: 1rem;
}

.csv-input label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

#csvData {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: inherit;
    resize: vertical;
    min-height: 120px;
}

/* Controles de gráfico */
.chart-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: inherit;
}

/* Pestañas */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-light);
    transition: all 0.3s ease;
}

.tab-btn.active {
    border-bottom-color: var(--primary-color);
    color: var(--primary-color);
}

.tab-content {
    position: relative;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* Tabla */
.table-container {
    overflow-x: auto;
    margin-bottom: 1.5rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

th, td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
}

tr:nth-child(even) {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Gráfico */
.chart-container {
    position: relative;
    width: 100%;
    min-height: 400px;
    margin: 1.5rem 0;
}

/* Pie de página */
footer {
    text-align: center;
    padding: 1.5rem 0;
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
    color: #666;
}

/* Utilidades */
.hidden {
    display: none !important;
}

/* Alto contraste */
body.high-contrast {
    --primary-color: #000;
    --background-light: #000;
    --text-light: #fff;
    --card-bg: #222;
    --border-color: #fff;
}

/* Tamaños de fuente */
body.large-text {
    font-size: 1.1rem;
}

body.larger-text {
    font-size: 1.25rem;
}

/* Responsive */
@media (max-width: 768px) {
    .chart-controls {
        grid-template-columns: 1fr;
    }
    
    header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
}

/* Select2 personalizado */
.select2-container--default .select2-selection--single {
    height: 38px;
    border: 1px solid var(--border-color);
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 36px;
    color: var(--text-light);
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 36px;
}

/* Modo oscuro */
.dark-mode {
    --card-bg: #16213e;
    --border-color: #2d3748;
    --background-light: #1a1a2e;
    --text-light: #e2e8f0;
}

.dark-mode .input-section,
.dark-mode .table-container,
.dark-mode .chart-container {
    background-color: #16213e;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.dark-mode tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.05);
}
