/* ================================================================
   CORRECCIÓN FINAL GRIZALUM - REEMPLAZA TODO EN 05-tarjetas-numeros.css
   ================================================================ */

/* ===== GRID DE MÉTRICAS CORREGIDO ===== */
.metrics-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 16px !important;
    margin-bottom: 24px !important;
    width: 100% !important;
    align-items: stretch !important;
}

/* ===== TARJETA DE MÉTRICA PERFECTA ===== */
.metric-card {
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.95) 0%, 
        rgba(255, 255, 255, 0.8) 100%);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    
    /* DIMENSIONES FORZADAS */
    height: 140px !important;
    min-height: 140px !important;
    max-height: 140px !important;
    
    /* LAYOUT INTERNO */
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    padding: 20px !important;
    box-sizing: border-box !important;
    
    /* VISIBILIDAD FORZADA */
    visibility: visible !important;
    opacity: 1 !important;
}

/* Barra superior de color */
.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(135deg, #d4af37 0%, #b8860b 100%);
    transition: all 0.3s ease;
}

/* Colores específicos */
.metric-card.revenue::before { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.metric-card.expenses::before { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.metric-card.profit::before { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
.metric-card.growth::before { background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%); }

/* ===== HOVER SUTIL ===== */
.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: rgba(212, 175, 55, 0.3);
}

/* ===== HEADER DE LA TARJETA ===== */
.metric-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
    margin-bottom: 12px !important;
    gap: 12px !important;
    flex-shrink: 0 !important;
}

.metric-title {
    font-size: 12px !important;
    color: #64748b !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    line-height: 1.2 !important;
    flex: 1 !important;
    margin: 0 !important;
}

/* ===== ICONOS DE MÉTRICAS ===== */
.metric-icon {
    width: 40px !important;
    height: 40px !important;
    border-radius: 8px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 16px !important;
    color: white !important;
    flex-shrink: 0 !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

.metric-icon.revenue { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.metric-icon.expenses { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.metric-icon.profit { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
.metric-icon.growth { background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%); }

/* ===== VALOR PRINCIPAL ===== */
.metric-value {
    font-size: 24px !important;
    font-weight: 900 !important;
    color: #1e293b !important;
    margin: 8px 0 !important;
    line-height: 1 !important;
    letter-spacing: -0.02em !important;
    flex-grow: 1 !important;
    display: flex !important;
    align-items: center !important;
}

/* ===== INDICADOR DE CAMBIO ===== */
.metric-change {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    padding: 4px 8px !important;
    border-radius: 6px !important;
    flex-shrink: 0 !important;
    margin-top: auto !important;
}

.metric-change.positive { 
    color: #059669 !important; 
    background: rgba(16, 185, 129, 0.1) !important;
}

.metric-change.negative { 
    color: #dc2626 !important; 
    background: rgba(239, 68, 68, 0.1) !important;
}

/* ===== CORRECCIÓN ESPECÍFICA PARA LA PRIMERA TARJETA ===== */
.metric-card.revenue {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    order: 1 !important;
}

/* ===== RESPONSIVE TABLET ===== */
@media (max-width: 1200px) {
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 16px !important;
    }
}

/* ===== RESPONSIVE MÓVIL ===== */
@media (max-width: 768px) {
    .metrics-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
        margin-bottom: 20px !important;
    }
    
    .metric-card {
        height: 120px !important;
        min-height: 120px !important;
        max-height: 120px !important;
        padding: 16px !important;
    }
    
    .metric-value {
        font-size: 20px !important;
    }
    
    .metric-icon {
        width: 36px !important;
        height: 36px !important;
        font-size: 14px !important;
    }
}

/* ===== CORRECCIÓN DE GRÁFICOS ===== */
.charts-section {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)) !important;
    gap: 20px !important;
    margin-top: 20px !important;
}

.chart-card {
    height: 300px !important;
    min-height: 300px !important;
    max-height: 300px !important;
    padding: 20px !important;
    background: rgba(255, 255, 255, 0.95) !important;
    border-radius: 16px !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
    display: flex !important;
    flex-direction: column !important;
}

.chart-card.main-chart {
    grid-column: 1 / -1 !important;
    height: 350px !important;
    min-height: 350px !important;
    max-height: 350px !important;
}

.chart-container {
    flex: 1 !important;
    height: calc(100% - 60px) !important;
    min-height: 200px !important;
    position: relative !important;
}

.chart-header {
    flex-shrink: 0 !important;
    margin-bottom: 16px !important;
    padding-bottom: 12px !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

/* ===== FORZAR VISIBILIDAD CANVAS ===== */
.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
    max-height: none !important;
}

/* ===== MOBILE GRÁFICOS ===== */
@media (max-width: 768px) {
    .chart-card {
        height: 280px !important;
        min-height: 280px !important;
        max-height: 280px !important;
    }
    
    .chart-card.main-chart {
        height: 320px !important;
        min-height: 320px !important;
        max-height: 320px !important;
    }
}
