/* ============================================================================
   INDICADORES.CSS - Dashboard Ejecutivo
   ============================================================================ */

/* Variables */
:root {
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    --color-info: #3b82f6;
    --color-purple: #a855f7;
    --color-teal: #14b8a6;
    
    --gradient-success: linear-gradient(135deg, #10b981, #059669);
    --gradient-warning: linear-gradient(135deg, #f59e0b, #d97706);
    --gradient-danger: linear-gradient(135deg, #ef4444, #dc2626);
    --gradient-purple: linear-gradient(135deg, #a855f7, #7c3aed);
}

/* Page Header Enhancements */
.page-header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.refresh-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #f8fafc;
    border-radius: 8px;
    font-size: 13px;
    color: #64748b;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* System Status Card */
.system-status-card {
    background: white;
    border-radius: 12px;
    padding: 20px 30px;
    margin-bottom: 25px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 20px;
}

.status-light {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--color-success);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.5);
    animation: pulse 2s infinite;
}

.status-light.warning {
    background: var(--color-warning);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.5);
}

.status-light.danger {
    background: var(--color-danger);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.5);
}

.status-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.status-title {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
}

.status-subtitle {
    font-size: 14px;
    color: #64748b;
}

.status-actions {
    display: flex;
    gap: 10px;
}

/* Hero KPIs */
.hero-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.hero-kpi-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
    transition: all 0.3s;
}

.hero-kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-success);
}

.hero-kpi-card.green::before {
    background: var(--gradient-success);
}

.hero-kpi-card.orange::before {
    background: var(--gradient-warning);
}

.hero-kpi-card.red::before {
    background: var(--gradient-danger);
}

.hero-kpi-card.purple::before {
    background: var(--gradient-purple);
}

.hero-kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.hero-kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.hero-kpi-label {
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hero-kpi-header i {
    font-size: 24px;
    opacity: 0.2;
}

.hero-kpi-card.green .hero-kpi-header i {
    color: var(--color-success);
}

.hero-kpi-card.orange .hero-kpi-header i {
    color: var(--color-warning);
}

.hero-kpi-card.red .hero-kpi-header i {
    color: var(--color-danger);
}

.hero-kpi-card.purple .hero-kpi-header i {
    color: var(--color-purple);
}

.hero-kpi-value {
    font-size: 48px;
    font-weight: 900;
    line-height: 1;
    margin-bottom: 12px;
    color: #1e293b;
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.hero-kpi-unit {
    font-size: 24px;
    font-weight: 600;
    color: #64748b;
}

.hero-kpi-meta {
    font-size: 13px;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.trend {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
}

.trend.positive {
    background: #dcfce7;
    color: #16a34a;
}

.trend.negative {
    background: #fee2e2;
    color: #dc2626;
}

.hero-kpi-sparkline {
    height: 40px;
}

.hero-kpi-sparkline canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Critical Alerts */
.critical-alerts {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.alert-item {
    background: white;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-left: 4px solid;
}

.alert-item.critical {
    border-left-color: #dc2626;
}

.alert-item.warning {
    border-left-color: #f59e0b;
}

.alert-item.info {
    border-left-color: #3b82f6;
}

.alert-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.alert-item.critical .alert-icon {
    background: #fee2e2;
    color: #dc2626;
}

.alert-item.warning .alert-icon {
    background: #fef3c7;
    color: #f59e0b;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 4px;
}

.alert-description {
    font-size: 14px;
    color: #64748b;
}

.alert-action {
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: white;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.alert-action:hover {
    background: #f8fafc;
    border-color: #00853F;
    color: #00853F;
}

/* Section Titles */
.section-title {
    margin: 40px 0 20px 0;
}

.section-title h2 {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-title h2 i {
    color: #00853F;
}

/* Comparison Grid */
.comparison-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.comparison-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.comparison-header {
    padding: 20px;
    border-bottom: 1px solid #f1f5f9;
}

.comparison-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 4px;
}

.comparison-period {
    font-size: 13px;
    color: #64748b;
}

.comparison-body {
    padding: 20px;
}

.comparison-metrics {
    display: grid;
    gap: 20px;
}

.comparison-metric {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.metric-label {
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
}

.metric-comparison {
    display: flex;
    align-items: center;
    gap: 12px;
}

.metric-value {
    font-size: 32px;
    font-weight: 700;
    color: #1e293b;
}

.metric-value.current {
    color: #00853F;
}

.metric-value.previous {
    font-size: 24px;
    color: #94a3b8;
}

.metric-arrow {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
}

.metric-arrow.up {
    background: #fee2e2;
    color: #dc2626;
}

.metric-arrow.down {
    background: #dcfce7;
    color: #16a34a;
}

/* Scorecard */
.scorecard-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
}

.scorecard-circle {
    position: relative;
    width: 200px;
    height: 200px;
    margin-bottom: 15px;
}

.scorecard-svg {
    width: 100%;
    height: 100%;
}

.scorecard-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    font-weight: 900;
    color: #1e293b;
}

.scorecard-unit {
    font-size: 24px;
    font-weight: 600;
    color: #94a3b8;
}

.scorecard-label {
    font-size: 16px;
    color: #64748b;
}

.scorecard-label strong {
    color: #00853F;
    font-weight: 700;
}

.scorecard-breakdown {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.scorecard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f8fafc;
    border-radius: 8px;
}

.scorecard-item-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #475569;
}

.scorecard-item-value {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
}

/* Predictions */
.predictions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.prediction-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: flex;
    gap: 16px;
    transition: all 0.3s;
}

.prediction-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.prediction-icon {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
    flex-shrink: 0;
}

.prediction-icon.danger {
    background: var(--gradient-danger);
}

.prediction-icon.warning {
    background: var(--gradient-warning);
}

.prediction-icon.info {
    background: linear-gradient(135deg, #3b82f6, #1e40af);
}

.prediction-icon.success {
    background: var(--gradient-success);
}

.prediction-content {
    flex: 1;
}

.prediction-value {
    font-size: 28px;
    font-weight: 900;
    color: #1e293b;
    margin-bottom: 8px;
    line-height: 1;
}

.prediction-label {
    font-size: 14px;
    color: #475569;
    margin-bottom: 8px;
    line-height: 1.4;
}

.prediction-confidence {
    font-size: 12px;
    color: #64748b;
    font-weight: 600;
}

/* Ranking */
.ranking-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.ranking-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
}

.ranking-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateX(4px);
}

.ranking-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 15px;
}

