/* ===========================================
   WOW EFFECTS - Micro-interactions & Celebrations
   AI Academy - Creating Memorable Experiences
   =========================================== */

/* ============ BUTTON EFFECTS ============ */

/* Hover lift effect for all buttons */
.btn {
    transition: all 0.2s ease-out;
    position: relative;
    overflow: hidden;
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* Primary button glow on hover */
.btn-primary:hover {
    box-shadow: 0 4px 20px rgba(44, 75, 255, 0.4);
}

.btn-success:hover {
    box-shadow: 0 4px 20px rgba(25, 135, 84, 0.4);
}

.btn-warning:hover {
    box-shadow: 0 4px 20px rgba(255, 193, 7, 0.4);
}

/* Ripple effect on click */
.btn::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    background-image: radial-gradient(circle, #fff 10%, transparent 10.01%);
    background-repeat: no-repeat;
    background-position: 50%;
    transform: scale(10, 10);
    opacity: 0;
    transition: transform 0.5s, opacity 0.5s;
}

.btn:active::after {
    transform: scale(0, 0);
    opacity: 0.3;
    transition: 0s;
}

/* ============ CARD EFFECTS ============ */

/* Course cards hover effect */
.card {
    transition: all 0.3s ease;
}

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

/* Subtle scale on course card image */
.card .card-img-top {
    transition: transform 0.5s ease;
}

.card:hover .card-img-top {
    transform: scale(1.05);
}

/* Card image container to hide overflow */
.card {
    overflow: hidden;
}

/* ============ PROGRESS BAR ANIMATIONS ============ */

/* Animated progress bar fill */
.progress-bar-animated-fill {
    animation: progressFill 1s ease-out forwards;
    width: 0;
}

@keyframes progressFill {
    to {
        width: var(--progress-width, 0%);
    }
}

/* Shimmer effect on progress bar */
.progress-bar-shimmer {
    position: relative;
    overflow: hidden;
}

.progress-bar-shimmer::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* ============ TOAST NOTIFICATIONS ============ */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wow-toast {
    background: white;
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 400px;
    animation: slideInRight 0.4s ease-out;
    border-left: 4px solid #2c4bff;
}

.wow-toast.toast-success {
    border-left-color: #16a34a;
}

.wow-toast.toast-warning {
    border-left-color: #f59e0b;
}

.wow-toast.toast-celebration {
    border-left-color: #8b5cf6;
    background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
}

.wow-toast-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.wow-toast-content {
    flex-grow: 1;
}

.wow-toast-title {
    font-weight: 600;
    margin-bottom: 2px;
}

.wow-toast-message {
    color: #6b7280;
    font-size: 0.875rem;
}

.wow-toast-close {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s;
}

.wow-toast-close:hover {
    color: #374151;
}

.wow-toast.toast-exit {
    animation: slideOutRight 0.3s ease-in forwards;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* ============ CELEBRATION MODAL ============ */

.celebration-modal {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.celebration-modal .modal-content {
    background: transparent;
    border: none;
}

.celebration-modal .modal-body {
    text-align: center;
    padding: 3rem;
}

.celebration-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
    animation: bounceIn 0.6s ease-out;
}

@keyframes bounceIn {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

.celebration-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    animation: fadeInUp 0.5s ease-out 0.2s both;
}

.celebration-subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 2rem;
    animation: fadeInUp 0.5s ease-out 0.4s both;
}

.celebration-action {
    animation: fadeInUp 0.5s ease-out 0.6s both;
}

/* ============ MILESTONE BADGES ============ */

.milestone-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.875rem;
    animation: popIn 0.4s ease-out;
}

