/* Animations Stylesheet - Genealogy App v8.0 */

/* Keyframe 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 slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.3);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes zoomOut {
    from {
        opacity: 1;
        transform: scale(1);
    }

    to {
        opacity: 0;
        transform: scale(0.3);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

@keyframes heartbeat {
    0%, 100% {
        transform: scale(1);
    }

    10%, 30% {
        transform: scale(1.1);
    }

    20% {
        transform: scale(1.15);
    }
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }

    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }

    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-20px);
    }

    60% {
        transform: translateY(-10px);
    }
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes rotateIn {
    from {
        transform: rotate(-200deg);
        opacity: 0;
    }

    to {
        transform: rotate(0);
        opacity: 1;
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }

    100% {
        background-position: 1000px 0;
    }
}

@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }

    100% {
        transform: scale(4);
        opacity: 0;
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(99, 102, 241, 0.5);
    }

    50% {
        box-shadow: 0 0 20px rgba(99, 102, 241, 0.8);
    }
}

/* Animation Classes */
.animate-fadeIn {
    animation: fadeIn 0.5s ease-in-out;
}

.animate-fadeInUp {
    animation: fadeInUp 0.5s ease-in-out;
}

.animate-fadeInDown {
    animation: fadeInDown 0.5s ease-in-out;
}

.animate-fadeInLeft {
    animation: fadeInLeft 0.5s ease-in-out;
}

.animate-fadeInRight {
    animation: fadeInRight 0.5s ease-in-out;
}

.animate-slideInUp {
    animation: slideInUp 0.5s ease-in-out;
}

.animate-slideInDown {
    animation: slideInDown 0.5s ease-in-out;
}

.animate-slideInLeft {
    animation: slideInLeft 0.5s ease-in-out;
}

.animate-slideInRight {
    animation: slideInRight 0.5s ease-in-out;
}

.animate-zoomIn {
    animation: zoomIn 0.5s ease-in-out;
}

.animate-zoomOut {
    animation: zoomOut 0.5s ease-in-out;
}

.animate-pulse {
    animation: pulse 2s infinite;
}

.animate-heartbeat {
    animation: heartbeat 1.5s ease-in-out infinite;
}

.animate-shake {
    animation: shake 0.5s;
}

.animate-bounce {
    animation: bounce 1s;
}

.animate-rotate {
    animation: rotate 2s linear infinite;
}

.animate-rotateIn {
    animation: rotateIn 0.6s ease-in-out;
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

.animate-glow {
    animation: glow 2s ease-in-out infinite;
}

/* Transition Classes */
.transition-all {
    transition: all var(--transition-base);
}

.transition-fast {
    transition: all var(--transition-fast);
}

.transition-slow {
    transition: all var(--transition-slow);
}

.transition-transform {
    transition: transform var(--transition-base);
}

.transition-opacity {
    transition: opacity var(--transition-base);
}

.transition-colors {
    transition: background-color var(--transition-base), color var(--transition-base), border-color var(--transition-base);
}

/* Hover Effects */
.hover-scale:hover {
    transform: scale(1.05);
}

.hover-scale-sm:hover {
    transform: scale(1.02);
}

.hover-scale-lg:hover {
    transform: scale(1.1);
}

.hover-rotate:hover {
    transform: rotate(5deg);
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px var(--shadow);
}

.hover-sink:hover {
    transform: translateY(2px);
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
}

.hover-dim:hover {
    opacity: 0.8;
}

.hover-bright:hover {
    filter: brightness(1.1);
}

/* Loading Animations */
.skeleton-loading {
    position: relative;
    overflow: hidden;
    background: var(--surface);
}

    .skeleton-loading::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: linear-gradient( 90deg, transparent, rgba(255, 255, 255, 0.2), transparent );
        animation: shimmer 2s infinite;
    }

.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: rotate 1s linear infinite;
}

.spinner-sm {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

.spinner-lg {
    width: 60px;
    height: 60px;
    border-width: 4px;
}

/* Pulse Dot */
.pulse-dot {
    position: relative;
    display: inline-block;
    width: 10px;
    height: 10px;
    background: var(--primary);
    border-radius: 50%;
}

    .pulse-dot::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: inherit;
        border-radius: inherit;
        animation: ripple 1.5s ease-out infinite;
    }

/* Page Transitions */
.page-enter {
    opacity: 0;
    transform: translateX(20px);
}

.page-enter-active {
    opacity: 1;
    transform: translateX(0);
    transition: all 0.3s ease-in-out;
}

.page-exit {
    opacity: 1;
    transform: translateX(0);
}

.page-exit-active {
    opacity: 0;
    transform: translateX(-20px);
    transition: all 0.3s ease-in-out;
}

/* Modal Animations */
.modal.fade .modal-dialog {
    transform: scale(0.7);
    opacity: 0;
    transition: all 0.3s ease-in-out;
}

.modal.show .modal-dialog {
    transform: scale(1);
    opacity: 1;
}

/* Card Flip Animation */
.flip-card {
    perspective: 1000px;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.flip-card.flipped .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
}

.flip-card-back {
    transform: rotateY(180deg);
}

/* Accordion Animation */
.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out;
}

    .accordion-content.open {
        max-height: 1000px;
    }

/* Notification Animation */
.notification-enter {
    transform: translateX(100%);
    opacity: 0;
}

.notification-enter-active {
    transform: translateX(0);
    opacity: 1;
    transition: all 0.3s ease-in-out;
}

.notification-exit {
    transform: translateX(0);
    opacity: 1;
}

.notification-exit-active {
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease-in-out;
}

/* Parallax Effect */
.parallax {
    position: relative;
    overflow: hidden;
}

.parallax-layer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.parallax-layer-back {
    transform: translateZ(-2px) scale(3);
}

.parallax-layer-base {
    transform: translateZ(0);
}

.parallax-layer-front {
    transform: translateZ(1px) scale(0.5);
}

/* Morphing Button */
.morph-btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease-in-out;
}

    .morph-btn::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 0;
        height: 0;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.3);
        transform: translate(-50%, -50%);
        transition: width 0.6s, height 0.6s;
    }

    .morph-btn:hover::before {
        width: 300px;
        height: 300px;
    }

/* Text Animation */
.text-reveal {
    position: relative;
    overflow: hidden;
}

    .text-reveal::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: var(--background);
        transform: translateX(-100%);
        animation: reveal 1s ease-in-out forwards;
    }

@keyframes reveal {
    to {
        transform: translateX(100%);
    }
}

/* Gradient Animation */
.gradient-animated {
    background: linear-gradient( -45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab );
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Performance Optimizations */
.will-animate {
    will-change: transform, opacity;
}

.hardware-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
