/* ===== DASHBOARD DE INICIO CON GRÁFICAS ===== */

.dashboard-hero {
    margin-bottom: 24px;
    animation: fadeInUp 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.metric-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.metric-card {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.8) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03), 0 1px 3px rgba(0,0,0,0.02);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.27) !important;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    z-index: 1;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border-radius: 12px;
    padding: 2px;
    background: linear-gradient(135deg, var(--accent-color), transparent 60%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: destination-out;
    mask-composite: exclude;
    opacity: 0.15;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.metric-card:hover {
    transform: translateY(-3px) scale(1.01) !important;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.06), 0 4px 10px rgba(var(--accent-rgb, 0,0,0), 0.1) !important;
}

.metric-card:hover::before {
    opacity: 0.8;
}

.metric-card.primary { --accent-color: #0ea5e9; --accent-rgb: 14, 165, 233; }
.metric-card.success { --accent-color: #10b981; --accent-rgb: 16, 185, 129; }
.metric-card.warning { --accent-color: #f59e0b; --accent-rgb: 245, 158, 11; }
.metric-card.purple { --accent-color: #8b5cf6; --accent-rgb: 139, 92, 246; }

.metric-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.metric-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.metric-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent-color), rgba(var(--accent-rgb), 0.7));
    color: white;
    font-size: 18px;
    box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.3);
    transition: transform 0.3s ease;
}

.metric-card:hover .metric-icon {
    transform: scale(1.05) rotate(3deg);
}

.metric-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 6px;
    letter-spacing: -0.02em;
    background: linear-gradient(90deg, #0f172a 0%, #475569 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: #0f172a; /* Fallback */
}

.metric-change {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.875rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 8px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.metric-change.positive {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

.metric-change.negative {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

.metric-change.neutral {
    background: rgba(100, 116, 139, 0.1);
    color: #475569;
}

.metric-chart {
    width: 100%;
    height: 70px;
    margin-top: 8px;
    display: block;
    opacity: 1;
}

.metric-footer {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed rgba(0, 0, 0, 0.1);
    font-size: 0.75rem;
    color: #475569;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.metric-footer span:not(.material-symbols-outlined) {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    background: rgba(0,0,0,0.03);
}

.metric-footer .material-symbols-outlined {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Animaciones */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.metric-card:nth-child(1) { animation: fadeInUp 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) 0.1s both !important; }
.metric-card:nth-child(2) { animation: fadeInUp 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) 0.2s both !important; }
.metric-card:nth-child(3) { animation: fadeInUp 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) 0.3s both !important; }
.metric-card:nth-child(4) { animation: fadeInUp 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) 0.4s both !important; }

/* Responsive */
@media (max-width: 768px) {
    .metric-cards-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .metric-value {
        font-size: 1.5rem;
    }
    
    .metric-card {
        padding: 12px;
    }
}

/* Animación de pulso para citas urgentes */
@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(239, 68, 68, 0);
        transform: scale(1.05);
    }
}

.pulse-badge {
    animation: pulse-glow 2s infinite;
}

.metric-change.warning {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

/* Tooltip para información adicional */
.metric-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: rgba(15, 23, 42, 0.95);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.metric-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(15, 23, 42, 0.95);
}

.metric-card:hover .metric-tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(-12px);
}

/* Detalles expandidos */
.metric-details {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    font-size: 0.7rem;
    color: #64748b;
    line-height: 1.4;
}

.metric-details-item {
    display: flex;
    justify-content: space-between;
    margin: 2px 0;
}

.metric-details-item strong {
    color: #0f172a;
}

