/* ============================================
   SafeGuard AI - Animations
   ============================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(100%);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes scaleOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.9);
    }
}

/* Score Progress Animation */
@keyframes scoreProgress {
    from {
        stroke-dashoffset: 565.48;
    }
    to {
        stroke-dashoffset: var(--target-offset);
    }
}

/* Score Number Animation */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Utility Classes */
.animate-fade-in {
    animation: fadeIn 0.5s ease-out;
}

.animate-fade-in-up {
    animation: fadeInUp 0.5s ease-out;
}

.animate-fade-in-down {
    animation: fadeInDown 0.5s ease-out;
}

.animate-fade-in-left {
    animation: fadeInLeft 0.5s ease-out;
}

.animate-fade-in-right {
    animation: fadeInRight 0.5s ease-out;
}

.animate-scale-in {
    animation: scaleIn 0.3s ease-out;
}

.animate-scale-out {
    animation: scaleOut 0.3s ease-out forwards;
}

.animate-slide-in {
    animation: slideIn 0.3s ease-out;
}

.animate-slide-out {
    animation: slideOut 0.3s ease-out forwards;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

.animate-bounce {
    animation: bounce 1s ease-in-out infinite;
}

.animate-shake {
    animation: shake 0.5s ease-in-out;
}

/* Staggered Animation Delays */
.stagger-1 {
    animation-delay: 0.1s;
}

.stagger-2 {
    animation-delay: 0.2s;
}

.stagger-3 {
    animation-delay: 0.3s;
}

.stagger-4 {
    animation-delay: 0.4s;
}

.stagger-5 {
    animation-delay: 0.5s;
}

.stagger-6 {
    animation-delay: 0.6s;
}

/* Hover Animations */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.hover-scale {
    transition: transform 0.3s ease;
}

.hover-scale:hover {
    transform: scale(1.02);
}

.hover-glow {
    transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(37, 99, 235, 0.3);
}

/* Card Entrance Animation */
.card-enter {
    opacity: 0;
    transform: translateY(20px);
    animation: cardEnter 0.5s ease-out forwards;
}

@keyframes cardEnter {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Smooth Transitions */
.smooth-transition {
    transition: all 0.3s ease;
}

.fast-transition {
    transition: all 0.15s ease;
}

.slow-transition {
    transition: all 0.5s ease;
}

/* Loading States */
.loading-skeleton {
    background: linear-gradient(90deg, var(--bg-light-gray) 25%, var(--border-light) 50%, var(--bg-light-gray) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Progress Bar Animation */
.progress-bar {
    transition: width 0.5s ease-out;
}

/* Drawer Animation */
.drawer-content {
    transition: transform 0.3s ease-out;
}

/* Mobile Menu Animation */
.mobile-menu {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.mobile-menu:not(.active) {
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
}

.mobile-menu.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Theme Transition */
body {
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Button Ripple Effect */
.btn {
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
}

.btn:active::after {
    width: 200px;
    height: 200px;
}

/* Checkbox Animation */
.checklist-checkbox {
    transition: all 0.2s ease;
}

.checklist-checkbox:checked {
    animation: checkbox-check 0.3s ease;
}

@keyframes checkbox-check {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

/* Tab Transition */
.tab-content {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.tab-content:not(.active) {
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    position: absolute;
}

.tab-content.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    position: relative;
}

/* Risk Badge Animation */
.risk-badge {
    animation: badge-pop 0.5s ease-out;
}

@keyframes badge-pop {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Finding Item Animation */
.finding-item {
    animation: finding-slide 0.4s ease-out forwards;
    opacity: 0;
}

@keyframes finding-slide {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Stagger Finding Items */
.finding-item:nth-child(1) { animation-delay: 0.1s; }
.finding-item:nth-child(2) { animation-delay: 0.2s; }
.finding-item:nth-child(3) { animation-delay: 0.3s; }
.finding-item:nth-child(4) { animation-delay: 0.4s; }
.finding-item:nth-child(5) { animation-delay: 0.5s; }
.finding-item:nth-child(6) { animation-delay: 0.6s; }

/* Score Circle Animation */
.score-circle svg circle:last-child {
    transition: stroke-dashoffset 1s ease-out, stroke 0.3s ease;
}

/* Score Number Animation */
.score-number {
    animation: countUp 0.5s ease-out;
}

/* Hero Visual Animation */
.analysis-visual {
    animation: fadeInUp 0.6s ease-out;
}

/* Step Card Animation */
.step-card {
    animation: fadeInUp 0.5s ease-out forwards;
    opacity: 0;
}

.step-card:nth-child(1) { animation-delay: 0.1s; }
.step-card:nth-child(2) { animation-delay: 0.2s; }
.step-card:nth-child(3) { animation-delay: 0.3s; }

/* Detect Card Animation */
.detect-card {
    animation: fadeInUp 0.5s ease-out forwards;
    opacity: 0;
}

.detect-card:nth-child(1) { animation-delay: 0.1s; }
.detect-card:nth-child(2) { animation-delay: 0.2s; }
.detect-card:nth-child(3) { animation-delay: 0.3s; }
.detect-card:nth-child(4) { animation-delay: 0.4s; }

/* Demo Button Animation */
.demo-btn {
    animation: fadeInUp 0.5s ease-out forwards;
    opacity: 0;
}

.demo-btn:nth-child(1) { animation-delay: 0.1s; }
.demo-btn:nth-child(2) { animation-delay: 0.2s; }
.demo-btn:nth-child(3) { animation-delay: 0.3s; }
.demo-btn:nth-child(4) { animation-delay: 0.4s; }

/* Topic Card Animation */
.topic-card {
    animation: fadeInUp 0.5s ease-out forwards;
    opacity: 0;
}

.topic-card:nth-child(1) { animation-delay: 0.1s; }
.topic-card:nth-child(2) { animation-delay: 0.2s; }
.topic-card:nth-child(3) { animation-delay: 0.3s; }
.topic-card:nth-child(4) { animation-delay: 0.4s; }
.topic-card:nth-child(5) { animation-delay: 0.5s; }
.topic-card:nth-child(6) { animation-delay: 0.6s; }
.topic-card:nth-child(7) { animation-delay: 0.7s; }

/* Action Step Animation */
.action-step {
    animation: fadeInUp 0.5s ease-out forwards;
    opacity: 0;
}

.action-step:nth-child(1) { animation-delay: 0.1s; }
.action-step:nth-child(2) { animation-delay: 0.2s; }
.action-step:nth-child(3) { animation-delay: 0.3s; }
.action-step:nth-child(4) { animation-delay: 0.4s; }
.action-step:nth-child(5) { animation-delay: 0.5s; }
.action-step:nth-child(6) { animation-delay: 0.6s; }

/* History Item Animation */
.history-item {
    animation: slideIn 0.3s ease-out forwards;
}

/* Error Shake Animation */
.input-error {
    animation: shake 0.3s ease-out;
}
