﻿/* 
   HIGEXT NEXA — Animations v7.0 "Obsidian Glass"
   Refined Motion Design — Violet / Cyan / True Dark
*/

/*  PAGE TRANSITIONS  */

.page-enter {
    animation: pageEnter 0.5s var(--ease-spring) forwards;
}

@keyframes pageEnter {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/*  STAGGER ANIMATIONS  */

.stagger-in > * {
    opacity: 0;
    animation: staggerFadeIn 0.35s var(--ease-out) forwards;
}

.stagger-in > *:nth-child(1) { animation-delay: 0.03s; }
.stagger-in > *:nth-child(2) { animation-delay: 0.06s; }
.stagger-in > *:nth-child(3) { animation-delay: 0.09s; }
.stagger-in > *:nth-child(4) { animation-delay: 0.12s; }
.stagger-in > *:nth-child(5) { animation-delay: 0.15s; }
.stagger-in > *:nth-child(6) { animation-delay: 0.18s; }
.stagger-in > *:nth-child(7) { animation-delay: 0.21s; }
.stagger-in > *:nth-child(8) { animation-delay: 0.24s; }
.stagger-in > *:nth-child(9) { animation-delay: 0.27s; }
.stagger-in > *:nth-child(10) { animation-delay: 0.3s; }

@keyframes staggerFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/*  HOVER EFFECTS  */

.hover-lift { transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1); }
.hover-lift:hover { transform: translateY(-4px); box-shadow: 0 12px 32px rgba(0,0,0,0.4), 0 0 1px rgba(255,255,255,0.03); }

.hover-glow { transition: box-shadow 0.3s ease; }
.hover-glow:hover { box-shadow: 0 0 28px rgba(139,92,246,0.25), 0 0 56px rgba(139,92,246,0.08); }

.hover-scale { transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1); }
.hover-scale:hover { transform: scale(1.04); }
.hover-scale:active { transform: scale(0.96); }

.hover-bright { transition: filter 0.2s ease, transform 0.2s ease; }
.hover-bright:hover { filter: brightness(1.15); transform: translateY(-1px); }

/*  LOADING STATES  */

.loading-dots {
    display: flex; gap: 6px;
    align-items: center; justify-content: center;
    padding: var(--s-4);
}

.loading-dots span {
    width: 8px; height: 8px;
    background: var(--brand);
    border-radius: var(--r-full);
    animation: loadingBounce 1.2s ease-in-out infinite;
}
.loading-dots span:nth-child(2) { animation-delay: 0.15s; }
.loading-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes loadingBounce {
    0%, 100% { transform: scale(0.6); opacity: 0.3; }
    50% { transform: scale(1); opacity: 1; }
}

/* Pulse loader */
.loading-pulse {
    width: 40px; height: 40px;
    border-radius: var(--r-full);
    background: var(--brand);
    animation: loadingPulse 1.5s ease-in-out infinite;
}

@keyframes loadingPulse {
    0% { transform: scale(0.85); opacity: 0.4; }
    50% { transform: scale(1.05); opacity: 1; }
    100% { transform: scale(0.85); opacity: 0.4; }
}

/*  PAGE LOADER  */

.page-loader {
    position: fixed; inset: 0;
    background: var(--bg-deepest);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: var(--s-6);
    z-index: var(--z-max);
}

.page-loader-logo {
    width: 76px; height: 76px;
    background: linear-gradient(135deg, var(--brand), var(--accent-sky));
    border-radius: var(--r-xl);
    display: flex; align-items: center; justify-content: center;
    font-size: 2.2rem; color: white;
    animation: float 3s ease-in-out infinite;
    box-shadow: 0 0 50px rgba(139,92,246,0.35), 0 0 100px rgba(139,92,246,0.1), inset 0 1px 0 rgba(255,255,255,0.1);
}

