/* ========================================
   REACT-STYLE LOADING EFFECTS
   Modern Progressive Loading System
   ======================================== */

/* ===================================
   1. Page Loader (Initial Load)
   =================================== */

.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

.page-loader.loaded {
    opacity: 0;
    visibility: hidden;
}

.loader-logo {
    width: 120px;
    height: 120px;
    margin-bottom: 30px;
    animation: logoFloat 2s ease-in-out infinite;
}

.loader-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(197, 165, 114, 0.2);
    border-top: 4px solid ;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loader-text {
    color: #C5A572;
    font-size: 16px;
    margin-top: 20px;
    font-weight: 600;
    animation: pulse 1.5s ease-in-out infinite;
}

.loader-progress {
    width: 200px;
    height: 4px;
    background: rgba(197, 165, 114, 0.2);
    border-radius: 2px;
    margin-top: 20px;
    overflow: hidden;
}

.loader-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #C5A572, #B39564);
    border-radius: 2px;
    animation: progressBar 2s ease-in-out;
}

/* ===================================
   2. Skeleton Loaders
   =================================== */

.skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}

.skeleton-text {
    height: 16px;
    margin-bottom: 10px;
}

.skeleton-title {
    height: 32px;
    width: 60%;
    margin-bottom: 20px;
}

.skeleton-card {
    height: 200px;
    border-radius: 15px;
}

.skeleton-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
}

.skeleton-button {
    height: 45px;
    width: 150px;
    border-radius: 25px;
}

/* ===================================
   3. Content Fade-In Effects
   =================================== */

.fade-in-element {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in-element.visible {
    opacity: 1;
    transform: translateY(0);
}

.fade-in-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in-left.visible {
    opacity: 1;
    transform: translateX(0);
}

.fade-in-right {
    opacity: 0;
    transform: translateX(50px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in-right.visible {
    opacity: 1;
    transform: translateX(0);
}

.scale-in {
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.scale-in.visible {
    opacity: 1;
    transform: scale(1);
}

/* ===================================
   4. Page Transition Effects
   =================================== */

.page-transition {
    animation: pageSlideIn 0.5s ease-out;
}

@keyframes pageSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===================================
   5. Smooth Hover Transitions
   =================================== */

.smooth-hover {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.smooth-hover:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

/* ===================================
   6. Button Loading State
   =================================== */

.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #ffffff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ===================================
   7. Progress Bar (Top of Page)
   =================================== */

.top-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, #C5A572, #B39564);
    z-index: 99999;
    transition: width 0.3s ease-out;
    box-shadow: 0 0 10px rgba(197, 165, 114, 0.5);
}

/* ===================================
   8. Loading Overlay
   =================================== */

.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: opacity 0.3s, visibility 0.3s;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top: 4px solid #C5A572;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ===================================
   9. Pulse Animation (Live Updates)
   =================================== */

.pulse-indicator {
    position: relative;
}

.pulse-indicator::before {
    content: '';
    position: absolute;
    top: -5px;
    right: -5px;
    width: 12px;
    height: 12px;
    background: #4CAF50;
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

/* ===================================
   10. Staggered Animations
   =================================== */

.stagger-item {
    opacity: 0;
    transform: translateY(20px);
    animation: staggerIn 0.5s ease-out forwards;
}

.stagger-item:nth-child(1) { animation-delay: 0.1s; }
.stagger-item:nth-child(2) { animation-delay: 0.2s; }
.stagger-item:nth-child(3) { animation-delay: 0.3s; }
.stagger-item:nth-child(4) { animation-delay: 0.4s; }
.stagger-item:nth-child(5) { animation-delay: 0.5s; }
.stagger-item:nth-child(6) { animation-delay: 0.6s; }

@keyframes staggerIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===================================
   11. Lazy Load Blur Effect
   =================================== */

.lazy-load-blur {
    filter: blur(10px);
    transition: filter 0.5s ease-out;
}

.lazy-load-blur.loaded {
    filter: blur(0);
}

/* ===================================
   12. Card Flip Effect
   =================================== */

.flip-card {
    perspective: 1000px;
}

.flip-card-inner {
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.flip-card:hover .flip-card-inner {
    transform: rotateY(180deg);
}

/* ===================================
   KEYFRAME ANIMATIONS
   =================================== */

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

@keyframes progressBar {
    0% { width: 0%; }
    100% { width: 100%; }
}

@keyframes pulse {
    0%, 100% { 
        opacity: 1;
        transform: scale(1);
    }
    50% { 
        opacity: 0.5;
        transform: scale(0.95);
    }
}

/* ===================================
   13. Mobile Optimizations
   =================================== */

@media (max-width: 768px) {
    .loader-logo {
        width: 80px;
        height: 80px;
    }
    
    .loader-spinner {
        width: 50px;
        height: 50px;
    }
    
    .loader-text {
        font-size: 14px;
    }
}

/* ===================================
   14. Reduce Motion (Accessibility)
   =================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}