/* Dashboards CSS for Historias del Cambio */
:root {
    --hdc-primary: #4B2C80;
    --hdc-primary-hover: #3d2369;
    --hdc-accent: #FF006E;
    --hdc-secondary: #64748b;
    --hdc-bg-main: #f8fafc;
    --hdc-bg-card: #ffffff;
    --hdc-text-main: #1e293b;
    --hdc-text-muted: #64748b;
    --hdc-sidebar-w: 260px;
    --hdc-glass: rgba(255, 255, 255, 0.7);
    --hdc-glass-border: rgba(255, 255, 255, 0.1);
    --hdc-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --hdc-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --hdc-radius: 12px;
}

.hdc-app-container * {
    box-sizing: border-box;
}

.hdc-dashboard-wrapper {
    display: grid;
    grid-template-columns: var(--hdc-sidebar-w) 1fr;
    min-height: 100vh;
    background: var(--hdc-bg-main);
    width: 100%;
}

.hdc-dashboard-container {
    display: contents;
    /* Grid parent overrides this */
}

/* Sidebar Styling */
.hdc-dashboard-sidebar {
    background: var(--hdc-bg-card);
    border-right: 1px solid var(--hdc-glass-border);
    padding: 2.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 4px 0 24px -12px rgba(0, 0, 0, 0.1);
}

.hdc-dashboard-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.hdc-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--hdc-text-muted);
    text-decoration: none !important;
    border-radius: var(--hdc-radius);
    transition: all 0.2s ease;
    font-weight: 500;
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    font-size: 0.9375rem;
}

.hdc-nav-item:hover {
    background: rgba(75, 44, 128, 0.05);
    color: var(--hdc-primary) !important;
}

.hdc-nav-item.active {
    background: var(--hdc-primary);
    color: white !important;
    box-shadow: 0 4px 12px rgba(75, 44, 128, 0.25);
}

.hdc-nav-item i {
    width: 20px;
    height: 20px;
}

.hdc-sidebar-brand {
    user-select: none;
}

/* Main Content Area */
.hdc-dashboard-main {
    min-width: 0;
    /* Prevents flex/grid blowout */
    padding: 2.5rem 3rem;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    overflow-y: auto;
}

.hdc-dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.hdc-dashboard-header h1 {
    font-size: 1.875rem;
    font-weight: 800;
    margin: 0;
    color: var(--hdc-text-main);
    letter-spacing: -0.025em;
}

.hdc-subtitle {
    color: var(--hdc-text-muted);
    font-size: 0.9375rem;
    margin-top: 0.25rem;
}

/* Metrics Grid */
.hdc-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.hdc-metric-card {
    background: var(--hdc-bg-card);
    border-radius: var(--hdc-radius);
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--hdc-shadow-sm);
    border: 1px solid var(--hdc-glass-border);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hdc-metric-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--hdc-shadow);
}

.hdc-metric-value {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--hdc-primary);
    line-height: 1;
    margin-bottom: 0.5rem;
    display: block;
}

.hdc-metric-label {
    color: var(--hdc-text-muted);
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Modern Tables */
.hdc-table-card {
    background: var(--hdc-bg-card);
    border-radius: var(--hdc-radius);
    border: 1px solid var(--hdc-glass-border);
    box-shadow: var(--hdc-shadow-sm);
    overflow: hidden;
}

.hdc-table-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--hdc-glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hdc-table-header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 700;
}

.hdc-modern-table {
    width: 100%;
    border-collapse: collapse;
}

.hdc-modern-table th {
    padding: 1rem 1.5rem;
    background: var(--hdc-bg-main);
    color: var(--hdc-text-muted);
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: left;
    border-bottom: 1px solid var(--hdc-glass-border);
}

.hdc-modern-table td {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--hdc-glass-border);
    font-size: 0.9375rem;
}

.hdc-modern-table tr:last-child td {
    border-bottom: none;
}

.hdc-modern-table tr:hover td {
    background: rgba(75, 44, 128, 0.02);
}

/* Tab Management */
.hdc-tab-content {
    display: none;
}

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

/* Responsive */
@media (max-width: 1024px) {
    .hdc-dashboard-container {
        flex-direction: column;
    }

    .hdc-dashboard-sidebar {
        width: 100%;
        position: static;
        margin-bottom: 1.5rem;
    }
}