.page-loader-text {
    font-size: 0.8125rem; color: var(--text-600);
    letter-spacing: 4px; text-transform: uppercase;
    font-weight: 600;
}

.page-loader-bar {
    width: 200px; height: 3px;
    background: var(--bg-float);
    border-radius: 2px;
    overflow: hidden;
}
.page-loader-bar::after {
    content: ''; display: block;
    width: 35%; height: 100%;
    background: linear-gradient(90deg, var(--brand), var(--accent-sky));
    border-radius: 2px;
    animation: loaderSlide 1.2s ease-in-out infinite;
}

@keyframes loaderSlide {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(400%); }
}

/*  SKELETON SCREENS  */

.skeleton-message {
    display: flex; gap: 16px;
    padding: 10px 16px;
    animation: fadeIn 0.3s var(--ease-out);
}
.skeleton-avatar { width: 40px; height: 40px; border-radius: var(--r-full); }
.skeleton-text { flex: 1; }
.skeleton-line { height: 12px; margin-bottom: 8px; border-radius: var(--r-sm); }
.skeleton-line:last-child { width: 60%; }

/*  MESSAGE ANIMATIONS  */

.message-enter { animation: messageSlideIn 0.25s var(--ease-out); }

@keyframes messageSlideIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-new { animation: messageFlash 2s ease; }

@keyframes messageFlash {
    0% { background: rgba(124, 58, 237, 0.06); }
    100% { background: transparent; }
}

.message-sending { opacity: 0.6; }

/*  NOTIFICATION ANIMATIONS  */

.notification-ping { animation: notificationPing 0.5s var(--ease-spring); }

@keyframes notificationPing {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

.unread-bounce { animation: unreadBounce 0.5s var(--ease-spring); }

@keyframes unreadBounce {
    0%, 100% { transform: translateY(0); }
    30% { transform: translateY(-5px); }
    50% { transform: translateY(0); }
    70% { transform: translateY(-2px); }
}

/*  CONNECTION STATUS  */

.connection-status {
    position: fixed; top: 0; left: 0; right: 0;
    height: 3px; z-index: var(--z-max);
    transition: opacity var(--t-normal);
}

.connection-status.connecting {
    background: linear-gradient(90deg, var(--warning), var(--brand-light));
    animation: connectionPulse 1.5s ease-in-out infinite;
}
.connection-status.connected {
    background: var(--success);
    animation: connectionFade 1s ease 0.5s forwards;
}
.connection-status.error { background: var(--danger); }

@keyframes connectionPulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }
@keyframes connectionFade { to { opacity: 0; } }

/*  LIGHTBOX  */

.lightbox {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(12px);
    display: flex; align-items: center; justify-content: center;
    z-index: var(--z-max);
    animation: fadeIn 0.2s var(--ease-out);
    cursor: zoom-out;
}

.lightbox img {
    max-width: 90vw; max-height: 90vh;
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-2xl);
    animation: modalSlideIn 0.3s var(--ease-spring);
}

.lightbox-close {
    position: absolute; top: 20px; right: 20px;
    width: 44px; height: 44px;
    background: rgba(255,255,255,0.08);
    border-radius: var(--r-full);
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 1.2rem; cursor: pointer;
    transition: all var(--t-fast);
    backdrop-filter: blur(8px);
}
.lightbox-close:hover { background: rgba(255,255,255,0.15); transform: scale(1.1); }

/*  RIPPLE EFFECT  */

.ripple { position: relative; overflow: hidden; }
.ripple-effect {
    position: absolute;
    border-radius: var(--r-full);
    background: rgba(255,255,255,0.15);
    animation: rippleExpand 0.6s ease-out forwards;
    pointer-events: none;
}

@keyframes rippleExpand {
    from { width: 0; height: 0; opacity: 0.5; }
    to { width: 400px; height: 400px; opacity: 0; margin-top: -200px; margin-left: -200px; }
}

/*  AMBIENT GLOW  */

