/* animations.css - All animation-related styles */

/* Keyframe Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

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

@keyframes lineAppear {
    from {
        opacity: 0;
        transform: scaleX(0);
    }

    to {
        opacity: 1;
        transform: scaleX(1);
    }
}

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

    to {
        transform: rotate(360deg);
    }
}

@keyframes glow {
    from {
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    }

    to {
        box-shadow: 0 10px 40px rgba(102, 126, 234, 0.5);
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: translateY(-50%) scale(1);
        opacity: 0.8;
    }

    50% {
        transform: translateY(-50%) scale(1.2);
        opacity: 1;
    }
}

@keyframes flip {

    0%,
    100% {
        transform: rotateY(0deg);
    }

    50% {
        transform: rotateY(1800deg);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% center;
    }

    100% {
        background-position: 200% center;
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes starTwinkle {

    0%,
    100% {
        opacity: 0.3;
    }

    50% {
        opacity: 0.8;
    }
}

/* Animation Classes */
.animate-fadeIn {
    animation: fadeIn 0.8s ease-out;
}

.animate-slideUp {
    animation: slideUp 0.8s ease-out;
}

.animate-rotate {
    animation: rotate 20s linear infinite;
}

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

/* Container Animation */
.container {
    animation: fadeIn 0.8s ease-out;
}

/* Title Animation */
h1::after {
    animation: rotate 20s linear infinite;
}

/* Hexagram Line Animations */
.line {
    animation: lineAppear 0.5s ease-out forwards;
}

.line:nth-child(1) {
    animation-delay: 0s;
}

.line:nth-child(2) {
    animation-delay: 0.1s;
}

.line:nth-child(3) {
    animation-delay: 0.2s;
}

.line:nth-child(4) {
    animation-delay: 0.3s;
}

.line:nth-child(5) {
    animation-delay: 0.4s;
}

.line:nth-child(6) {
    animation-delay: 0.5s;
}

/* Moving Line Animation */
.line.moving .changing-indicator {
    animation: pulse 1s ease-in-out infinite;
}

/* Hexagram Container Animations */
.hexagram.active {
    animation: glow 2s ease-in-out infinite alternate;
}

/* Hexagram Info Animation */
.hexagram-info {
    animation: fadeIn 0.5s ease-out 0.5s forwards;
}

/* Interpretation Animation */
.interpretation {
    animation: slideUp 0.8s ease-out forwards;
}

/* Button Hover Animation */
button {
    position: relative;
    overflow: hidden;
}

button::after {
    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;
}

button:active::after {
    width: 300px;
    height: 300px;
}

/* Loading Animation Variations */
.loading-dots {
    display: inline-flex;
    gap: 5px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-gold);
    animation: loadingDot 1.4s ease-in-out 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;
}

@keyframes loadingDot {

    0%,
    80%,
    100% {
        transform: scale(0);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Coin Animation Enhancements */
.coins-animation.show {
    display: block;
}

.coin {
    animation: flip 0.8s ease-in-out, coinBounce 0.8s ease-out;
}

@keyframes coinBounce {
    0% {
        transform: translateY(-100px);
    }

    50% {
        transform: translateY(0);
    }

    70% {
        transform: translateY(-20px);
    }

    100% {
        transform: translateY(0);
    }
}

/* Text Reveal Animation */
.text-reveal {
    overflow: hidden;
}

.text-reveal span {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px);
    animation: revealText 0.6s ease-out forwards;
}

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

/* Highlight Animation */
.highlight-changing {
    animation: highlightPulse 2s ease-in-out infinite;
}

@keyframes highlightPulse {

    0%,
    100% {
        box-shadow: 0 0 10px rgba(255, 107, 107, 0.5);
    }

    50% {
        box-shadow: 0 0 20px rgba(255, 107, 107, 0.8);
    }
}

/* Background Star Animation */
.star {
    position: fixed;
    width: 2px;
    height: 2px;
    background: white;
    border-radius: 50%;
    opacity: 0;
    animation: starTwinkle 3s ease-in-out infinite;
}

/* Page Transition */
.page-transition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary-bg);
    transform: scaleX(0);
    transform-origin: left;
    animation: pageSlide 0.8s ease-in-out;
}

@keyframes pageSlide {
    0% {
        transform: scaleX(0);
    }

    50% {
        transform: scaleX(1);
    }

    100% {
        transform: scaleX(0);
        transform-origin: right;
    }
}

/* Mobile Touch Feedback */
@media (hover: none) {
    button:active {
        animation: touchFeedback 0.3s ease-out;
    }

    @keyframes touchFeedback {
        0% {
            transform: scale(1);
        }

        50% {
            transform: scale(0.95);
        }

        100% {
            transform: scale(1);
        }
    }
}