/* Loading Animations */
@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(0.95); opacity: 0.5; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Loading States */
.loading-container {
    position: relative;
    min-height: 200px;
}

.loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid var(--primary-color);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

.loading-skeleton {
    background: linear-gradient(90deg, 
        #f0f0f0 25%, 
        #e0e0e0 50%, 
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

/* Image Loading */
.image-container {
    position: relative;
    overflow: hidden;
}

.image-container.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #f0f0f0;
    animation: pulse 1.5s infinite;
}

/* 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);
}

.form-loading .loading-spinner {
    z-index: 1;
}

/* Button Loading State */
.btn.loading {
    position: relative;
    pointer-events: none;
    color: transparent !important;
}

.btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid #fff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

/* Page Transition Effects */
.page-transition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary-color);
    z-index: 9999;
    transform: translateY(100%);
    transition: transform 0.6s ease-in-out;
}

.page-transition.active {
    transform: translateY(0);
}

/* Image Gallery Loading */
.gallery-loading {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    padding: 1rem;
}

.gallery-loading-item {
    aspect-ratio: 16/9;
    background: #f0f0f0;
    animation: pulse 1.5s infinite;
}

/* Card Loading State */
.card-loading {
    padding: 1rem;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.card-loading-title {
    height: 24px;
    width: 80%;
    margin-bottom: 1rem;
}

.card-loading-text {
    height: 16px;
    margin-bottom: 0.5rem;
}

.card-loading-text:last-child {
    width: 60%;
}

.card-loading-title,
.card-loading-text {
    background: linear-gradient(90deg, 
        #f0f0f0 25%, 
        #e0e0e0 50%, 
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

/* Error States */
.error-message {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #fee;
    color: #c00;
    border-radius: 4px;
    margin: 1rem 0;
    font-size: 0.9rem;
}

.error-message i {
    margin-right: 0.5rem;
}

/* Success States */
.success-message {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #efe;
    color: #0c0;
    border-radius: 4px;
    margin: 1rem 0;
    font-size: 0.9rem;
}

.success-message i {
    margin-right: 0.5rem;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9999;
}

.toast {
    padding: 1rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    margin-top: 1rem;
    display: flex;
    align-items: center;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Progress Indicators */
.progress-bar {
    height: 4px;
    background: #f0f0f0;
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

/* Infinite Scroll Loading */
.infinite-scroll-loading {
    text-align: center;
    padding: 2rem;
}

.infinite-scroll-loading .loading-spinner {
    display: inline-block;
    position: relative;
    transform: none;
    top: auto;
    left: auto;
}