/* ═══════════════════════════════════════════════════════════════ */
/*                        LOADING SYSTEM CSS                        */
/* ═══════════════════════════════════════════════════════════════ */

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

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

/* Loading Container */
.loading-container {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    text-align: center;
    min-width: 250px;
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.global-loading-overlay.active .loading-container {
    transform: scale(1);
}

/* Loading Spinner */
.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #6f42c1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

/* Loading Text */
.loading-text {
    font-size: 16px;
    font-weight: 500;
    color: #333;
    margin-bottom: 10px;
}

.loading-subtext {
    font-size: 14px;
    color: #666;
    margin: 0;
}

/* Button Loading States */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.btn-loading .btn-text {
    opacity: 0;
}

/* Sepet Butonu Loading */
.add-to-cart-btn-minimal.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.8;
}

.add-to-cart-btn-minimal.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 10;
}

.add-to-cart-btn-minimal.loading #cart-btn-text {
    opacity: 0.3;
}

/* Inline Loading Spinner */
.inline-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.inline-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #6f42c1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Toast Notification Loading */
.toast-loading {
    background: linear-gradient(135deg, #6f42c1, #d3a7fa);
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(111, 66, 193, 0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.toast-loading.show {
    transform: translateX(0);
}

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

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 4px;
    background: #f3f3f3;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 15px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6f42c1, #d3a7fa);
    border-radius: 2px;
    width: 0%;
    animation: progress 2s ease-in-out infinite;
}

@keyframes progress {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

/* Cart Controls Loading */
.cart-controls.loading {
    pointer-events: none;
    opacity: 0.6;
}

.cart-controls.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    z-index: 5;
}

.cart-controls.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #ccc;
    border-top: 2px solid #6f42c1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 6;
}

/* Size Button Loading */
.size-btn-minimal.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.size-btn-minimal.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid #ddd;
    border-top: 2px solid #6f42c1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Loading Dots Animation */
.loading-dots::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

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

/* Pulse Animation */
.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Success Animation */
.success-checkmark {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #28a745;
    position: relative;
    margin: 0 auto 20px;
}

.success-checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 24px;
    font-weight: bold;
    animation: checkmark 0.5s ease-in-out;
}

@keyframes checkmark {
    0% { transform: translate(-50%, -50%) scale(0); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

/* Error Animation */
.error-cross {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #dc3545;
    position: relative;
    margin: 0 auto 20px;
}

.error-cross::after {
    content: '✕';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 24px;
    font-weight: bold;
    animation: errormark 0.5s ease-in-out;
}

@keyframes errormark {
    0% { transform: translate(-50%, -50%) scale(0) rotate(0deg); }
    100% { transform: translate(-50%, -50%) scale(1) rotate(180deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .loading-container {
        padding: 20px;
        min-width: 200px;
    }
    
    .toast-loading {
        top: 10px;
        right: 10px;
        left: 10px;
        transform: translateY(-100%);
    }
    
    .toast-loading.show {
        transform: translateY(0);
    }
}
