/* ============================================================
   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);
}

/* ---- Quick Action Tiles (Dashboard Header) ---- */
.quick-action-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 6px;
    min-height: 72px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 12px;
    color: #fff;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.22s ease;
    width: 100%;
    position: relative;
    text-align: center;
    outline: none;
}

.quick-action-tile:hover,
.quick-action-tile:focus {
    background: rgba(255, 255, 255, 0.26);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
    color: #fff;
    text-decoration: none;
    border-color: rgba(255, 255, 255, 0.45);
}

.quick-action-tile .qa-icon {
    font-size: 1.35rem;
    margin-bottom: 5px;
    line-height: 1;
}

.quick-action-tile .qa-label {
    font-size: 0.68rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    letter-spacing: 0.01em;
}

.qa-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: #dc3545;
    color: #fff;
    border-radius: 50rem;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    font-size: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    border: 1.5px solid rgba(255,255,255,0.5);
}

/* Accent border-top for color coding */
.qa-security-safe  { border-top: 3px solid #28c76f; }
.qa-security-warn  { border-top: 3px solid #ff9f43; }
.qa-security-danger { border-top: 3px solid #ea5455; }
.qa-analytics-tile { border-top: 3px solid #00cfe8; background: rgba(0,207,232,0.15); }
.qa-s2s-tile       { border-top: 3px solid #7367f0; background: rgba(115,103,240,0.15); }
.qa-store-tile     { border-top: 3px solid #ff9f43; background: rgba(255,159,67,0.15); }
.qa-site-tile      { border-top: 3px solid rgba(255,255,255,0.7); background: rgba(255,255,255,0.18); }

/* Mobile App Status Bar */
.quick-action-mobile-bar {
    width: 100%;
    padding: 9px 14px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: background 0.2s ease;
}

.qa-mobile-connected {
    background: rgba(40, 199, 111, 0.25);
    border-color: rgba(40, 199, 111, 0.45);
}

.qa-mobile-offline {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
    opacity: 0.75;
}

.qa-mobile-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.qa-mobile-dot.connected { background: #28c76f; box-shadow: 0 0 0 3px rgba(40,199,111,0.3); }
.qa-mobile-dot.offline   { background: rgba(255,255,255,0.4); }
