/**
 * Just Smile Dental & ENT Specialities - Animations
 * Smooth animations and transitions
 */

/* ==================== FADE IN ANIMATIONS ==================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

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

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

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

/* ==================== SCALE ANIMATIONS ==================== */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

/* ==================== SLIDE ANIMATIONS ==================== */
@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

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

/* ==================== ROTATE ANIMATIONS ==================== */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

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

/* ==================== UTILITY CLASSES ==================== */
.fade-in {
    animation: fadeInUp 0.8s ease-out;
}

.fade-in-delay-1 {
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

.fade-in-delay-2 {
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

.fade-in-delay-3 {
    animation: fadeInUp 0.8s ease-out 0.6s both;
}

/* ==================== SCROLL REVEAL ==================== */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease-out;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* ==================== HOVER EFFECTS ==================== */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

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

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

/* ==================== LOADING SPINNER ==================== */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(8, 145, 178, 0.2);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ==================== SHIMMER EFFECT ==================== */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

/* ==================== TYPING ANIMATION ==================== */
@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blink {
    50% {
        border-color: transparent;
    }
}

.typing-effect {
    overflow: hidden;
    border-right: 2px solid var(--primary-color);
    white-space: nowrap;
    animation: typing 3s steps(40) 1s both, blink 0.75s step-end infinite;
}

/* ==================== GRADIENT ANIMATION ==================== */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.animated-gradient {
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
}

/* ==================== FLOAT ANIMATION ==================== */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

.float {
    animation: float 3s ease-in-out infinite;
}

/* ==================== GLOW EFFECT ==================== */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(8, 145, 178, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(8, 145, 178, 0.8);
    }
}

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

/* ==================== PROGRESS BAR ANIMATION ==================== */
@keyframes progress {
    from {
        width: 0;
    }
}

.progress-bar {
    animation: progress 1.5s ease-out forwards;
}

/* ==================== NOTIFICATION SLIDE IN ==================== */
@keyframes slideInNotification {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification-enter {
    animation: slideInNotification 0.5s ease-out;
}

/* ==================== CARD FLIP ==================== */
.flip-card {
    perspective: 1000px;
}

.flip-card-inner {
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.flip-card:hover .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
    backface-visibility: hidden;
}

.flip-card-back {
    transform: rotateY(180deg);
}

/* ==================== RIPPLE EFFECT ==================== */
@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

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

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

.ripple:active::after {
    width: 300px;
    height: 300px;
}

/* ==================== SKELETON LOADING ==================== */
@keyframes skeleton-loading {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 0px, #e0e0e0 40px, #f0f0f0 80px);
    background-size: 200px 100%;
    animation: skeleton-loading 1.5s infinite;
}

/* ==================== PAGE TRANSITION ==================== */
.page-transition {
    animation: fadeIn 0.5s ease-in;
}

/* ==================== SMOOTH SCROLL BEHAVIOR ==================== */
html {
    scroll-behavior: smooth;
}

/* ==================== INTERSECTION OBSERVER ANIMATIONS ==================== */
.observe-fade {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.observe-fade.observed {
    opacity: 1;
    transform: translateY(0);
}

.observe-scale {
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.observe-scale.observed {
    opacity: 1;
    transform: scale(1);
}

/* ==================== STAGGER ANIMATIONS ==================== */
.stagger-item {
    opacity: 0;
    transform: translateY(20px);
}

.stagger-item:nth-child(1) { animation: fadeInUp 0.6s ease-out 0.1s forwards; }
.stagger-item:nth-child(2) { animation: fadeInUp 0.6s ease-out 0.2s forwards; }
.stagger-item:nth-child(3) { animation: fadeInUp 0.6s ease-out 0.3s forwards; }
.stagger-item:nth-child(4) { animation: fadeInUp 0.6s ease-out 0.4s forwards; }
.stagger-item:nth-child(5) { animation: fadeInUp 0.6s ease-out 0.5s forwards; }
.stagger-item:nth-child(6) { animation: fadeInUp 0.6s ease-out 0.6s forwards; }

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