/**
 * CAM DOKTORU - Loading Animations & UX Enhancements
 * Smooth loading animations and user experience improvements
 */

/* Loading Spinner */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: spin 1s ease-in-out infinite;
}

.loading-spinner.primary {
    border: 3px solid rgba(52, 152, 219, 0.3);
    border-top-color: #3498db;
}

.loading-spinner.dark {
    border: 3px solid rgba(0, 0, 0, 0.3);
    border-top-color: #000000;
}

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

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

.page-loading.fade-out {
    opacity: 0;
    pointer-events: none;
}

.page-loading .spinner-container {
    text-align: center;
}

.page-loading .spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #e3f2fd;
    border-top: 5px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

.page-loading .loading-text {
    color: #3498db;
    font-size: 16px;
    font-weight: 600;
}

/* Button Loading States */
/* Disable button loading spinner for corporate simplicity */
.btn.loading { position: static; color: inherit !important; pointer-events: auto; }
.btn.loading:after { content: none; }

.btn.loading.btn-outline-primary:after,
.btn.loading.btn-outline-secondary:after {
    border-top-color: #3498db;
}

/* Form Loading States */
.form-loading {
    position: relative;
    pointer-events: none;
}

.form-loading:after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(2px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.form-loading:before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid #e3f2fd;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 11;
}

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

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

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
    border-radius: 4px;
}

.skeleton-text:last-child {
    margin-bottom: 0;
    width: 80%;
}

.skeleton-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
}

.skeleton-image {
    width: 100%;
    height: 200px;
    border-radius: 8px;
}

/* Content Loading Animation */
.content-loading {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s ease;
}

.content-loading.loaded {
    opacity: 1;
    transform: translateY(0);
}

/* Fade In Animation */
.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Slide In Animation */
.slide-in-left {
    animation: slideInLeft 0.5s ease-out;
}

.slide-in-right {
    animation: slideInRight 0.5s ease-out;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

/* Pulse Animation for Important Elements */
/* Disable pulse animations */
.pulse { animation: none; }

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

/* Success/Error Animations */
.success-animation {
    animation: successPulse 0.6s ease-in-out;
}

.error-animation {
    animation: errorShake 0.6s ease-in-out;
}

@keyframes successPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-3px); }
    20%, 40%, 60%, 80% { transform: translateX(3px); }
}

/* Progress Bar */
.progress-bar-animated {
    position: relative;
    overflow: hidden;
}

/* Disable progress bar stripe animation */
.progress-bar-animated::after { content: none; }

@keyframes progress-bar-stripes {
    0% { background-position: 1rem 0; }
    100% { background-position: 0 0; }
}

/* Image Loading */
.image-loading {
    position: relative;
    overflow: hidden;
    background: #f8f9fa;
}

/* Disable image loading shimmer */
.image-loading::before { content: none; }

@keyframes imageLoading {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Hover Effects */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Disable hover lift */
.hover-lift:hover { transform: none; box-shadow: none; }

.hover-scale {
    transition: transform 0.3s ease;
}

/* Disable hover scale */
.hover-scale:hover { transform: none; }

/* Responsive Loading Adjustments */
@media (max-width: 768px) {
    .page-loading .spinner {
        width: 40px;
        height: 40px;
    }
    
    .page-loading .loading-text {
        font-size: 14px;
    }
    
    .btn.loading:after {
        width: 14px;
        height: 14px;
        margin-left: -7px;
        margin-top: -7px;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .loading-spinner,
    .page-loading .spinner,
    .btn.loading:after,
    .skeleton,
    .pulse,
    .success-animation,
    .error-animation,
    .progress-bar-animated::after,
    .image-loading::before {
        animation: none;
    }
    
    .content-loading,
    .fade-in,
    .slide-in-left,
    .slide-in-right,
    .hover-lift,
    .hover-scale {
        transition: none;
    }
}