/* ============================================
   CortexNet Chat - Futuristic UI Enhancements
   ============================================ */

/* ============================================
   Glassmorphism Effects
   ============================================ */

.glass-panel {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.glass-sidebar {
    background: rgba(18, 18, 26, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.glass-modal {
    background: rgba(18, 18, 26, 0.95);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* ============================================
   Animated Gradients
   ============================================ */

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

.animated-gradient {
    background: linear-gradient(-45deg, 
        var(--accent-primary), 
        var(--accent-secondary), 
        #a855f7, 
        var(--accent-primary));
    background-size: 400% 400%;
    animation: gradientShift 8s ease infinite;
}

.animated-gradient-text {
    background: linear-gradient(-45deg, 
        var(--accent-primary), 
        var(--accent-secondary), 
        #a855f7, 
        var(--accent-primary));
    background-size: 400% 400%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 8s ease infinite;
}

.animated-border {
    position: relative;
    border: 2px solid transparent;
    background: linear-gradient(var(--bg-secondary), var(--bg-secondary)) padding-box,
                linear-gradient(-45deg, var(--accent-primary), var(--accent-secondary), #a855f7) border-box;
    background-size: 400% 400%;
    animation: gradientShift 8s ease infinite;
}

/* ============================================
   Glow Effects
   ============================================ */

@keyframes glowPulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(var(--accent-rgb), 0.4),
                    0 0 40px rgba(var(--accent-rgb), 0.2),
                    0 0 60px rgba(var(--accent-rgb), 0.1);
    }
    50% {
        box-shadow: 0 0 30px rgba(var(--accent-rgb), 0.6),
                    0 0 60px rgba(var(--accent-rgb), 0.4),
                    0 0 90px rgba(var(--accent-rgb), 0.2);
    }
}

.glow-effect {
    animation: glowPulse 2s ease-in-out infinite;
}

.glow-on-hover:hover {
    box-shadow: 0 0 20px rgba(var(--accent-rgb), 0.5),
                0 0 40px rgba(var(--accent-rgb), 0.3);
    transition: box-shadow 0.3s ease;
}

.glow-active {
    box-shadow: 0 0 25px rgba(var(--accent-rgb), 0.6),
                0 0 50px rgba(var(--accent-rgb), 0.4);
}

/* ============================================
   Floating Action Button (FAB)
   ============================================ */

.fab-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
}

.fab-main {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent-gradient);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(var(--accent-rgb), 0.4),
                0 0 0 0 rgba(var(--accent-rgb), 0.5);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.fab-main::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.fab-main:hover::before {
    opacity: 1;
}

.fab-main:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 12px 32px rgba(var(--accent-rgb), 0.5),
                0 0 0 8px rgba(var(--accent-rgb), 0.1);
}

.fab-main.active {
    transform: rotate(45deg);
    background: var(--error);
}

.fab-main svg {
    width: 24px;
    height: 24px;
    transition: transform 0.3s ease;
}

.fab-menu {
    position: absolute;
    bottom: 72px;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.8);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.fab-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.fab-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 28px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    transition: all 0.2s ease;
    transform: translateX(10px);
    animation: fabItemIn 0.3s ease forwards;
}

.fab-menu.open .fab-item:nth-child(1) { animation-delay: 0.05s; }
.fab-menu.open .fab-item:nth-child(2) { animation-delay: 0.1s; }
.fab-menu.open .fab-item:nth-child(3) { animation-delay: 0.15s; }
.fab-menu.open .fab-item:nth-child(4) { animation-delay: 0.2s; }

