/* ==============================================
   Report PDF Generation Animation
   ============================================== */

/* Overlay */
.report-anim-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.65);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.4s ease;
}
.report-anim-overlay.is-visible {
    opacity: 1;
}

/* Card */
.report-anim-card {
    background: #fff;
    border-radius: 16px;
    padding: 48px 40px 40px;
    width: 420px;
    max-width: 90vw;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

/* Document icon animation */
.report-anim-icon {
    width: 64px;
    height: 80px;
    margin: 0 auto 24px;
    position: relative;
}
.report-anim-icon-doc {
    width: 56px;
    height: 72px;
    background: #e8f0fe;
    border: 2px solid #4285f4;
    border-radius: 4px 12px 4px 4px;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}
.report-anim-icon-doc::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background: #4285f4;
    clip-path: polygon(0 0, 100% 100%, 0 100%);
}
.report-anim-icon-lines {
    position: absolute;
    left: 50%;
    top: 55%;
    transform: translate(-50%, -50%);
    width: 32px;
}
.report-anim-icon-lines span {
    display: block;
    height: 2px;
    background: #4285f4;
    margin-bottom: 4px;
    border-radius: 1px;
    animation: report-line-fill 2s ease-in-out infinite;
}
.report-anim-icon-lines span:nth-child(1) { width: 100%; animation-delay: 0s; }
.report-anim-icon-lines span:nth-child(2) { width: 80%; animation-delay: 0.3s; }
.report-anim-icon-lines span:nth-child(3) { width: 90%; animation-delay: 0.6s; }
.report-anim-icon-lines span:nth-child(4) { width: 60%; animation-delay: 0.9s; }

@keyframes report-line-fill {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* Title */
.report-anim-title {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 8px;
}

/* Status text */
.report-anim-status {
    font-size: 14px;
    color: #666;
    margin-bottom: 24px;
    min-height: 20px;
    transition: opacity 0.3s ease;
}

/* Progress bar */
.report-anim-progress-wrap {
    width: 100%;
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 16px;
}
.report-anim-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4285f4, #34a853);
    border-radius: 3px;
    width: 0%;
    transition: width 0.8s ease;
}

/* Steps */
.report-anim-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    padding: 0 4px;
}
.report-anim-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
}
.report-anim-step-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #999;
    margin-bottom: 6px;
    transition: all 0.4s ease;
    position: relative;
    z-index: 1;
}
.report-anim-step.is-active .report-anim-step-dot {
    background: #4285f4;
    color: #fff;
    box-shadow: 0 0 0 4px rgba(66, 133, 244, 0.2);
    animation: report-step-pulse 1.5s ease-in-out infinite;
}
.report-anim-step.is-done .report-anim-step-dot {
    background: #34a853;
    color: #fff;
}
.report-anim-step-label {
    font-size: 11px;
    color: #999;
    transition: color 0.3s ease;
    white-space: nowrap;
}
.report-anim-step.is-active .report-anim-step-label,
.report-anim-step.is-done .report-anim-step-label {
    color: #333;
    font-weight: 600;
}

@keyframes report-step-pulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(66, 133, 244, 0.2); }
    50% { box-shadow: 0 0 0 8px rgba(66, 133, 244, 0.1); }
}

/* Elapsed time */
.report-anim-time {
    font-size: 12px;
    color: #999;
    margin-top: 8px;
}

/* ====== Completion State ====== */
.report-anim-card.is-complete .report-anim-icon-doc {
    background: #e6f4ea;
    border-color: #34a853;
}
.report-anim-card.is-complete .report-anim-icon-lines span {
    background: #34a853;
    animation: none;
    opacity: 1;
}
.report-anim-card.is-complete .report-anim-progress-bar {
    width: 100% !important;
    background: linear-gradient(90deg, #34a853, #34a853);
}

/* Checkmark */
.report-anim-check {
    display: none;
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    position: relative;
}
.report-anim-card.is-complete .report-anim-check {
    display: block;
}
.report-anim-card.is-complete .report-anim-icon {
    display: none;
}
.report-anim-check-circle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #34a853;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: report-check-pop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.report-anim-check-circle svg {
    width: 28px;
    height: 28px;
    fill: none;
    stroke: #fff;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 40;
    stroke-dashoffset: 40;
    animation: report-check-draw 0.4s ease 0.3s forwards;
}

@keyframes report-check-pop {
    0% { transform: scale(0); }
    100% { transform: scale(1); }
}
@keyframes report-check-draw {
    to { stroke-dashoffset: 0; }
}

/* ====== Fireworks ====== */
.report-fireworks {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}
.report-firework-particle {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    animation: report-firework-burst 1s ease-out forwards;
}

@keyframes report-firework-burst {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(var(--fw-x), var(--fw-y)) scale(0);
    }
}

/* Confetti pieces */
.report-confetti {
    position: absolute;
    width: 8px;
    height: 8px;
    animation: report-confetti-fall 1.5s ease-out forwards;
}

@keyframes report-confetti-fall {
    0% {
        opacity: 1;
        transform: translate(0, 0) rotate(0deg) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(var(--cf-x), var(--cf-y)) rotate(var(--cf-r)) scale(0.3);
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .report-anim-icon-lines span,
    .report-anim-step.is-active .report-anim-step-dot,
    .report-anim-check-circle,
    .report-anim-check-circle svg,
    .report-firework-particle,
    .report-confetti {
        animation: none !important;
    }
    .report-anim-check-circle svg {
        stroke-dashoffset: 0;
    }
    .report-anim-overlay {
        transition: none;
    }
    .report-anim-progress-bar {
        transition: width 0.1s;
    }
}
