/* Modern Loading Animation Styles */

/* Global Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Loading Container */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding: 2rem;
    background: var(--bg-secondary);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Spinner Styles - Multiple Options */

/* 1. Circle Spinner */
.spinner-circle {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(59, 130, 246, 0.2);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* 2. Dual Ring Spinner */
.spinner-dual-ring {
    width: 60px;
    height: 60px;
    position: relative;
}

.spinner-dual-ring::after {
    content: '';
    display: block;
    width: 50px;
    height: 50px;
    margin: 5px;
    border-radius: 50%;
    border: 5px solid #3b82f6;
    border-color: #3b82f6 transparent #3b82f6 transparent;
    animation: dual-ring 1.2s linear infinite;
}

@keyframes dual-ring {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 3. Ripple Effect */
.spinner-ripple {
    width: 80px;
    height: 80px;
    position: relative;
}

.spinner-ripple div {
    position: absolute;
    border: 4px solid #3b82f6;
    opacity: 1;
    border-radius: 50%;
    animation: ripple 1.5s cubic-bezier(0, 0.2, 0.8, 1) infinite;
}

.spinner-ripple div:nth-child(2) {
    animation-delay: -0.5s;
}

@keyframes ripple {
    0% {
        top: 36px;
        left: 36px;
        width: 0;
        height: 0;
        opacity: 1;
    }
    100% {
        top: 0;
        left: 0;
        width: 72px;
        height: 72px;
        opacity: 0;
    }
}

/* 4. Bouncing Dots */
.spinner-dots {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
}

.spinner-dots div {
    width: 12px;
    height: 12px;
    background: #3b82f6;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.spinner-dots div:nth-child(1) {
    animation-delay: -0.32s;
}

.spinner-dots div:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 5. Pulse Effect */
.spinner-pulse {
    width: 60px;
    height: 60px;
    background: #3b82f6;
    border-radius: 50%;
    animation: pulse 1.5s cubic-bezier(0.455, 0.03, 0.515, 0.955) infinite;
}

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

/* 6. Modern Bars */
.spinner-bars {
    display: flex;
    gap: 4px;
    align-items: center;
    justify-content: center;
    height: 50px;
}

.spinner-bars div {
    width: 6px;
    background: #3b82f6;
    border-radius: 3px;
    animation: bars 1.2s ease-in-out infinite;
}

.spinner-bars div:nth-child(1) {
    animation-delay: -0.3s;
}

.spinner-bars div:nth-child(2) {
    animation-delay: -0.2s;
}

.spinner-bars div:nth-child(3) {
    animation-delay: -0.1s;
}

@keyframes bars {
    0%, 100% {
        height: 10px;
        opacity: 0.5;
    }
    50% {
        height: 50px;
        opacity: 1;
    }
}

/* 7. Gradient Circle */
.spinner-gradient {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: conic-gradient(
        from 0deg,
        #3b82f6 0deg,
        #60a5fa 90deg,
        #93c5fd 180deg,
        transparent 270deg
    );
    animation: spin 1s linear infinite;
    position: relative;
}

.spinner-gradient::after {
    content: '';
    position: absolute;
    inset: 6px;
    background: var(--bg-secondary);
    border-radius: 50%;
}

/* Loading Text */
.loading-text {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    animation: fadeInOut 2s ease-in-out infinite;
}

.loading-subtext {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-align: center;
    margin-top: -0.5rem;
}

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

/* Progress Bar */
.loading-progress {
    width: 200px;
    height: 4px;
    background: rgba(59, 130, 246, 0.2);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.loading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    border-radius: 2px;
    animation: progress 2s ease-in-out infinite;
}

@keyframes progress {
    0% {
        width: 0%;
        transform: translateX(0);
    }
    50% {
        width: 70%;
    }
    100% {
        width: 100%;
        transform: translateX(100%);
    }
}

/* Inline Loading (for buttons, cards, etc.) */
.loading-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.loading-inline .spinner-small {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Button Loading State */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Dark Mode Support */
[data-theme="dark"] .loading-container {
    background: var(--bg-secondary);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .loading-container {
        padding: 1.5rem;
        max-width: 90%;
    }
    
    .loading-text {
        font-size: 1rem;
    }
    
    .loading-progress {
        width: 150px;
    }
}

/* Skeleton Loading for Content */
.skeleton {
    background: linear-gradient(
        90deg,
        rgba(203, 213, 225, 0.2) 25%,
        rgba(226, 232, 240, 0.3) 50%,
        rgba(203, 213, 225, 0.2) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 8px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 1rem;
    margin: 0.5rem 0;
}

.skeleton-title {
    height: 1.5rem;
    width: 60%;
    margin: 1rem 0;
}

.skeleton-card {
    height: 200px;
    width: 100%;
}
