/**
 * Zen Loading Animations for Yoga Tarot
 *
 * A collection of playful, meditation-inspired loading animations
 * that provide a calming, engaging experience while content loads.
 * 
 * Features Stiky, our zen yogi mascot, who provides guidance and humor
 * during loading transitions.
 */

/* Main loader container */
.zen-loader-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.8s ease-out, visibility 0.8s ease-out;
}

.zen-loader-container.hidden {
    opacity: 0;
    visibility: hidden;
}

/* Loader title */
.zen-loader-title {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: #fff;
    font-weight: 300;
    letter-spacing: 2px;
    text-align: center;
}

/* Loader subtitle */
.zen-loader-subtitle {
    font-size: 1rem;
    margin-top: 1.5rem;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    max-width: 600px;
    line-height: 1.6;
}

/* Message container */
.zen-loader-message {
    margin-top: 2rem;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    background-color: rgba(0, 0, 0, 0.2);
    color: #fff;
    font-size: 0.9rem;
    text-align: center;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.zen-loader-message.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Breathing circle animation */
.zen-breathing-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: radial-gradient(circle at center, rgba(72, 52, 212, 0.8), rgba(48, 43, 99, 0.5));
    box-shadow: 0 0 30px rgba(72, 52, 212, 0.5);
    animation: breathe 6s infinite ease-in-out;
    position: relative;
}

@keyframes breathe {
    0%, 100% {
        transform: scale(0.8);
        box-shadow: 0 0 10px rgba(72, 52, 212, 0.3);
    }
    50% {
        transform: scale(1.2);
        box-shadow: 0 0 40px rgba(72, 52, 212, 0.6);
    }
}

/* Om symbol animation */
.zen-om-symbol {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    color: rgba(255, 255, 255, 0.9);
    animation: pulse 6s infinite ease-in-out;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.7;
        transform: translate(-50%, -50%) scale(0.9);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }
}

/* Lotus flower animation */
.zen-lotus-container {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto;
}

.zen-lotus-petal {
    position: absolute;
    width: 50px;
    height: 80px;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 50% 50% 50% 50% / 80% 80% 20% 20%;
    top: 50%;
    left: 50%;
    transform-origin: bottom center;
    animation: lotus-bloom 8s infinite ease-in-out;
}

.zen-lotus-petal:nth-child(1) { transform: translate(-50%, -100%) rotate(0deg); animation-delay: 0s; }
.zen-lotus-petal:nth-child(2) { transform: translate(-50%, -100%) rotate(40deg); animation-delay: 0.2s; }
.zen-lotus-petal:nth-child(3) { transform: translate(-50%, -100%) rotate(80deg); animation-delay: 0.4s; }
.zen-lotus-petal:nth-child(4) { transform: translate(-50%, -100%) rotate(120deg); animation-delay: 0.6s; }
.zen-lotus-petal:nth-child(5) { transform: translate(-50%, -100%) rotate(160deg); animation-delay: 0.8s; }
.zen-lotus-petal:nth-child(6) { transform: translate(-50%, -100%) rotate(200deg); animation-delay: 1.0s; }
.zen-lotus-petal:nth-child(7) { transform: translate(-50%, -100%) rotate(240deg); animation-delay: 1.2s; }
.zen-lotus-petal:nth-child(8) { transform: translate(-50%, -100%) rotate(280deg); animation-delay: 1.4s; }
.zen-lotus-petal:nth-child(9) { transform: translate(-50%, -100%) rotate(320deg); animation-delay: 1.6s; }

@keyframes lotus-bloom {
    0%, 100% {
        height: 60px;
        opacity: 0.6;
    }
    50% {
        height: 90px;
        opacity: 0.9;
    }
}

