/* Enhanced App Loader */
.app-loader {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.3s ease;
}

.app-loader.hidden { 
    opacity: 0; 
    pointer-events: none; 
    transition: opacity 400ms ease;
}

/* Hide body content while loading */
body.loading .app-container,
body.loading .sidebar,
body.loading .right-sidebar {
    opacity: 0 !important;
    visibility: hidden !important;
    transform: translateY(20px) scale(0.98);
}

/* Beautiful reveal animation when content is ready */
.app-container,
.sidebar,
.right-sidebar {
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), 
                visibility 0.8s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Staggered reveal animation */
body:not(.loading) .sidebar {
    animation: revealSlideIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    animation-delay: 0s;
}

body:not(.loading) .app-container {
    animation: revealSlideIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    animation-delay: 0.05s;
}

body:not(.loading) .right-sidebar {
    animation: revealSlideIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    animation-delay: 0.1s;
}

@keyframes revealSlideIn {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Fade in posts with stagger */
body:not(.loading) .post-card {
    animation: postFadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    opacity: 0;
}

body:not(.loading) .post-card:nth-child(1) {
    animation-delay: 0.15s;
}

body:not(.loading) .post-card:nth-child(2) {
    animation-delay: 0.2s;
}

body:not(.loading) .post-card:nth-child(3) {
    animation-delay: 0.25s;
}

body:not(.loading) .post-card:nth-child(4) {
    animation-delay: 0.3s;
}

body:not(.loading) .post-card:nth-child(5) {
    animation-delay: 0.35s;
}

body:not(.loading) .post-card:nth-child(n+6) {
    animation-delay: 0.4s;
}

@keyframes postFadeIn {
    0% {
        opacity: 0;
        transform: translateY(15px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Profile header reveal animation */
body:not(.loading) .profile-header {
    animation: profileHeaderReveal 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    animation-delay: 0.1s;
    opacity: 0;
}

@keyframes profileHeaderReveal {
    0% {
        opacity: 0;
        transform: translateY(-20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Profile stats reveal */
body:not(.loading) .profile-stats {
    animation: statsReveal 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    animation-delay: 0.2s;
    opacity: 0;
}

@keyframes statsReveal {
    0% {
        opacity: 0;
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.loader-backdrop {
    position: absolute;
    inset: 0;
    background: radial-gradient(1200px 800px at 20% -10%, rgba(76,175,80,0.2), transparent),
                radial-gradient(1000px 700px at 120% 110%, rgba(59,130,246,0.15), transparent),
                var(--primary-bg);
    animation: gradientShift 8s ease-in-out infinite;
}

@keyframes gradientShift {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

.loader-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Logo Shell with Ring */
.logo-shell { 
    position: relative; 
    width: 140px; 
    height: 140px;
    filter: drop-shadow(0 10px 40px rgba(76, 175, 80, 0.3));
    background: transparent;
}

.ring { 
    width: 140px; 
    height: 140px; 
    transform: rotate(-90deg);
}

.ring-progress { 
    stroke-dasharray: 289; 
    stroke-dashoffset: 144; 
    animation: sweep 1.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    filter: drop-shadow(0 0 12px rgba(76,175,80,0.6));
}

@keyframes sweep {
    0% { 
        stroke-dashoffset: 289;
        opacity: 0.8;
    }
    50% { 
        stroke-dashoffset: 40;
        opacity: 1;
    }
    100% { 
        stroke-dashoffset: 289;
        opacity: 0.8;
    }
}

/* Logo Container - No background, just centering */
.logo-tile {
    position: absolute; 
    inset: 0;
    display: grid; 
    place-items: center;
    background: transparent;
    overflow: hidden;
    border-radius: 50%;
}

/* Logo Image - Spinning with the ring */
.logo-image { 
    width: 70px; 
    height: 70px; 
    object-fit: cover;
    animation: logoSpin 3s linear infinite;
    filter: drop-shadow(0 4px 16px rgba(76, 175, 80, 0.6));
    background: transparent;
    border-radius: 50%;
    overflow: hidden;
}

@keyframes logoSpin {
    0% { 
        transform: rotate(0deg);
        filter: drop-shadow(0 4px 16px rgba(76, 175, 80, 0.6));
    }
    100% { 
        transform: rotate(360deg);
        filter: drop-shadow(0 4px 16px rgba(76, 175, 80, 0.6));
    }
}

/* Loading Text */
.loader-text { 
    color: var(--text-primary);
    font-weight: 600;
    letter-spacing: 0.5px;
    font-size: 1.1rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Animated Dots */
.loader-dots {
    display: flex;
    gap: 8px;
    align-items: center;
    height: 20px;
}

.loader-dots span {
    width: 8px;
    height: 8px;
    background: linear-gradient(135deg, #4CAF50, #6ee7b7);
    border-radius: 50%;
    animation: dotBounce 1.4s ease-in-out infinite;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

.loader-dots span:nth-child(1) {
    animation-delay: 0s;
}

.loader-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loader-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dotBounce {
    0%, 80%, 100% { 
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% { 
        transform: scale(1.2);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .logo-shell { 
        width: 110px; 
        height: 110px;
        background: transparent;
    }
    .ring { 
        width: 110px; 
        height: 110px;
    }
    .logo-tile { 
        inset: 0;
        background: transparent;
        border-radius: 50%;
    }
    .logo-image { 
        width: 56px; 
        height: 56px;
        background: transparent;
        border-radius: 50%;
        overflow: hidden;
    }
    .loader-text {
        font-size: 1rem;
    }
    .loader-dots span {
        width: 6px;
        height: 6px;
    }
}