@keyframes fabItemIn {
    from {
        opacity: 0;
        transform: translateX(20px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.fab-item:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
    transform: translateX(-4px);
    box-shadow: 0 6px 20px rgba(var(--accent-rgb), 0.4);
}

.fab-item svg {
    width: 20px;
    height: 20px;
    color: var(--accent-primary);
}

/* ============================================
   Particle Background
   ============================================ */

/* Canvas-based particles - nowa implementacja */
.particles-canvas {
    position: fixed;
    pointer-events: none;
    z-index: 0; /* Pod wiadomościami - wiadomości są w normalnym flow dokumentu, więc będą nad particle */
    opacity: 0.8;
    mix-blend-mode: screen;
}

[data-theme="light"] .particles-canvas {
    opacity: 0.4;
    mix-blend-mode: multiply;
}

/* Stare style - można usunąć jeśli nie używane */
.particles-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
    display: none; /* Ukryj stare cząsteczki */
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: var(--accent-primary);
    border-radius: 50%;
    opacity: 0.6;
    animation: particleFloat 20s infinite ease-in-out;
}

@keyframes particleFloat {
    0%, 100% {
        transform: translate(0, 0) scale(1);
        opacity: 0.3;
    }
    25% {
        transform: translate(30px, -50px) scale(1.2);
        opacity: 0.6;
    }
    50% {
        transform: translate(-20px, -100px) scale(0.8);
        opacity: 0.4;
    }
    75% {
        transform: translate(40px, -150px) scale(1.1);
        opacity: 0.7;
    }
}

/* Cyber Grid Background */
.cyber-grid {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.1;
    background-image: 
        linear-gradient(rgba(var(--accent-rgb), 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(var(--accent-rgb), 0.1) 1px, transparent 1px));
    background-size: 50px 50px;
    animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
    0% {
        transform: translate(0, 0);
    }
    100% {
        transform: translate(50px, 50px);
    }
}

/* ============================================
   Command Palette
   ============================================ */

.command-palette {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.command-palette.open {
    opacity: 1;
    visibility: visible;
}

.command-palette-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
}

.command-palette-content {
    position: relative;
    width: 100%;
    max-width: 640px;
    margin: 0 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(20px);
    transform: translateY(-20px) scale(0.95);
    transition: transform 0.2s ease;
    overflow: hidden;
}

.command-palette.open .command-palette-content {
    transform: translateY(0) scale(1);
}

.command-palette-input {
    width: 100%;
    padding: 20px 24px;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 1.1rem;
    font-family: var(--font-sans);
    outline: none;
}

.command-palette-input::placeholder {
    color: var(--text-muted);
}

.command-palette-results {
    max-height: 400px;
    overflow-y: auto;
    padding: 8px;
}

.command-palette-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s ease;
    color: var(--text-secondary);
}

.command-palette-item:hover,
.command-palette-item.selected {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.command-palette-item-icon {
    width: 20px;
    height: 20px;
    color: var(--accent-primary);
    flex-shrink: 0;
    margin-top: 2px;
}

.command-palette-item-content {
    flex: 1;
    min-width: 0;
}

.command-palette-item-label {
    font-weight: 500;
    margin-bottom: 4px;
    word-break: break-word;
}

.command-palette-item-label strong {
    color: var(--accent-primary);
    font-weight: 600;
}

.command-palette-item-context {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    line-height: 1.4;
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.command-palette-item-context strong {
    color: var(--accent-primary);
    font-weight: 600;
}

.command-palette-item-shortcut {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    font-family: var(--font-mono);
    padding: 2px 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    margin-top: 2px;
}

/* ============================================
   Ripple Effects
   ============================================ */

.ripple {
    position: relative;
    overflow: hidden;
}

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

.ripple.active::after {
    width: 300px;
    height: 300px;
    opacity: 0;
}

/* ============================================
   Magnetic Buttons
   ============================================ */

.magnetic-btn {
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

/* ============================================
   Enhanced Message Animations
   ============================================ */

.message {
    position: relative;
}

.message.streaming .message-bubble {
    position: relative;
    animation: messagePulse 2s ease-in-out infinite;
}

.message.streaming .message-bubble::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, 
        transparent, 
        var(--accent-primary), 
        var(--accent-secondary),
        transparent);
    background-size: 200% 100%;
    animation: streamingWave 1.5s ease-in-out infinite;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

@keyframes streamingWave {
    0% {
        background-position: -200% 0;
        opacity: 0.5;
    }
    50% {
        opacity: 1;
    }
    100% {
        background-position: 200% 0;
        opacity: 0.5;
    }
}

@keyframes messagePulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(var(--accent-rgb), 0);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.1);
    }
}