.ambient-glow {
    position: relative;
}
.ambient-glow::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    background: linear-gradient(135deg, var(--brand), var(--accent-sky), var(--accent-mint));
    background-size: 300% 300%;
    animation: gradientShift 8s ease infinite;
    z-index: -1;
    opacity: 0.3;
    filter: blur(12px);
}

/*  CONFETTI  */

.confetti-container {
    position: fixed; inset: 0;
    pointer-events: none;
    z-index: var(--z-max);
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    width: 10px; height: 10px;
    animation: confettiFall 3s ease-in-out forwards;
}

@keyframes confettiFall {
    0% { transform: translateY(-100vh) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/*  REDUCED MOTION  */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/*  GLOW TEXT  */

.glow-text {
    background: linear-gradient(135deg, var(--text-100), var(--brand-light), var(--text-100));
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 4s ease infinite;
}

/*  GLASSMORPHISM UTILS  */

.glass {
    background: rgba(12, 12, 20, 0.78);
    backdrop-filter: blur(20px) saturate(1.2);
    -webkit-backdrop-filter: blur(20px) saturate(1.2);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.glass-heavy {
    background: rgba(5, 5, 7, 0.88);
    backdrop-filter: blur(28px) saturate(1.4);
    -webkit-backdrop-filter: blur(28px) saturate(1.4);
    border: 1px solid rgba(255, 255, 255, 0.04);
}

/*  FOCUS RING  */

.focus-ring:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.15);
}

/*  SMOOTH SCROLL  */

.smooth-scroll {
    scroll-behavior: smooth;
    overscroll-behavior: contain;
}

/*  PREMIUM ACCENTS  */

/* Subtle shimmer effect for premium elements */
.shimmer-accent {
    position: relative;
    overflow: hidden;
}
.shimmer-accent::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.03), transparent);
    animation: shimmerSlide 4s ease infinite;
}
@keyframes shimmerSlide {
    0% { left: -100%; }
    100% { left: 200%; }
}

/* Subtle border glow on interactive elements */
.interactive-glow {
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}
.interactive-glow:hover {
    box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.2), 0 4px 20px rgba(0,0,0,0.3), 0 0 16px rgba(139, 92, 246, 0.05);
    border-color: rgba(139, 92, 246, 0.2);
}

/* Voice connected pulse animation */
@keyframes voicePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); }
}
.voice-pulse-glow {
    animation: voicePulse 2s ease-in-out infinite;
}

/* Music player now-playing pulse */
@keyframes musicPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.15); }
}

/* Gradient text for branding */
.gradient-text {
    background: linear-gradient(135deg, var(--text-100) 0%, var(--brand-light) 50%, var(--accent-sky) 100%);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 6s ease infinite;
}

/* Smooth status transitions */
.status-transition {
    transition: background-color 0.5s ease, box-shadow 0.5s ease;
}

/* ========================================
   Voice Channel Animations
   ======================================== */

/* Soundboard button press animation */
@keyframes soundboardPress {
    0% { transform: scale(1); }
    30% { transform: scale(0.88); }
    60% { transform: scale(1.08); }
    100% { transform: scale(1); }
}
.soundboard-playing {
    animation: soundboardPress 0.4s cubic-bezier(0.34,1.56,0.64,1);
}

/* Sound wave for speaking/soundboard */
@keyframes soundWave {
    0%, 100% { height: 4px; }
    50% { height: 16px; }
}
.sound-wave-bar {
    width: 3px;
    background: var(--success);
    border-radius: 2px;
    animation: soundWave 0.6s ease-in-out infinite;
}
.sound-wave-bar:nth-child(2) { animation-delay: 0.1s; }
.sound-wave-bar:nth-child(3) { animation-delay: 0.2s; }
.sound-wave-bar:nth-child(4) { animation-delay: 0.15s; }

