:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-dim: #94a3b8;
    --green: #10b981;
    --amber: #f59e0b;
    --red: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow-x: hidden;
}

.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: rgba(15, 23, 42, 0.95);
    border-right: 1px solid var(--glass-border);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 3rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.5rem;
}

.logo-section h1 {
    font-size: 1.25rem;
    font-weight: 700;
}

.nav-menu {
    flex: 1;
}

.nav-item {
    padding: 0.75rem 1rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-dim);
    margin-bottom: 0.5rem;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.nav-item.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    background: radial-gradient(circle at top right, rgba(99, 102, 241, 0.1), transparent);
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.header-left h2 {
    font-size: 1.75rem;
    margin-bottom: 4px;
}

.header-left p {
    color: var(--text-dim);
}

.search-bar input {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    color: white;
    width: 300px;
    outline: none;
}

/* Glass Cards */
.glass {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.glass:hover {
    border-color: rgba(99, 102, 241, 0.5);
    transform: translateY(-5px);
}

/* KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.kpi-card {
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kpi-info h3 {
    font-size: 0.875rem;
    color: var(--text-dim);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-value {
    font-size: 2rem;
    font-weight: 700;
}

.kpi-chart-mini {
    width: 80px;
    height: 40px;
}

/* Color Utilities */
.text-green {
    color: var(--green);
}

.text-amber {
    color: var(--amber);
}

.text-red {
    color: var(--red);
}

/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.chart-container {
    padding: 1.5rem;
    height: 350px;
    /* Altura fija para evitar crecimiento infinito con maintainAspectRatio: false */
    min-height: 350px;
}

.chart-container.large {
    grid-column: span 2;
    height: 400px;
    min-height: 400px;
}

.chart-container h3 {
    margin-bottom: 1.5rem;
    font-size: 1.125rem;
    color: var(--text-main);
}

canvas {
    width: 100% !important;
}

/* Filters Section */
.filters-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--glass-border);
}

.filters-section h3 {
    font-size: 0.875rem;
    color: var(--text-dim);
    margin-bottom: 1.5rem;
    text-transform: uppercase;
}

.filter-group {
    margin-bottom: 1.25rem;
}

.filter-group label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-bottom: 0.5rem;
}

.filter-group select {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.6rem;
    color: var(--text-main);
    outline: none;
    cursor: pointer;
}

.btn-reset {
    width: 100%;
    background: transparent;
    border: 1px dashed var(--text-dim);
    color: var(--text-dim);
    padding: 0.6rem;
    border-radius: 8px;
    margin-top: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-reset:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.mobile-only {
    display: none;
}

@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        left: -260px;
        z-index: 1000;
        transition: left 0.3s ease;
        height: 100vh;
    }

    .sidebar.active {
        left: 0;
    }

    .mobile-only {
        display: block;
        background: transparent;
        border: none;
        color: white;
        font-size: 1.5rem;
        margin-right: 1rem;
        cursor: pointer;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .chart-container.large {
        grid-column: span 1;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
    }

    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .top-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .search-bar input {
        width: 100%;
    }
}