/* Enhanced message entry animation */
.message.animate-in {
    animation: messageSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.message.user.animate-in {
    animation: messageSlideInUser 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.message.model.animate-in {
    animation: messageSlideInModel 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

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

@keyframes messageSlideInUser {
    from {
        opacity: 0;
        transform: translateY(20px) translateX(10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) translateX(0) scale(1);
    }
}

@keyframes messageSlideInModel {
    from {
        opacity: 0;
        transform: translateY(20px) translateX(-10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) translateX(0) scale(1);
    }
}

/* Message highlight on new */
.message.new-message {
    animation: messageHighlight 0.6s ease-out;
}

@keyframes messageHighlight {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 0 30px rgba(var(--accent-rgb), 0.3);
    }
    100% {
        transform: scale(1);
    }
}

.typing-dots {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-primary);
    animation: typingDot 1.4s ease-in-out infinite;
}

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

@keyframes typingDot {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* ============================================
   Enhanced Progress Indicators
   ============================================ */

.progress-bar {
    width: 100%;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(-45deg, 
        var(--accent-primary), 
        var(--accent-secondary), 
        #a855f7, 
        var(--accent-primary));
    background-size: 400% 400%;
    animation: progressFlow 2s linear infinite, gradientShift 3s ease infinite;
    border-radius: 2px;
    position: relative;
    box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.5);
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.4), 
        transparent);
    animation: progressShine 2s ease-in-out infinite;
}

@keyframes progressFlow {
    0% {
        background-position: 0% 0%;
    }
    100% {
        background-position: 200% 0%;
    }
}

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

/* Enhanced loading spinner */
.loading-spinner-enhanced {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(var(--accent-rgb), 0.2);
    border-top-color: var(--accent-primary);
    border-right-color: var(--accent-secondary);
    border-radius: 50%;
    animation: spinEnhanced 1s linear infinite;
    position: relative;
}

.loading-spinner-enhanced::after {
    content: '';
    position: absolute;
    inset: -3px;
    border: 3px solid transparent;
    border-top-color: var(--accent-secondary);
    border-radius: 50%;
    animation: spinEnhanced 1.5s linear infinite reverse;
    opacity: 0.5;
}

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

/* Thinking Indicator */
.thinking-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-top: 8px;
}

.thinking-wave {
    width: 4px;
    height: 20px;
    background: var(--accent-primary);
    border-radius: 2px;
    animation: thinkingWave 1s ease-in-out infinite;
}

.thinking-wave:nth-child(1) { animation-delay: 0s; }
.thinking-wave:nth-child(2) { animation-delay: 0.1s; }
.thinking-wave:nth-child(3) { animation-delay: 0.2s; }
.thinking-wave:nth-child(4) { animation-delay: 0.3s; }

@keyframes thinkingWave {
    0%, 100% {
        transform: scaleY(0.5);
        opacity: 0.5;
    }
    50% {
        transform: scaleY(1);
        opacity: 1;
    }
}

/* ============================================
   3D Transforms
   ============================================ */

.card-3d {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    transform-style: preserve-3d;
}

.card-3d:hover {
    transform: translateY(-4px) rotateX(2deg);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

/* ============================================
   Enhanced Skeleton Loaders
   ============================================ */

.skeleton-shimmer {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.03) 0%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0.03) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

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

/* ============================================
   Keyboard Shortcuts Overlay
   ============================================ */

.shortcuts-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.shortcuts-overlay.open {
    opacity: 1;
    visibility: visible;
}

.shortcuts-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
}

