/**
 * CSS Animasyonlari
 * Italyan Kultur Merkezi
 */

/* ========================================
   Keyframe Animations
   ======================================== */

/* Fade In */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

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

/* Fade In Left */
@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Fade In Right */
@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

/* Check Pop (for selection cards) */
@keyframes checkPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.3);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Shake (for validation errors) */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

/* Pulse */
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* Bounce */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

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

/* Slide In Up */
@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Progress Bar */
@keyframes progressBar {
    from {
        width: 0%;
    }
    to {
        width: 100%;
    }
}

/* Ripple Effect */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

/* Glow */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(13, 110, 253, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(13, 110, 253, 0.8);
    }
}

/* ========================================
   Animation Classes
   ======================================== */

.animate-fadeIn {
    animation: fadeIn 0.5s ease forwards;
}

.animate-fadeInUp {
    animation: fadeInUp 0.5s ease forwards;
}

.animate-fadeInDown {
    animation: fadeInDown 0.5s ease forwards;
}

.animate-fadeInLeft {
    animation: fadeInLeft 0.5s ease forwards;
}

.animate-fadeInRight {
    animation: fadeInRight 0.5s ease forwards;
}

.animate-scaleIn {
    animation: scaleIn 0.3s ease forwards;
}

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

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

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

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

.animate-slideInUp {
    animation: slideInUp 0.5s ease forwards;
}

.animate-glow {
    animation: glow 2s ease infinite;
}

/* ========================================
   Staggered Animations (children)
   ======================================== */

.stagger-animation > * {
    opacity: 0;
    animation: fadeInUp 0.5s ease forwards;
}

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

/* ========================================
   Form Field Animations
   ======================================== */

/* Focus lift effect */
.form-control,
.form-select {
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.form-control:focus,
.form-select:focus {
    transform: translateY(-2px);
}

/* Label float animation */
.form-floating > label {
    transition: all 0.2s ease;
}

/* Input validation animations */
.form-control.is-invalid {
    animation: shake 0.5s ease;
}

.form-control.is-valid {
    animation: pulse 0.3s ease;
}

/* ========================================
   Button Animations
   ======================================== */

.btn {
    position: relative;
    overflow: hidden;
}

/* Ripple effect on click */
.btn-ripple::after {
    content: '';
    position: absolute;
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: scale(0);
    pointer-events: none;
}

.btn-ripple:active::after {
    animation: ripple 0.6s ease;
}

/* Button hover lift */
.btn-hover-lift {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

/* ========================================
   Card Animations
   ======================================== */

.card-animated {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-animated:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

/* Selection card animations */
.selection-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.selection-card:hover {
    transform: translateY(-4px) scale(1.02);
}

.selection-card.selected {
    animation: pulse 0.3s ease;
}

/* ========================================
   Page Transitions
   ======================================== */

.page-enter {
    opacity: 0;
    transform: translateY(20px);
}

.page-enter-active {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.4s ease;
}

.page-exit {
    opacity: 1;
    transform: translateY(0);
}

.page-exit-active {
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
}

/* ========================================
   Step Transitions
   ======================================== */

.form-step {
    display: none;
    opacity: 0;
}

.form-step.active {
    display: block;
    animation: fadeInRight 0.4s ease forwards;
}

.form-step.exit {
    animation: fadeInLeft 0.3s ease reverse forwards;
}

/* ========================================
   Loading Animations
   ======================================== */

.spinner-border-custom {
    width: 3rem;
    height: 3rem;
    border-width: 0.3rem;
}

.loading-dots {
    display: flex;
    gap: 0.5rem;
}

.loading-dots span {
    width: 10px;
    height: 10px;
    background-color: var(--primary-color);
    border-radius: 50%;
    animation: bounce 1.4s ease infinite;
}

.loading-dots span:nth-child(1) { animation-delay: 0s; }
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

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

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

/* ========================================
   Notification Animations
   ======================================== */

.toast-animated {
    animation: slideInUp 0.3s ease forwards;
}

.alert-animated {
    animation: fadeInDown 0.4s ease forwards;
}

/* ========================================
   Icon Animations
   ======================================== */

.icon-spin {
    animation: spin 2s linear infinite;
}

.icon-pulse {
    animation: pulse 1.5s ease infinite;
}

.icon-bounce {
    animation: bounce 2s ease infinite;
}

/* ========================================
   Hover Effects
   ======================================== */

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

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

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

.hover-rotate:hover {
    transform: rotate(5deg);
}

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

.hover-shadow:hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

/* ========================================
   Reduced Motion
   ======================================== */

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