/* ========================================
   PROFESSIONAL LOADING SYSTEM STYLES
   ======================================== */

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

.loading-content {
    text-align: center;
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    border: 1px solid #e2e8f0;
    min-width: 300px;
}

/* Loading Spinners */
.loading-spinner {
    margin: 0 auto 20px;
}

/* Default Spinner */
.loading-spinner.default {
    width: 40px;
    height: 40px;
    border: 4px solid #f6e33b;
    border-top: 4px solid #f6e33b;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Pulse Spinner */
.loading-spinner.pulse {
    width: 40px;
    height: 40px;
    background: #3b82f6;
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

/* Ring Spinner */
.loading-spinner.ring {
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top: 3px solid #3b82f6;
    border-right: 3px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Dots Spinner */
.loading-spinner.dots {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.loading-spinner.dots::before,
.loading-spinner.dots::after,
.loading-spinner.dots {
    content: '';
    width: 12px;
    height: 12px;
    background: #f1f1f1;
    border-radius: 50%;
    animation: dots 1.4s ease-in-out infinite both;
}

.loading-spinner.dots::before {
    animation-delay: -0.32s;
}

.loading-spinner.dots::after {
    animation-delay: -0.16s;
}

/* Bars Spinner */
.loading-spinner.bars {
    display: flex;
    gap: 4px;
    justify-content: center;
}

.loading-spinner.bars::before,
.loading-spinner.bars::after,
.loading-spinner.bars {
    content: '';
    width: 8px;
    height: 24px;
    background: #3b82f6;
    border-radius: 4px;
    animation: bars 1.2s ease-in-out infinite;
}

.loading-spinner.bars::before {
    animation-delay: -0.24s;
}

.loading-spinner.bars::after {
    animation-delay: -0.12s;
}

/* Loading Message */
.loading-message {
    font-size: 16px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 20px;
}

/* Loading Progress */
.loading-progress {
    display: none;
}

.loading-progress.active {
    display: block;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #1d4ed8);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
}

/* Progress Bar Container */
.progress-bar-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: transparent;
    z-index: 99998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.progress-bar-container.active {
    opacity: 1;
    visibility: visible;
}

.progress-bar-container .progress-bar {
    height: 4px;
    margin: 0;
    border-radius: 0;
}

.progress-bar-container .progress-fill {
    background: linear-gradient(90deg, #3b82f6, #1d4ed8);
    border-radius: 0;
}

.progress-bar-container .progress-text {
    position: absolute;
    right: 20px;
    top: 8px;
    font-size: 12px;
    color: #6b7280;
    background: white;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
}

/* Element Loading */
.element-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: inherit;
}

.element-spinner {
    margin-bottom: 12px;
}

.element-spinner.default {
    width: 32px;
    height: 32px;
    border: 3px solid #e2e8f0;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.element-spinner.pulse {
    width: 32px;
    height: 32px;
    background: #3b82f6;
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

.element-spinner.ring {
    width: 32px;
    height: 32px;
    border: 2px solid #e2e8f0;
    border-top: 2px solid #3b82f6;
    border-right: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.element-spinner.dots {
    display: flex;
    gap: 6px;
    justify-content: center;
}

.element-spinner.dots::before,
.element-spinner.dots::after,
.element-spinner.dots {
    content: '';
    width: 8px;
    height: 8px;
    background: #3b82f6;
    border-radius: 50%;
    animation: dots 1.4s ease-in-out infinite both;
}

.element-spinner.dots::before {
    animation-delay: -0.32s;
}

.element-spinner.dots::after {
    animation-delay: -0.16s;
}

.element-spinner.bars {
    display: flex;
    gap: 3px;
    justify-content: center;
}

.element-spinner.bars::before,
.element-spinner.bars::after,
.element-spinner.bars {
    content: '';
    width: 6px;
    height: 18px;
    background: #3b82f6;
    border-radius: 3px;
    animation: bars 1.2s ease-in-out infinite;
}

.element-spinner.bars::before {
    animation-delay: -0.24s;
}

.element-spinner.bars::after {
    animation-delay: -0.12s;
}

.element-message {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
}

/* Inline Spinner */
.inline-spinner {
    display: inline-block;
    margin-left: 8px;
}

.inline-spinner.default {
    width: 16px;
    height: 16px;
    border: 2px solid #e2e8f0;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.inline-spinner.pulse {
    width: 16px;
    height: 16px;
    background: #3b82f6;
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

.inline-spinner.ring {
    width: 16px;
    height: 16px;
    border: 1px solid #e2e8f0;
    border-top: 1px solid #3b82f6;
    border-right: 1px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.inline-spinner.dots {
    display: flex;
    gap: 4px;
    justify-content: center;
}

.inline-spinner.dots::before,
.inline-spinner.dots::after,
.inline-spinner.dots {
    content: '';
    width: 6px;
    height: 6px;
    background: #3b82f6;
    border-radius: 50%;
    animation: dots 1.4s ease-in-out infinite both;
}

.inline-spinner.dots::before {
    animation-delay: -0.32s;
}

.inline-spinner.dots::after {
    animation-delay: -0.16s;
}

.inline-spinner.bars {
    display: flex;
    gap: 2px;
    justify-content: center;
}

.inline-spinner.bars::before,
.inline-spinner.bars::after,
.inline-spinner.bars {
    content: '';
    width: 4px;
    height: 12px;
    background: #3b82f6;
    border-radius: 2px;
    animation: bars 1.2s ease-in-out infinite;
}

.inline-spinner.bars::before {
    animation-delay: -0.24s;
}

.inline-spinner.bars::after {
    animation-delay: -0.12s;
}

/* Loading States */
.loading {
    position: relative;
}

.loading > *:not(.element-loading) {
    opacity: 0.6;
    pointer-events: none;
}

/* Body Loading State */
body.loading-active {
    overflow: hidden;
}

/* Animations */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

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

@keyframes bars {
    0%, 40%, 100% { 
        transform: scaleY(0.4);
    }
    20% { 
        transform: scaleY(1);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .loading-content {
        padding: 30px 20px;
        min-width: 280px;
        margin: 20px;
    }
    
    .loading-message {
        font-size: 14px;
    }
    
    .loading-spinner.default,
    .loading-spinner.pulse,
    .loading-spinner.ring {
        width: 32px;
        height: 32px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .loading-overlay {
        background: rgba(0, 0, 0, 0.95);
    }
    
    .loading-content {
        background: #d0d2d4;
        border-color: #374151;
    }
    
    .loading-message {
        color: #d1d5db;
    }
    
    .progress-text {
        color: #9ca3af;
    }
    
    .element-loading {
        background: rgba(0, 0, 0, 0.9);
    }
    
    .element-message {
        color: #9ca3af;
    }
}

/* Error Notifications */
.error-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    z-index: 100000;
    max-width: 400px;
    animation: slideInRight 0.3s ease;
}

.error-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.error-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.error-text {
    color: #dc2626;
    font-size: 14px;
    font-weight: 500;
    flex: 1;
}

.error-close {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.error-close:hover {
    background: #f3f4f6;
    color: #6b7280;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ========================================
   END OF LOADING SYSTEM STYLES
   ======================================== */