.shortcuts-content {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(20px);
    padding: 24px;
    max-height: 80vh;
    overflow-y: auto;
}

.shortcuts-group {
    margin-bottom: 24px;
}

.shortcuts-group-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.shortcut-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    margin-bottom: 4px;
    transition: background 0.15s ease;
}

.shortcut-item:hover {
    background: var(--bg-hover);
}

.shortcut-label {
    color: var(--text-primary);
    font-size: 0.9rem;
}

.shortcut-keys {
    display: flex;
    gap: 4px;
}

.shortcut-key {
    padding: 4px 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    min-width: 24px;
    text-align: center;
}

/* ============================================
   Animated Icons
   ============================================ */

.icon-rotate-on-hover:hover {
    animation: iconRotate 0.6s ease-in-out;
}

.icon-pulse {
    animation: iconPulse 2s ease-in-out infinite;
}

.icon-spin {
    animation: iconSpin 1s linear infinite;
}

.icon-morph {
    transition: transform 0.3s ease;
}

.icon-morph:hover {
    transform: scale(1.1) rotate(5deg);
}

@keyframes iconRotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

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

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

/* Icon morphing (send -> stop) */
.send-icon-morph {
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.send-icon-morph.hidden {
    opacity: 0;
    transform: scale(0) rotate(180deg);
}

.stop-icon-morph {
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0;
    transform: scale(0) rotate(-180deg);
}

.stop-icon-morph.visible {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

/* ============================================
   Enhanced 3D Transforms
   ============================================ */

.card-3d {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                box-shadow 0.3s ease;
    transform-style: preserve-3d;
    perspective: 1000px;
}

.card-3d:hover {
    transform: translateY(-8px) rotateX(2deg) rotateY(-1deg);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4),
                0 0 20px rgba(var(--accent-rgb), 0.2);
}

.card-3d:active {
    transform: translateY(-4px) rotateX(1deg);
}

/* 3D Modal entrance */
.modal-3d {
    transform-style: preserve-3d;
    perspective: 1000px;
}

.modal-3d .modal-content {
    transform: rotateX(-10deg) translateZ(-50px);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.4s ease;
}

.modal-3d.visible .modal-content {
    transform: rotateX(0deg) translateZ(0);
    opacity: 1;
}

/* Parallax effect on scroll */
.parallax-element {
    transition: transform 0.1s ease-out;
    will-change: transform;
}

/* 3D model selector */
.model-selector-3d {
    transform-style: preserve-3d;
}

.model-selector-3d:hover {
    transform: rotateY(5deg) rotateX(-2deg);
}

/* ============================================
   Enhanced Toast Notifications
   ============================================ */

.toast-enhanced {
    position: relative;
    overflow: hidden;
    animation: toastSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast-enhanced::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--accent-gradient);
    width: 100%;
    transform: scaleX(1);
    transform-origin: left;
    animation: toastProgress 5s linear forwards;
}

