/* Adaptive Loading Animations for Meditation Routes */

.loading-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    background-color: rgba(255, 255, 255, 0.9);
    transition: opacity 0.5s ease, visibility 0.5s ease;
    backdrop-filter: blur(5px);
}

.loading-container.hidden {
    opacity: 0;
    visibility: hidden;
}

/* Base loading animation */
.loading-animation {
    position: relative;
    width: 150px;
    height: 150px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.loading-text {
    margin-top: 20px;
    font-family: 'Rubik', sans-serif;
    font-size: 16px;
    color: var(--primary-color, #4a6da7);
    text-align: center;
    max-width: 200px;
}

/* Breathing animation */
.loading-breath {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--primary-color, #4a6da7) 0%, var(--accent-color, #c4d7ff) 100%);
    animation: breathe 4s ease-in-out infinite;
}

@keyframes breathe {
    0%, 100% {
        transform: scale(0.8);
        box-shadow: 0 0 0 rgba(74, 109, 167, 0.4);
    }
    50% {
        transform: scale(1.2);
        box-shadow: 0 0 30px rgba(74, 109, 167, 0.6);
    }
}

/* Flowing animation */
.loading-flow {
    width: 100px;
    height: 100px;
    position: relative;
}

.loading-flow .wave {
    position: absolute;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 2px solid var(--primary-color, #4a6da7);
    opacity: 0;
    animation: flow 3s infinite;
}

.loading-flow .wave:nth-child(2) {
    animation-delay: 0.5s;
}

.loading-flow .wave:nth-child(3) {
    animation-delay: 1s;
}

@keyframes flow {
    0% {
        transform: scale(0.5);
        opacity: 1;
    }
    100% {
        transform: scale(1.8);
        opacity: 0;
    }
}

/* Lotus animation */
.loading-lotus {
    width: 100px;
    height: 100px;
    position: relative;
}

.loading-lotus .petal {
    position: absolute;
    width: 30px;
    height: 60px;
    background: var(--accent-color, #c4d7ff);
    border-radius: 100% 0% 100% 0%;
    top: 20px;
    left: 35px;
    transform-origin: bottom center;
    animation: lotus-bloom 4s ease-in-out infinite;
}

.loading-lotus .petal:nth-child(2) {
    transform: rotate(45deg);
    animation-delay: 0.25s;
}

.loading-lotus .petal:nth-child(3) {
    transform: rotate(90deg);
    animation-delay: 0.5s;
}

.loading-lotus .petal:nth-child(4) {
    transform: rotate(135deg);
    animation-delay: 0.75s;
}

.loading-lotus .petal:nth-child(5) {
    transform: rotate(180deg);
    animation-delay: 1s;
}

.loading-lotus .petal:nth-child(6) {
    transform: rotate(225deg);
    animation-delay: 1.25s;
}

.loading-lotus .petal:nth-child(7) {
    transform: rotate(270deg);
    animation-delay: 1.5s;
}

.loading-lotus .petal:nth-child(8) {
    transform: rotate(315deg);
    animation-delay: 1.75s;
}

.loading-lotus .center {
    position: absolute;
    width: 30px;
    height: 30px;
    background: var(--primary-color, #4a6da7);
    border-radius: 50%;
    top: 35px;
    left: 35px;
    z-index: 1;
}

@keyframes lotus-bloom {
    0%, 100% {
        height: 60px;
        background: var(--accent-color, #c4d7ff);
    }
    50% {
        height: 70px;
        background: var(--primary-color, #4a6da7);
    }
}

/* Om symbol animation */
.loading-om {
    width: 80px;
    height: 80px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.loading-om svg {
    width: 100%;
    height: 100%;
    fill: var(--primary-color, #4a6da7);
    animation: om-pulse 3s ease-in-out infinite;
}

@keyframes om-pulse {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 0 5px rgba(74, 109, 167, 0.5));
    }
    50% {
        transform: scale(1.2);
        filter: drop-shadow(0 0 15px rgba(74, 109, 167, 0.8));
    }
}

/* Mountain pose animation */
.loading-mountain {
    width: 100px;
    height: 100px;
    position: relative;
}

.loading-mountain .mountain {
    position: absolute;
    width: 0;
    height: 0;
    border-left: 40px solid transparent;
    border-right: 40px solid transparent;
    border-bottom: 70px solid var(--primary-color, #4a6da7);
    opacity: 0.7;
    bottom: 15px;
    left: 10px;
    animation: mountain-grow 3s ease-in-out infinite;
}

.loading-mountain .mountain:nth-child(2) {
    left: 25px;
    bottom: 15px;
    border-bottom: 80px solid var(--secondary-color, #8baae8);
    border-left: 30px solid transparent;
    border-right: 30px solid transparent;
    z-index: -1;
    animation-delay: 0.5s;
}

@keyframes mountain-grow {
    0%, 100% {
        transform: scaleY(1);
    }
    50% {
        transform: scaleY(1.1);
    }
}

/* Progress bar for loading */
.loading-progress {
    width: 150px;
    height: 5px;
    background-color: rgba(74, 109, 167, 0.2);
    border-radius: 10px;
    margin-top: 15px;
    overflow: hidden;
}

.loading-progress-bar {
    height: 100%;
    background-color: var(--primary-color, #4a6da7);
    border-radius: 10px;
    width: 0%;
    transition: width 0.3s ease;
}

/* Adaptive colors based on energy types */
.energy-active .loading-breath {
    background: radial-gradient(circle, #e05252 0%, #ffb88e 100%);
}

.energy-active .loading-lotus .petal {
    background: #ffb88e;
}

.energy-active .loading-lotus .center {
    background: #e05252;
}

.energy-active .loading-om svg {
    fill: #e05252;
}

.energy-active .loading-mountain .mountain {
    border-bottom-color: #e05252;
}

.energy-active .loading-mountain .mountain:nth-child(2) {
    border-bottom-color: #ffb88e;
}

.energy-active .loading-progress-bar {
    background-color: #e05252;
}

.energy-contemplative .loading-breath {
    background: radial-gradient(circle, #41729f 0%, #5885af 100%);
}

.energy-contemplative .loading-lotus .petal {
    background: #5885af;
}

.energy-contemplative .loading-lotus .center {
    background: #41729f;
}

.energy-contemplative .loading-om svg {
    fill: #41729f;
}

.energy-contemplative .loading-mountain .mountain {
    border-bottom-color: #41729f;
}

.energy-contemplative .loading-mountain .mountain:nth-child(2) {
    border-bottom-color: #5885af;
}

.energy-contemplative .loading-progress-bar {
    background-color: #41729f;
}

/* Adaptive animations based on mood */
.mood-peaceful .loading-breath {
    animation-duration: 5s;
}

.mood-powerful .loading-breath {
    animation-duration: 3s;
}

.mood-flowing .loading-breath {
    animation-duration: 4s;
}

/* Media queries for responsive design */
@media (max-width: 768px) {
    .loading-animation {
        width: 120px;
        height: 120px;
    }
    
    .loading-text {
        font-size: 14px;
    }
    
    .loading-progress {
        width: 120px;
    }
}