/* Voice effect active glow */
@keyframes effectGlow {
    0%, 100% { box-shadow: 0 0 8px rgba(167,139,250,0.2); }
    50% { box-shadow: 0 0 20px rgba(167,139,250,0.4), 0 0 40px rgba(167,139,250,0.1); }
}
.voice-effect-active {
    animation: effectGlow 2s ease-in-out infinite;
}

/* Voice user join animation */
@keyframes voiceJoin {
    0% { opacity: 0; transform: translateX(-20px) scale(0.9); }
    60% { transform: translateX(4px) scale(1.02); }
    100% { opacity: 1; transform: translateX(0) scale(1); }
}
.voice-user-enter {
    animation: voiceJoin 0.4s cubic-bezier(0.34,1.56,0.64,1) forwards;
}

/* Voice user leave animation */
@keyframes voiceLeave {
    0% { opacity: 1; transform: translateX(0) scale(1); }
    100% { opacity: 0; transform: translateX(20px) scale(0.9); }
}
.voice-user-exit {
    animation: voiceLeave 0.3s ease-out forwards;
}

/* Push-to-talk active indicator */
@keyframes pttPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(52,211,153,0.5); }
    50% { box-shadow: 0 0 0 10px rgba(52,211,153,0); }
}
.ptt-active {
    animation: pttPulse 0.8s ease-in-out infinite;
}

/* ========================================
   Enhanced Page Animations
   ======================================== */

/* Smooth panel slide */
@keyframes slideUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-16px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes slideLeft {
    from { opacity: 0; transform: translateX(16px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes slideRight {
    from { opacity: 0; transform: translateX(-16px); }
    to { opacity: 1; transform: translateX(0); }
}
.slide-up   { animation: slideUp    0.35s var(--ease-spring) forwards; }
.slide-down { animation: slideDown  0.35s var(--ease-spring) forwards; }
.slide-left { animation: slideLeft  0.35s var(--ease-spring) forwards; }
.slide-right{ animation: slideRight 0.35s var(--ease-spring) forwards; }

/* Bounce in for emphasis */
@keyframes bounceIn {
    0% { opacity: 0; transform: scale(0.3); }
    50% { opacity: 1; transform: scale(1.08); }
    70% { transform: scale(0.95); }
    100% { transform: scale(1); }
}
.bounce-in { animation: bounceIn 0.5s cubic-bezier(0.34,1.56,0.64,1); }

/* Float effect for decorative elements */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}
.float-anim { animation: float 3s ease-in-out infinite; }

/* Fade scale for element entrance */
@keyframes fadeScale {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}
.fade-scale { animation: fadeScale 0.3s ease forwards; }

/* Gradient border animation */
@keyframes gradientBorder {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
.gradient-border {
    position: relative;
    border: none;
}
.gradient-border::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, var(--brand), var(--accent-sky), var(--accent-mint), var(--brand));
    background-size: 300% 300%;
    animation: gradientBorder 4s ease infinite;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

/* Typewriter for loading text */
@keyframes typewriter {
    from { width: 0; }
    to { width: 100%; }
}
@keyframes blink {
    50% { border-color: transparent; }
}

/* Particle rise for celebrations */
@keyframes particleRise {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    100% { transform: translateY(-100px) scale(0); opacity: 0; }
}

/* Shake for errors/warnings */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}
.shake { animation: shake 0.5s ease-in-out; }

/* Glow breathe for active states */
@keyframes glowBreathe {
    0%, 100% { box-shadow: 0 0 12px rgba(139,92,246,0.15); }
    50% { box-shadow: 0 0 24px rgba(139,92,246,0.3), 0 0 48px rgba(139,92,246,0.08); }
}
.glow-breathe { animation: glowBreathe 3s ease-in-out infinite; }

/* Number count pop */
@keyframes countPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); color: var(--brand); }
    100% { transform: scale(1); }
}
.count-pop { animation: countPop 0.3s ease; }
