/* ============================================================
   V14 Dashboard Animations
   Card entrance, hover effects, count-up, sparklines
   ============================================================ */

/* ---- Card Entrance Animation ---- */
.card-animate {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-animate.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger delays — applied via JS but CSS fallback */
.card-animate:nth-child(1) { transition-delay: 0s; }
.card-animate:nth-child(2) { transition-delay: 0.08s; }
.card-animate:nth-child(3) { transition-delay: 0.16s; }
.card-animate:nth-child(4) { transition-delay: 0.24s; }
.card-animate:nth-child(5) { transition-delay: 0.32s; }
.card-animate:nth-child(6) { transition-delay: 0.40s; }
.card-animate:nth-child(7) { transition-delay: 0.48s; }
.card-animate:nth-child(8) { transition-delay: 0.56s; }

/* ---- Card Hover Effects ---- */
.card-hover-lift {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--v14-card-shadow-hover, 0 12px 40px rgba(0,0,0,0.12));
}

/* ---- Stat Card Glow on Hover ---- */
.stat-card-glow {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-card-glow::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.stat-card-glow:hover::after {
    opacity: 1;
}

.stat-card-glow.glow-blue::after {
    box-shadow: inset 0 0 20px rgba(59, 130, 246, 0.15);
}

.stat-card-glow.glow-green::after {
    box-shadow: inset 0 0 20px rgba(34, 197, 94, 0.15);
}

.stat-card-glow.glow-purple::after {
    box-shadow: inset 0 0 20px rgba(139, 92, 246, 0.15);
}

.stat-card-glow.glow-orange::after {
    box-shadow: inset 0 0 20px rgba(251, 146, 60, 0.15);
}

.stat-card-glow.glow-teal::after {
    box-shadow: inset 0 0 20px rgba(45, 212, 191, 0.15);
}

.stat-card-glow.glow-red::after {
    box-shadow: inset 0 0 20px rgba(239, 68, 68, 0.15);
}

/* ---- CountUp Number Animation ---- */
.countup-number {
    display: inline-block;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

/* ---- Sparkline Container ---- */
.sparkline-container {
    width: 100%;
    height: 60px;
    margin-top: 8px;
    position: relative;
}

.sparkline-container canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* ---- Ring Chart Container ---- */
.ring-chart-container {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto;
}

.ring-chart-center-text {
    position: absolute;
    top: 0;
    left: 50%;
    /* Chart.js legend at bottom takes ~45px; doughnut area = container - legend.
       Center of doughnut ≈ (200 - 45) / 2 = ~78px from top */
    transform: translate(-50%, 0);
    text-align: center;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: calc(100% - 45px);
}

.ring-chart-center-text .ring-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.ring-chart-center-text .ring-label {
    font-size: 0.75rem;
    opacity: 0.7;
}

/* ---- Hero Section Animation ---- */
@keyframes heroGradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.hero-animated-gradient {
    background-size: 200% 200%;
    animation: heroGradientShift 8s ease infinite;
}

/* ---- Shimmer Loading for Charts ---- */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.chart-loading-shimmer {
    background: linear-gradient(
        90deg,
        var(--v14-skeleton-base, #e9ecef) 25%,
        var(--v14-skeleton-shine, #f8f9fa) 37%,
        var(--v14-skeleton-base, #e9ecef) 63%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 8px;
}

/* ---- Button Micro-Interactions ---- */
.btn-micro {
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-micro:hover {
    transform: scale(1.03);
}

.btn-micro:active {
    transform: scale(0.97);
}

/* ---- Scrollbar Styling (Light Mode) ---- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--v14-scrollbar-track, #f1f1f1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--v14-scrollbar-thumb, #c1c1c1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--v14-scrollbar-thumb-hover, #a1a1a1);
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--v14-scrollbar-thumb, #c1c1c1) var(--v14-scrollbar-track, #f1f1f1);
}

/* ---- V14 Badge ---- */
.v14-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2em 0.65em;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-radius: 50rem;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
    vertical-align: middle;
    margin-left: 0.5rem;
}

/* ---- Fade In Up (generic) ---- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* ---- Performance Overview Card ---- */
.performance-overview-card {
    transition: all 0.3s ease;
}

.performance-overview-card:hover {
    transform: translateY(-2px);
}