.toast-enhanced.success::before {
    background: linear-gradient(90deg, var(--success), #34d399);
}

.toast-enhanced.error::before {
    background: linear-gradient(90deg, var(--error), #f87171);
}

.toast-enhanced.warning::before {
    background: linear-gradient(90deg, var(--warning), #fbbf24);
}

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

@keyframes toastProgress {
    from {
        transform: scaleX(1);
    }
    to {
        transform: scaleX(0);
    }
}

.toast-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast-enhanced.removing {
    animation: toastSlideOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

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

/* ============================================
   Enhanced Input Fields (Subtle)
   ============================================ */

/* Only apply to inputs NOT inside input-wrapper (conversation input) */
.input-enhanced:not(.input-wrapper .input-enhanced) {
    position: relative;
}

/* Exclude input-wrapper completely from input-enhanced styles */
.input-wrapper .input-enhanced,
.input-wrapper input-enhanced,
.input-wrapper .focus-ring,
.input-wrapper .pulsing-border {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

.input-enhanced:not(.input-wrapper .input-enhanced) input,
.input-enhanced:not(.input-wrapper .input-enhanced) textarea {
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Subtle focus ring - only on focus, not always visible */
.input-enhanced:not(.input-wrapper .input-enhanced) .focus-ring {
    position: absolute;
    inset: -2px;
    border-radius: var(--radius-md);
    border: 2px solid var(--accent-primary);
    opacity: 0;
    transform: scale(0.98);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.input-enhanced:not(.input-wrapper .input-enhanced) input:focus ~ .focus-ring,
.input-enhanced:not(.input-wrapper .input-enhanced) textarea:focus ~ .focus-ring {
    opacity: 0.3;
    transform: scale(1);
}

/* Remove pulsing border - too distracting */
.input-enhanced .pulsing-border {
    display: none;
}

/* ============================================
   Token Stats Animations
   ============================================ */

.token-stat-animated {
    position: relative;
    overflow: hidden;
}

.token-stat-value {
    display: inline-block;
    transition: transform 0.3s ease;
}

.token-stat-value.updating {
    animation: tokenCountUp 0.5s ease-out;
}

.token-stat-value.pulse {
    animation: tokenPulse 0.6s ease-out;
}

@keyframes tokenCountUp {
    0% {
        transform: translateY(10px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes tokenPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
        color: var(--accent-primary);
    }
}

.token-stat-gradient {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 3s ease infinite;
}

/* ============================================
   Live Status Indicators
   ============================================ */

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    font-size: 0.85rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    /* Static - no animation by default */
    box-shadow: 0 0 4px var(--success);
}

.status-dot.streaming {
    background: var(--accent-primary);
    box-shadow: 0 0 4px var(--accent-primary);
    /* Subtle pulse only when streaming */
    animation: statusPulse 2s ease-in-out infinite;
}

.status-dot.offline {
    background: var(--text-tertiary);
    box-shadow: none;
    animation: none;
}

@keyframes statusPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.status-waves {
    display: flex;
    gap: 4px;
    align-items: center;
}

.status-wave {
    width: 3px;
    height: 16px;
    background: var(--accent-primary);
    border-radius: 2px;
    animation: statusWave 1.2s ease-in-out infinite;
}

.status-wave:nth-child(1) { animation-delay: 0s; }
.status-wave:nth-child(2) { animation-delay: 0.2s; }
.status-wave:nth-child(3) { animation-delay: 0.4s; }
.status-wave:nth-child(4) { animation-delay: 0.6s; }

@keyframes statusWave {
    0%, 100% {
        transform: scaleY(0.5);
        opacity: 0.5;
    }
    50% {
        transform: scaleY(1);
        opacity: 1;
    }
}

/* ============================================
   Enhanced Skeleton Loaders
   ============================================ */

.skeleton-enhanced {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.03) 0%,
        rgba(255, 255, 255, 0.08) 50%,
        rgba(255, 255, 255, 0.03) 100%
    );
    background-size: 200% 100%;
    animation: shimmerEnhanced 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
    position: relative;
    overflow: hidden;
}

.skeleton-enhanced::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    animation: skeletonShine 2s ease-in-out infinite;
}

@keyframes shimmerEnhanced {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

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

.skeleton-pulse {
    animation: skeletonPulse 1.5s ease-in-out infinite;
}

@keyframes skeletonPulse {
    0%, 100% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
}

/* ============================================
   Responsive Adjustments
   ============================================ */

@media (max-width: 768px) {
    .fab-container {
        bottom: 16px;
        right: 16px;
    }

    .fab-main {
        width: 48px;
        height: 48px;
    }

    .command-palette-content {
        margin: 0 16px;
    }

    .shortcuts-content {
        margin: 0 16px;
        padding: 20px;
    }
}

/* ============================================
   Aurora Background - Nowoczesny efekt tła
   ============================================ */

.aurora-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.aurora-bg::before {
    content: '';
    position: absolute;
    top: -30%;
    left: -20%;
    width: 70%;
    height: 70%;
    background: radial-gradient(ellipse at center,
        rgba(var(--accent-rgb), 0.12) 0%,
        transparent 60%);
    filter: blur(60px);
    animation: auroraDrift1 18s ease-in-out infinite alternate;
}

.aurora-bg::after {
    content: '';
    position: absolute;
    bottom: -20%;
    right: -10%;
    width: 60%;
    height: 60%;
    background: radial-gradient(ellipse at center,
        rgba(139, 92, 246, 0.09) 0%,
        transparent 60%);
    filter: blur(80px);
    animation: auroraDrift2 22s ease-in-out infinite alternate;
}

@keyframes auroraDrift1 {
    from { transform: translate(0, 0) scale(1); }
    to   { transform: translate(6%, 8%) scale(1.08); }
}

@keyframes auroraDrift2 {
    from { transform: translate(0, 0) scale(1); }
    to   { transform: translate(-5%, -6%) scale(1.05); }
}

[data-theme="light"] .aurora-bg::before {
    opacity: 0.4;
}

[data-theme="light"] .aurora-bg::after {
    opacity: 0.3;
}

/* ============================================
   Grain Texture Overlay (subtle noise)
   ============================================ */

.grain-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    opacity: 0.025;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

[data-theme="light"] .grain-overlay {
    opacity: 0.015;
}

/* ============================================
   Enhanced Sidebar Visual Dividers
   ============================================ */

.sidebar-section-label {
    padding: 6px 16px 4px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    user-select: none;
}

/* ============================================
   Conversation Item - pulse indicator for active
   ============================================ */

.conversation-item.active .title {
    font-weight: 500;
}

/* ============================================
   Micro-interactions: btn-icon ripple
   ============================================ */

.btn-icon {
    position: relative;
    overflow: hidden;
}

.btn-icon::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: currentColor;
    opacity: 0;
    transform: scale(0);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.btn-icon:active::after {
    transform: scale(2);
    opacity: 0.08;
    transition: none;
}

/* ============================================
   Input area - floating label animation
   ============================================ */

.input-wrapper textarea {
    font-family: var(--font-body, 'DM Sans', sans-serif);
    font-size: 1rem;
}

/* ============================================
   Sidebar - hover glow on new chat btn
   ============================================ */

.new-chat-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg,
        rgba(255,255,255,0.15) 0%,
        transparent 50%,
        rgba(255,255,255,0.05) 100%);
    opacity: 0;
    transition: opacity var(--transition-fast);
    border-radius: inherit;
    pointer-events: none;
}

.new-chat-btn:hover::before {
    opacity: 1;
}

/* ============================================
   Code block - improved header
   ============================================ */

.code-block-wrapper {
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-color);
    margin: 12px 0;
}

.code-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid var(--border-color);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.code-block-header .lang-badge {
    color: var(--accent-secondary);
    font-weight: 600;
}

/* ============================================
   Message bubble - subtle inner highlight
   ============================================ */

.message.model .message-bubble {
    position: relative;
}

.message.model .message-bubble::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg,
        transparent,
        rgba(var(--accent-rgb), 0.15),
        transparent);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

/* ============================================
   Glassmorphism header
   ============================================ */

[data-theme="dark"] .chat-header {
    background: rgba(16, 16, 26, 0.9);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
}

[data-theme="dark"] .input-area {
    background: linear-gradient(to top,
        rgba(8, 8, 15, 1) 60%,
        rgba(8, 8, 15, 0.6) 85%,
        transparent 100%);
}

/* ============================================
   prefers-reduced-motion: disable heavy animations
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    .aurora-bg::before,
    .aurora-bg::after,
    .new-chat-btn,
    .animated-gradient,
    .animated-gradient-text,
    .glow-effect,
    .particle,
    .welcome-icon {
        animation: none !important;
    }

    .message,
    .toast,
    .modal-content {
        transition: opacity 0.15s ease !important;
    }
}

