/* Animations */

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

/* Growing Flower Loader */
.loading-state {
    text-align: center;
    padding: var(--spacing-3xl);
}

.flower-loader {
    display: inline-block;
    position: relative;
    width: 100px;
    height: 120px;
    margin: 0 auto var(--spacing-xl);
}

.flower-stem {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 4px;
    height: 0;
    background: linear-gradient(to top, var(--color-primary-dark), var(--color-primary));
    transform: translateX(-50%);
    animation: growStem 1.5s ease-out forwards;
    border-radius: 2px;
}

.flower-bloom {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 60px;
    animation: riseBloom 1.5s ease-out forwards;
}

.petal {
    position: absolute;
    width: 24px;
    height: 32px;
    background: linear-gradient(135deg, var(--color-accent-coral), var(--color-accent-peach));
    border-radius: 50% 50% 50% 0;
    opacity: 0;
    transform-origin: bottom right;
}

.petal:nth-child(1) {
    top: -10px;
    left: 50%;
    transform: translateX(-50%) rotate(-90deg);
    animation: bloomPetal 0.6s ease-out 1s forwards;
}

.petal:nth-child(2) {
    top: 8px;
    right: -6px;
    transform: rotate(-18deg);
    animation: bloomPetal 0.6s ease-out 1.2s forwards;
}

.petal:nth-child(3) {
    bottom: -2px;
    right: 4px;
    transform: rotate(54deg);
    animation: bloomPetal 0.6s ease-out 1.4s forwards;
}

.petal:nth-child(4) {
    bottom: -2px;
    left: 4px;
    transform: rotate(126deg);
    animation: bloomPetal 0.6s ease-out 1.6s forwards;
}

.petal:nth-child(5) {
    top: 8px;
    left: -6px;
    transform: rotate(198deg);
    animation: bloomPetal 0.6s ease-out 1.8s forwards;
}

/* Flower center */
.flower-bloom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    background: radial-gradient(circle, var(--color-accent-yellow), #FDD835);
    border-radius: 50%;
    opacity: 0;
    animation: bloomCenter 0.4s ease-out 2s forwards;
    box-shadow: 0 0 10px rgba(255, 235, 59, 0.5);
}

@keyframes growStem {
    from {
        height: 0;
    }
    to {
        height: 60px;
    }
}

@keyframes riseBloom {
    from {
        top: 120px;
    }
    to {
        top: 0;
    }
}

@keyframes bloomPetal {
    from {
        opacity: 0;
        transform: scale(0) rotate(0deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotate(var(--rotate, 0deg));
    }
}

.petal:nth-child(1) { --rotate: -90deg; }
.petal:nth-child(2) { --rotate: -18deg; }
.petal:nth-child(3) { --rotate: 54deg; }
.petal:nth-child(4) { --rotate: 126deg; }
.petal:nth-child(5) { --rotate: 198deg; }

@keyframes bloomCenter {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Infinite rotation after bloom */
.flower-loader {
    animation: growFlower 2.4s ease-out forwards, rotateFlower 3s linear 2.4s infinite;
}

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

@keyframes growFlower {
    from {
        transform: scale(0.8);
    }
    to {
        transform: scale(1);
    }
}

/* Loading Text Animation */
.loading-text {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    color: var(--color-primary-dark);
    animation: fadeInOut 2s ease-in-out infinite;
}

@keyframes fadeInOut {
    0%, 100% {
        opacity: 0.5;
    }
    50% {
        opacity: 1;
    }
}

/* Floating Leaves Background (optional enhancement) */
.floating-leaf {
    position: fixed;
    font-size: 2rem;
    opacity: 0.2;
    animation: float-diagonal 15s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes float-diagonal {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }
    50% {
        transform: translate(50px, 50px) rotate(180deg);
    }
    100% {
        transform: translate(0, 0) rotate(360deg);
    }
}

/* Result Display Fade In */
.result-display {
    animation: fadeInScale 0.5s ease-out;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Button Organic Hover Effect */
.btn-primary {
    position: relative;
    overflow: hidden;
}

.btn-primary::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;
}

.btn-primary:hover::before {
    width: 300px;
    height: 300px;
}

/* Smooth Transitions */
* {
    transition-property: background-color, border-color, color, fill, stroke, opacity, box-shadow, transform;
    transition-duration: var(--transition-base);
    transition-timing-function: ease-in-out;
}

button,
a,
input,
textarea {
    transition-property: all;
}
