/* Social Feed Animations & Microinteractions */

/* ===== Tab System Animations ===== */

/* Tab hover effects with smooth transitions */
.tab-button {
    position: relative;
    background: transparent;
    border: none;
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

/* Hover state with subtle scale and color change */
.tab-button:hover {
    color: #ff6b35;
    transform: translateY(-2px);
}

/* Active tab indicator with animated underline */
.tab-button::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 3px;
    background: #ff6b35;
    transform: translateX(-50%);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-button.active::after {
    width: 100%;
}

/* Ripple effect on click */
.tab-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 107, 53, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.4s, height 0.4s;
}

.tab-button:active::before {
    width: 200px;
    height: 200px;
}

/* ===== Social Section Reveal Animation ===== */

/* Initial hidden state with fade and slide preparation */
.social-section {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Revealed state */
.social-section.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered animation for posts */
.social-post {
    opacity: 0;
    transform: translateY(30px) scale(0.98);
    animation: postReveal 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.social-post:nth-child(1) { animation-delay: 0.1s; }
.social-post:nth-child(2) { animation-delay: 0.2s; }
.social-post:nth-child(3) { animation-delay: 0.3s; }
.social-post:nth-child(4) { animation-delay: 0.4s; }
.social-post:nth-child(5) { animation-delay: 0.5s; }

@keyframes postReveal {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ===== Loading States with Skeleton Screens ===== */

/* Skeleton screen base */
.skeleton {
    position: relative;
    overflow: hidden;
    background: #f0f0f0;
    border-radius: 8px;
}

/* Animated shimmer effect */
.skeleton::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.8),
        transparent
    );
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    to {
        left: 100%;
    }
}

/* Skeleton post structure */
.skeleton-post {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.skeleton-header {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 1rem;
}

.skeleton-author {
    flex: 1;
}

.skeleton-name {
    height: 16px;
    width: 120px;
    margin-bottom: 8px;
}

.skeleton-time {
    height: 12px;
    width: 80px;
}

.skeleton-content {
    height: 60px;
    margin-bottom: 1rem;
}

.skeleton-actions {
    display: flex;
    gap: 1rem;
}

.skeleton-button {
    height: 32px;
    width: 80px;
    border-radius: 20px;
}

/* ===== Notification Badge Animations ===== */

/* Badge pulse animation */
.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff6b35;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.4rem;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    animation: badgePulse 2s infinite;
}

@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 107, 53, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(255, 107, 53, 0);
    }
}

/* New notification animation */
.notification-badge.new {
    animation: badgeBounce 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes badgeBounce {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.3);
    }
    100% {
        transform: scale(1);
    }
}

/* ===== Performance-Optimized Transitions ===== */

/* Use transform and opacity for smooth 60fps animations */
.smooth-transition {
    will-change: transform, opacity;
    transform: translateZ(0); /* Enable hardware acceleration */
}

/* Button interactions */
.interactive-button {
    position: relative;
    overflow: hidden;
    transition: all 0.2s ease-out;
    transform: translateZ(0);
}

.interactive-button:hover {
    transform: translateY(-2px) translateZ(0);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.interactive-button:active {
    transform: translateY(0) translateZ(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Like button animation */
.like-btn {
    position: relative;
    transition: all 0.2s ease-out;
}

.like-btn.liked {
    color: #e91e63;
    animation: likeHeart 0.3s ease-out;
}

@keyframes likeHeart {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

/* Comment button hover effect */
.comment-btn {
    position: relative;
}

.comment-btn::after {
    content: '💬';
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%) scale(0);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.comment-btn:hover::after {
    transform: translateX(-50%) scale(1);
}

/* ===== Post Creation Animation ===== */

/* New post slide in */
.new-post-animation {
    animation: slideInFromTop 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideInFromTop {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Post creation form reveal */
.post-creation-form {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.post-creation-form.active {
    max-height: 500px;
    opacity: 1;
}

/* ===== Chat Modal Animations ===== */

/* Chat button animation */
.chat-btn {
    position: relative;
    overflow: hidden;
}

.chat-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.4s;
}

.chat-btn:hover::before {
    transform: translate(-50%, -50%) scale(2);
}

/* Message animation */
.chat-message {
    opacity: 0;
    transform: translateX(-20px);
    animation: messageSlide 0.3s ease-out forwards;
}

@keyframes messageSlide {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite;
}

.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* ===== Scroll-triggered Animations ===== */

/* Fade in on scroll */
.fade-in-scroll {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease-out;
}

.fade-in-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== Dark Mode Transitions ===== */

/* Smooth theme transition */
* {
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Prevent transition on page load */
body.no-transition * {
    transition: none !important;
}

/* ===== Performance Considerations ===== */

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* GPU-accelerated properties only */
.gpu-accelerated {
    transform: translateZ(0);
    will-change: transform;
    backface-visibility: hidden;
    perspective: 1000px;
}

/* ===== Loading Spinner ===== */

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #ff6b35;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

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

/* ===== Empty State Animation ===== */

.empty-state-icon {
    font-size: 4rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* ===== Success/Error Animations ===== */

.success-animation {
    animation: successPop 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

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

.error-shake {
    animation: errorShake 0.5s;
}

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