.milestone-badge.badge-bronze {
    background: linear-gradient(135deg, #cd7f32 0%, #b8860b 100%);
    color: white;
}

.milestone-badge.badge-silver {
    background: linear-gradient(135deg, #c0c0c0 0%, #a8a8a8 100%);
    color: #333;
}

.milestone-badge.badge-gold {
    background: linear-gradient(135deg, #ffd700 0%, #ffb700 100%);
    color: #333;
}

.milestone-badge.badge-platinum {
    background: linear-gradient(135deg, #e5e4e2 0%, #c9c9c9 100%);
    color: #333;
    box-shadow: 0 0 20px rgba(229, 228, 226, 0.5);
}

@keyframes popIn {
    0% { transform: scale(0) rotate(-10deg); opacity: 0; }
    70% { transform: scale(1.1) rotate(5deg); }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}

/* ============ STREAK COUNTER ============ */

.streak-counter {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8e53 100%);
    color: white;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.9rem;
}

.streak-counter .streak-fire {
    animation: flicker 0.5s ease-in-out infinite alternate;
}

@keyframes flicker {
    from { transform: scale(1) rotate(-5deg); }
    to { transform: scale(1.1) rotate(5deg); }
}

/* ============ ENTRANCE ANIMATIONS ============ */

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

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

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

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

/* Staggered entrance for lists */
.stagger-animate > * {
    animation: fadeInUp 0.4s ease-out both;
}

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

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

@keyframes fadeInUp {
    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 scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ============ SCORE CELEBRATION ============ */

.score-circle {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto;
}

.score-circle-bg {
    fill: none;
    stroke: #e5e7eb;
    stroke-width: 8;
}

.score-circle-fill {
    fill: none;
    stroke-width: 8;
    stroke-linecap: round;
    transform: rotate(-90deg);
    transform-origin: center;
    animation: circleProgress 1s ease-out forwards;
    stroke-dasharray: 0 283;
}

.score-circle-fill.excellent { stroke: #16a34a; }
.score-circle-fill.good { stroke: #3b82f6; }
.score-circle-fill.needs-work { stroke: #f59e0b; }
.score-circle-fill.failed { stroke: #ef4444; }

@keyframes circleProgress {
    to {
        stroke-dasharray: var(--score-dasharray, 0 283);
    }
}

.score-number {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    font-weight: 700;
}

.score-number .score-value {
    animation: countUp 1s ease-out;
}

/* ============ PULSE & GLOW EFFECTS ============ */

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

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(44, 75, 255, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(44, 75, 255, 0.8), 0 0 40px rgba(44, 75, 255, 0.4);
    }
}

/* Success state glow */
.success-glow {
    animation: successGlow 0.6s ease-out;
}

@keyframes successGlow {
    0% {
        box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.7);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(22, 163, 74, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(22, 163, 74, 0);
    }
}

/* ============ LOADING STATES ============ */

.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.btn-loading.btn-primary::before,
.btn-loading.btn-success::before {
    border-top-color: white;
}

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

/* ============ COUNTER ANIMATION ============ */

.counter-animate {
    display: inline-block;
}

/* ============ FLOATING ACTION ============ */

.floating-cta {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
    animation: floatBounce 3s ease-in-out infinite;
}

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

/* ============ ONBOARDING MODAL ============ */

.onboarding-modal .modal-content {
    border: none;
    border-radius: 20px;
    overflow: hidden;
}

.onboarding-header {
    background: linear-gradient(135deg, #2c4bff 0%, #7c3aed 100%);
    color: white;
    padding: 3rem 2rem;
    text-align: center;
}

.onboarding-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 4px solid white;
    margin-bottom: 1rem;
    animation: bounceIn 0.6s ease-out;
}

.onboarding-welcome {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.onboarding-body {
    padding: 2rem;
}

.onboarding-feature {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid #f3f4f6;
}

.onboarding-feature:last-child {
    border-bottom: none;
}

.onboarding-feature-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.onboarding-feature-icon.blue { background: #dbeafe; color: #2563eb; }
.onboarding-feature-icon.green { background: #dcfce7; color: #16a34a; }
.onboarding-feature-icon.purple { background: #f3e8ff; color: #7c3aed; }
.onboarding-feature-icon.orange { background: #ffedd5; color: #ea580c; }

/* ============ ACCESSIBILITY ============ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============ RESPONSIVE ADJUSTMENTS ============ */

@media (max-width: 768px) {
    .wow-toast {
        min-width: 280px;
        max-width: calc(100vw - 40px);
    }

    .toast-container {
        left: 20px;
        right: 20px;
    }

    .celebration-icon {
        font-size: 4rem;
    }

    .celebration-title {
        font-size: 1.5rem;
    }

    .floating-cta {
        bottom: 20px;
        right: 20px;
    }
}
