/* BIZY - Premium Animations & Micro-interactions */

/* Smooth page transitions */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

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

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(79, 156, 249, 0.3);
    }
    50% {
        box-shadow: 0 0 30px rgba(79, 156, 249, 0.6);
    }
}

/* Apply animations to elements */
.chat-item,
.friend-item,
.status-item,
.message-group {
    animation: fadeIn 0.3s ease;
}

.sidebar-nav-item.active {
    animation: glow 2s ease-in-out infinite;
}

.fab {
    animation: scaleIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.fab:active {
    animation: pulse 0.3s ease;
}

/* Loading skeleton */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--panel-bg) 25%,
        var(--hover-bg) 50%,
        var(--panel-bg) 75%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
    border-radius: var(--radius-md);
}

/* Ripple effect on buttons */
.btn-primary,
.send-btn,
.top-bar-btn {
    position: relative;
    overflow: hidden;
}

.btn-primary::after,
.send-btn::after,
.top-bar-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-primary:active::after,
.send-btn:active::after,
.top-bar-btn:active::after {
    width: 300px;
    height: 300px;
}

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
}

.messages-container,
.content-area {
    scroll-behavior: smooth;
}

/* Hover lift effect */
.chat-item:hover,
.friend-item:hover,
.status-card:hover {
    box-shadow: var(--shadow-md);
}

/* Typing dots animation */
@keyframes typingDot {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

.typing-dots span {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin: 0 2px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typingDot 1.4s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

/* Message bubble entrance */
.message-bubble {
    animation: messageSlideIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Unread badge pulse */
.unread-badge {
    animation: pulse 2s ease-in-out infinite;
}

/* Status ring rotation */
.status-ring:not(.viewed) {
    animation: rotate360 10s linear infinite;
}

@keyframes rotate360 {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Notification toast */
@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* Online indicator pulse */
.online-indicator {
    animation: pulse 2s ease-in-out infinite;
}

/* Avatar hover zoom */
.user-avatar,
.chat-avatar,
.status-avatar {
    transition: transform var(--transition-fast);
}

.user-avatar:hover,
.chat-avatar:hover,
.status-avatar:hover {
    transform: scale(1.05);
}

/* Input focus glow */
.form-input:focus,
.message-input:focus {
    animation: inputGlow 0.3s ease;
}

@keyframes inputGlow {
    0% {
        box-shadow: 0 0 0 0 rgba(79, 156, 249, 0.4);
    }
    100% {
        box-shadow: 0 0 0 3px rgba(79, 156, 249, 0.1);
    }
}

/* Sidebar slide animation for mobile */
@keyframes sidebarSlideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes sidebarSlideOut {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(-100%);
    }
}

.sidebar.open {
    animation: sidebarSlideIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Gradient animation for logo */
.sidebar-logo,
.auth-logo {
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Card entrance stagger */
.chat-item:nth-child(1) { animation-delay: 0.05s; }
.chat-item:nth-child(2) { animation-delay: 0.1s; }
.chat-item:nth-child(3) { animation-delay: 0.15s; }
.chat-item:nth-child(4) { animation-delay: 0.2s; }
.chat-item:nth-child(5) { animation-delay: 0.25s; }

/* Smooth opacity transitions */
.hidden {
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-base);
}

/* Glass morphism effect */
.glass {
    background: rgba(42, 47, 56, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Floating animation for FAB */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

.fab {
    animation: float 3s ease-in-out infinite;
}

/* Smooth color transitions */
* {
    transition-property: background-color, border-color, color, fill, stroke, opacity, box-shadow, transform;
    transition-duration: 0.2s;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Disable transitions on page load */
.preload * {
    transition: none !important;
}
