/**
 * Loading Spinner Animations
 */

/* Spinner container */
.spinner-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.3s ease;
}

.spinner-container.fade-out {
    opacity: 0;
    pointer-events: none;
}

/* Spinner */
.spinner {
    width: 60px;
    height: 60px;
    position: relative;
}

.spinner-ring {
    width: 100%;
    height: 100%;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Double ring spinner */
.spinner-double {
    width: 60px;
    height: 60px;
    position: relative;
}

.spinner-double::before,
.spinner-double::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: white;
}

.spinner-double::before {
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
}

.spinner-double::after {
    width: 45px;
    height: 45px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: spin 0.7s linear infinite reverse;
}

/* Pulsing dots spinner */
.spinner-dots {
    display: flex;
    gap: 10px;
}

.spinner-dot {
    width: 15px;
    height: 15px;
    background: white;
    border-radius: 50%;
    animation: pulse 1.4s ease-in-out infinite;
}

.spinner-dot:nth-child(1) {
    animation-delay: 0s;
}

.spinner-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.spinner-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes pulse {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Loading text */
.spinner-text {
    color: white;
    margin-top: 20px;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    animation: fadeInOut 2s ease-in-out infinite;
}

@keyframes fadeInOut {
    0%, 100% {
        opacity: 0.5;
    }
    50% {
        opacity: 1;
    }
}

/* Button loading state */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 3px solid transparent;
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Inline spinner (for smaller elements) */
.spinner-inline {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

/* Progress bar */
.progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 20px;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    animation: progress 2s ease-in-out infinite;
    transform-origin: left;
}

@keyframes progress {
    0% {
        transform: scaleX(0);
    }
    50% {
        transform: scaleX(0.7);
    }
    100% {
        transform: scaleX(1);
    }
}

/* Skeleton loader */
.skeleton {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.1) 25%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0.1) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.skeleton-text {
    height: 16px;
    margin-bottom: 10px;
}

.skeleton-title {
    height: 24px;
    width: 60%;
    margin-bottom: 15px;
}

/* Overlay spinner */
.overlay-spinner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    border-radius: inherit;
}

/* Circular progress */
.circular-progress {
    width: 60px;
    height: 60px;
    position: relative;
}

.circular-progress svg {
    transform: rotate(-90deg);
}

.circular-progress-circle {
    fill: none;
    stroke: rgba(255, 255, 255, 0.2);
    stroke-width: 4;
}

.circular-progress-bar {
    fill: none;
    stroke: white;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 188.5;
    stroke-dashoffset: 188.5;
    animation: circularProgress 2s ease-in-out infinite;
}

@keyframes circularProgress {
    0% {
        stroke-dashoffset: 188.5;
    }
    50% {
        stroke-dashoffset: 47.1;
    }
    100% {
        stroke-dashoffset: 188.5;
    }
}