.zen-lotus-center {
    position: absolute;
    width: 40px;
    height: 40px;
    background: radial-gradient(circle at center, #ffd700, #ff9500);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    animation: lotus-glow 4s infinite alternate;
}

@keyframes lotus-glow {
    0% {
        box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
        transform: translate(-50%, -50%) scale(0.9);
    }
    100% {
        box-shadow: 0 0 30px rgba(255, 215, 0, 0.8);
        transform: translate(-50%, -50%) scale(1.1);
    }
}

/* Yin Yang animation */
.zen-yinyang {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(90deg, #fff 0%, #fff 50%, #000 50%, #000 100%);
    position: relative;
    animation: rotate 10s linear infinite;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.zen-yinyang::before,
.zen-yinyang::after {
    content: "";
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    top: 15px;
}

.zen-yinyang::before {
    left: 15px;
    background: radial-gradient(circle at center, #000 0%, #000 25%, #fff 25%, #fff 100%);
}

.zen-yinyang::after {
    right: 15px;
    background: radial-gradient(circle at center, #fff 0%, #fff 25%, #000 25%, #000 100%);
}

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

/* Progress indicator */
.zen-progress-container {
    width: 200px;
    height: 4px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    margin-top: 20px;
    overflow: hidden;
}

.zen-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #593196, #8e44ad);
    transition: width 0.3s ease;
    border-radius: 2px;
}

/* Loading dots animation */
.zen-loading-dots {
    display: flex;
    gap: 8px;
    margin-top: 15px;
}

.zen-loading-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #fff;
    animation: dot-pulse 1.5s infinite ease-in-out;
}

.zen-loading-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.zen-loading-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dot-pulse {
    0%, 100% {
        transform: scale(0.5);
        opacity: 0.5;
    }
    50% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Mandala loader */
.zen-mandala {
    position: relative;
    width: 180px;
    height: 180px;
}

.zen-mandala-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
}

.zen-mandala-ring:nth-child(1) {
    width: 40px;
    height: 40px;
    border-color: rgba(255, 255, 255, 0.9);
    animation: mandala-rotate 4s linear infinite;
}

.zen-mandala-ring:nth-child(2) {
    width: 80px;
    height: 80px;
    border-color: rgba(255, 255, 255, 0.7);
    animation: mandala-rotate 6s linear infinite reverse;
}

.zen-mandala-ring:nth-child(3) {
    width: 120px;
    height: 120px;
    border-color: rgba(255, 255, 255, 0.5);
    animation: mandala-rotate 8s linear infinite;
}

.zen-mandala-ring:nth-child(4) {
    width: 160px;
    height: 160px;
    border-color: rgba(255, 255, 255, 0.3);
    animation: mandala-rotate 10s linear infinite reverse;
}

@keyframes mandala-rotate {
    from {
        transform: translate(-50%, -50%) rotate(0deg);
    }
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Quote display */
.zen-quote {
    margin-top: 2rem;
    max-width: 600px;
    text-align: center;
    color: #fff;
    padding: 1rem;
    border-radius: 8px;
    background-color: rgba(0, 0, 0, 0.2);
    font-style: italic;
}

.zen-quote-text {
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.zen-quote-author {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .zen-loader-title {
        font-size: 1.5rem;
    }
    
    .zen-breathing-circle {
        width: 120px;
        height: 120px;
    }
    
    .zen-lotus-container {
        width: 160px;
        height: 160px;
    }
    
    .zen-yinyang {
        width: 100px;
        height: 100px;
    }
    
    .zen-mandala {
        width: 150px;
        height: 150px;
    }
    
    .zen-quote {
        max-width: 95%;
        padding: 0.75rem;
    }
}

/* Animation alternator for different page loads */
.zen-loader-container[data-variation="1"] .zen-breathing-circle { display: flex; }
.zen-loader-container[data-variation="1"] .zen-lotus-container { display: none; }
.zen-loader-container[data-variation="1"] .zen-yinyang { display: none; }
.zen-loader-container[data-variation="1"] .zen-mandala { display: none; }

.zen-loader-container[data-variation="2"] .zen-breathing-circle { display: none; }
.zen-loader-container[data-variation="2"] .zen-lotus-container { display: block; }
.zen-loader-container[data-variation="2"] .zen-yinyang { display: none; }
.zen-loader-container[data-variation="2"] .zen-mandala { display: none; }

.zen-loader-container[data-variation="3"] .zen-breathing-circle { display: none; }
.zen-loader-container[data-variation="3"] .zen-lotus-container { display: none; }
.zen-loader-container[data-variation="3"] .zen-yinyang { display: block; }
.zen-loader-container[data-variation="3"] .zen-mandala { display: none; }

.zen-loader-container[data-variation="4"] .zen-breathing-circle { display: none; }
.zen-loader-container[data-variation="4"] .zen-lotus-container { display: none; }
.zen-loader-container[data-variation="4"] .zen-yinyang { display: none; }
.zen-loader-container[data-variation="4"] .zen-mandala { display: block; }

/* Stiky - Zen Yogi Character */
.zen-stiky-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 150px;
    height: 150px;
    z-index: 10000;
    pointer-events: none;
    transition: transform 0.5s ease-in-out;
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.5));
}

.zen-stiky-figure {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.zen-stiky-pose {
    font-size: 70px;
    line-height: 1;
    transform-origin: center bottom;
    animation: stiky-wobble 5s infinite ease-in-out;
}

.zen-stiky-message {
    position: absolute;
    top: -50px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 8px 15px;
    border-radius: 15px;
    font-size: 14px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    text-align: center;
    min-width: 180px;
    pointer-events: none;
    font-family: 'Courier New', monospace;
}

.zen-stiky-message.show {
    opacity: 1;
}

.zen-stiky-message::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid rgba(0, 0, 0, 0.6);
}

@keyframes stiky-wobble {
    0%, 100% {
        transform: rotate(-5deg);
    }
    50% {
        transform: rotate(5deg);
    }
}

.zen-stiky-emote {
    position: absolute;
    font-size: 20px;
    top: 10px;
    right: 10px;
    animation: float-emote 2s infinite ease-in-out;
    opacity: 0.9;
}

@keyframes float-emote {
    0%, 100% {
        transform: translateY(0) rotate(0);
    }
    50% {
        transform: translateY(-10px) rotate(10deg);
    }
}