/* dashboard-nuevo.css - Estilos modernos para el dashboard */

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --text-color: #2c3e50;
    --text-light: #7f8c8d;
    --bg-color: #ecf0f1;
    --card-bg: #ffffff;
    --border-color: #bdc3c7;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --border-radius: 12px;
    
    /* Colores temáticos */
    --color-lecturas: #27ae60;      /* Verde para lecturas */
    --color-tiempo: #3498db;        /* Azul para tiempo/minutos */
    --color-usuarios: #e74c3c;      /* Rojo para usuarios */
    --color-lecturas-light: #d5f4e6;
    --color-tiempo-light: #d6eaf8;
    --color-usuarios-light: #fadbd8;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

.dashboard-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.dashboard-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1rem 0;
    box-shadow: var(--shadow);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo i {
    font-size: 2rem;
    color: var(--warning-color);
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 600;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#user-email {
    font-weight: 500;
}

.logout-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

/* Main Content */
.dashboard-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    flex: 1;
}

/* Stats Section - Reorganizado con colores temáticos */
.stats-section {
    margin-bottom: 2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.stats-grid-today {
    grid-template-columns: repeat(2, 1fr);
    max-width: 800px;
    margin: 0 auto;
}

.stat-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
}

.stat-card-large {
    padding: 2rem;
}

/* Colores temáticos para las estadísticas */
.stat-card[data-type="usuarios"] {
    background: linear-gradient(135deg, var(--color-usuarios), #c0392b);
    color: white;
    border-left-color: transparent;
}

.stat-card[data-type="usuarios"] .stat-icon {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.stat-card[data-type="usuarios"] .stat-content h3,
.stat-card[data-type="usuarios"] .stat-content p {
    color: white;
}

.stat-card[data-type="lecturas"] {
    background: linear-gradient(135deg, var(--color-lecturas), #229954);
    color: white;
    border-left-color: transparent;
}

.stat-card[data-type="lecturas"] .stat-icon {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.stat-card[data-type="lecturas"] .stat-content h3,
.stat-card[data-type="lecturas"] .stat-content p {
    color: white;
}

.stat-card[data-type="tiempo"] {
    background: linear-gradient(135deg, var(--color-tiempo), #2980b9);
    color: white;
    border-left-color: transparent;
}

.stat-card[data-type="tiempo"] .stat-icon {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.stat-card[data-type="tiempo"] .stat-content h3,
.stat-card[data-type="tiempo"] .stat-content p {
    color: white;
}

.stat-card-today {
    background: linear-gradient(135deg, var(--color-lecturas), #2ecc71);
    color: white;
    border-left-color: transparent;
}

.stat-card-today .stat-content h3,
.stat-card-today .stat-content p {
    color: white;
}

.stat-card-today .stat-icon {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.stat-card-today .stat-icon {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.stat-content h3 {
    color: var(--text-light);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.stat-content p {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-card-today .stat-content p {
    color: white;
}

/* Charts Section - Lado a lado */
.charts-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.chart-container {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border-left: 4px solid var(--color-lecturas);
}

.chart-container h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    font-size: 1.3rem;
}

.chart-container h2 i {
    color: var(--color-lecturas);
}

/* Data Tables Section - Más compacto */
.data-tables-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.table-container {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border-left: 4px solid var(--color-usuarios);
}

.table-container h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    font-size: 1.3rem;
}

.table-container h2 i {
    color: var(--color-usuarios);
}

.readings-table {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

th {
    background-color: var(--bg-color);
    font-weight: 600;
    color: var(--primary-color);
}

.loading {
    text-align: center;
    color: var(--text-light);
    font-style: italic;
}

/* Filters Section - Movido arriba con color temático */
.filters-section {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    border-left: 4px solid var(--color-tiempo);
}

.filters-section h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    font-size: 1.3rem;
}

.filters-section h2 i {
    color: var(--color-tiempo);
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    font-weight: 500;
    color: var(--text-color);
    font-size: 0.9rem;
}

.filter-group input,
.filter-group select {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: var(--color-tiempo);
}

.btn-primary {
    background: var(--color-tiempo);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #95a5a6;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #7f8c8d;
    transform: translateY(-2px);
}

/* Export Section - Nueva funcionalidad con color temático */
.export-section {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    text-align: center;
    border-left: 4px solid var(--color-lecturas);
}

.export-section h2 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    font-size: 1.3rem;
}

.export-section h2 i {
    color: var(--color-lecturas);
}

.export-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn-export {
    border: none;
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    color: white;
}

.btn-excel {
    background: var(--color-lecturas);
}

.btn-excel:hover {
    background: #229954;
    transform: translateY(-2px);
}

.btn-pdf {
    background: var(--color-usuarios);
}

.btn-pdf:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

.btn-csv {
    background: var(--color-tiempo);
}

.btn-csv:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .charts-section,
    .data-tables-section {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stats-grid-today {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .dashboard-main {
        padding: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .filters-grid {
        grid-template-columns: 1fr;
    }
    
    .export-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .stat-card {
        flex-direction: column;
        text-align: center;
    }
    
    .stat-icon {
        margin-bottom: 1rem;
    }
}

@media (max-width: 480px) {
    .logo h1 {
        font-size: 1.4rem;
    }
    
    .stat-content p {
        font-size: 1.5rem;
    }
    
    .chart-container,
    .table-container,
    .filters-section,
    .export-section {
        padding: 1rem;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stat-card,
.chart-container,
.table-container,
.filters-section,
.export-section {
    animation: fadeIn 0.6s ease-out;
}

/* Loading States */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border-color);
    border-radius: 50%;
    border-top-color: var(--secondary-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