.ranking-position {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 900;
    color: #475569;
    flex-shrink: 0;
}

.ranking-card:first-child .ranking-position {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: white;
}

.ranking-card:nth-child(2) .ranking-position {
    background: linear-gradient(135deg, #d1d5db, #9ca3af);
    color: white;
}

.ranking-card:nth-child(3) .ranking-position {
    background: linear-gradient(135deg, #fb923c, #ea580c);
    color: white;
}

.ranking-info {
    flex: 1;
}

.ranking-name {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 8px;
}

.ranking-score {
    display: flex;
    align-items: center;
    gap: 12px;
}

.score-bar {
    flex: 1;
    height: 8px;
    background: #f1f5f9;
    border-radius: 4px;
    overflow: hidden;
}

.score-fill {
    height: 100%;
    background: linear-gradient(90deg, #00853F, #10b981);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.score-value {
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
}

.ranking-badge {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
}

.ranking-badge.gold {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
}

.ranking-badge.silver {
    background: linear-gradient(135deg, #d1d5db, #9ca3af);
}

.ranking-badge.bronze {
    background: linear-gradient(135deg, #fb923c, #ea580c);
}

.ranking-metrics {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.ranking-metric {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #64748b;
}

.metric-icon {
    color: #00853F;
}

/* Heatmap */
.heatmap-container {
    margin-bottom: 30px;
}

.heatmap-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.heatmap-header {
    padding: 20px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.heatmap-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
}

.heatmap-legend {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: #64748b;
}

.legend-gradient {
    width: 120px;
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, #dcfce7, #fef3c7, #fee2e2);
}

.heatmap-body {
    padding: 20px;
}

/* Charts Row */
.charts-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.chart-card-modern {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.chart-modern-header {
    padding: 20px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chart-modern-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
}

.chart-period-select {
    padding: 6px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    color: #475569;
    background: white;
    cursor: pointer;
}

.chart-period-select:focus {
    outline: none;
    border-color: #00853F;
}

.chart-modern-body {
    padding: 20px;
}

.chart-modern-body canvas {
    max-height: 300px;
}

/* Responsive */
@media (max-width: 1200px) {
    .comparison-grid,
    .charts-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .hero-kpis {
        grid-template-columns: 1fr;
    }
    
    .predictions-grid {
        grid-template-columns: 1fr;
    }
    
    .system-status-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .status-actions {
        width: 100%;
    }
    
    .status-actions button {
        flex: 1;
    }
    
    .alert-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .alert-action {
        width: 100%;
        justify-content: center;
    }
}