/**
 * Shared UI Components - Complete Styles
 * =======================================
 * This file contains shared UI CSS used across multiple features.
 *
 * Consolidated from:
 * - enhanced-waiting-experience.css (loading animations)
 * - modern-link-preview-v2.css (link preview cards)
 *
 * Mobile styles are now in feature-specific mobile CSS files:
 * - features/chat/chat-mobile.css
 * - features/documents/document-mobile.css
 * - features/blog/blog-mobile.css
 *
 * Last updated: January 19, 2026
 */

/* Enhanced Waiting Experience - Keep Users Engaged During AI Processing */

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --success-gradient: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
    --processing-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --thinking-gradient: linear-gradient(135deg, #1e3a8a 0%, #1e2563 100%);
    --pulse-color: rgba(37, 99, 235, 0.4);
}

/* Main thinking/processing container */
.enhanced-thinking-container {
    background: var(--thinking-gradient);
    border-radius: 16px;
    padding: 20px;
    margin: 10px 0;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(37, 99, 235, 0.3);
    animation: breathing 3s ease-in-out infinite;
}

.enhanced-thinking-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    animation: scan 2s linear infinite;
}

/* AI Brain Animation */
.ai-brain-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
}

.ai-brain {
    width: 80px;
    height: 80px;
    background: linear-gradient(45deg, #fff, #e3f2fd);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    animation: brain-pulse 2s ease-in-out infinite;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

.ai-brain::before {
    content: '🧠';
    font-size: 36px;
    animation: brain-think 1.5s ease-in-out infinite;
}

.neural-connections {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
}

.neural-line {
    position: absolute;
    width: 2px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 1px;
    animation: neural-pulse 2s ease-in-out infinite;
}

.neural-line:nth-child(1) {
    height: 20px;
    top: -10px;
    left: 20px;
    transform: rotate(45deg);
    animation-delay: 0.2s;
}

.neural-line:nth-child(2) {
    height: 15px;
    top: 15px;
    right: -8px;
    transform: rotate(-30deg);
    animation-delay: 0.5s;
}

.neural-line:nth-child(3) {
    height: 18px;
    bottom: -9px;
    left: 30px;
    transform: rotate(120deg);
    animation-delay: 0.8s;
}

/* Dynamic Status Text */
.dynamic-status {
    text-align: center;
    color: white;
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 15px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.status-icons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
}

.status-icon {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    animation: icon-bounce 1.4s ease-in-out infinite;
}

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

.status-icon.active {
    background: white;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

/* Progress Ring */
.progress-ring-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 15px;
}

.progress-ring {
    width: 90px;
    height: 90px;
    position: relative;
}

.progress-ring-circle {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top: 4px solid white;
    animation: ring-spin 1s linear infinite;
}

.progress-percentage {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    font-size: 14px;
}

/* Agent Activity Indicators */
.agent-activity {
    display: flex;
    justify-content: space-around;
    margin-top: 10px;
}

.agent-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.agent-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.3s ease;
}

.agent-icon.active {
    background: white;
    color: #667eea;
    animation: agent-pulse 1s ease-in-out infinite;
}

.agent-label {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
}

/* Fun Facts During Wait */
.fun-fact-container {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 12px;
    margin-top: 15px;
    backdrop-filter: blur(10px);
}

.fun-fact-title {
    color: white;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 5px;
    opacity: 0.9;
}

.fun-fact-text {
    color: white;
    font-size: 11px;
    line-height: 1.4;
    opacity: 0.8;
}

/* Interactive Elements */
.wait-interactive {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
}

.interactive-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: all 0.3s ease;
    animation: gentle-bob 2s ease-in-out infinite;
}

.interactive-dot:hover {
    background: white;
    transform: scale(1.2);
}

.interactive-dot:nth-child(2) { animation-delay: 0.3s; }
.interactive-dot:nth-child(3) { animation-delay: 0.6s; }
.interactive-dot:nth-child(4) { animation-delay: 0.9s; }

/* Estimated Time Remaining */
.time-estimate {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 12px;
}

.time-icon {
    animation: tick 1s ease-in-out infinite;
}

/* Processing Stage Visualizer */
.stage-visualizer {
    display: flex;
    justify-content: space-between;
    margin: 15px 0;
    position: relative;
}

.stage-step {
    flex: 1;
    text-align: center;
    position: relative;
}

.stage-step::before {
    content: '';
    position: absolute;
    top: 12px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: rgba(255, 255, 255, 0.2);
    z-index: 1;
}

.stage-step:last-child::before {
    display: none;
}

.stage-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    margin: 0 auto 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    position: relative;
    z-index: 2;
    transition: all 0.3s ease;
}

.stage-circle.completed {
    background: white;
    color: #667eea;
}

.stage-circle.active {
    background: white;
    animation: stage-pulse 1.5s ease-in-out infinite;
}

.stage-label {
    font-size: 9px;
    color: rgba(255, 255, 255, 0.8);
}

/* Animations */
@keyframes breathing {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

@keyframes scan {
    0% { left: -100%; }
    100% { left: 100%; }
}

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

@keyframes brain-think {
    0%, 100% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(-5deg) scale(1.05); }
    75% { transform: rotate(5deg) scale(1.05); }
}

@keyframes neural-pulse {
    0%, 100% { opacity: 0.3; transform: scaleY(1); }
    50% { opacity: 1; transform: scaleY(1.5); }
}

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

@keyframes ring-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

@keyframes gentle-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

@keyframes tick {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(15deg); }
}

@keyframes stage-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7); }
    50% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(255, 255, 255, 0); }
}

/* Countdown Timer - Right side of waiting animation */
.countdown-timer {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(4px);
}

.countdown-value {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    line-height: 1;
}

.countdown-label {
    font-size: 9px;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

/* Responsive Design */
@media (max-width: 767px) {
    .enhanced-thinking-container {
        padding: 15px;
        margin: 8px 0;
    }
    
    .ai-brain {
        width: 60px;
        height: 60px;
    }
    
    .ai-brain::before {
        font-size: 28px;
    }
    
    .dynamic-status {
        font-size: 14px;
    }
    
    .progress-ring {
        width: 70px;
        height: 70px;
    }
    
    .stage-circle {
        width: 24px;
        height: 24px;
        font-size: 10px;
    }
    
    .stage-label {
        font-size: 8px;
    }
    
    .agent-icon {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }
    
    .countdown-timer {
        width: 48px;
        height: 48px;
        top: 12px;
        right: 12px;
    }
    
    .countdown-value {
        font-size: 16px;
    }
    
    .countdown-label {
        font-size: 7px;
    }
}

/* Dark Theme Compatibility */
@media (prefers-color-scheme: dark) {
    .enhanced-thinking-container {
        box-shadow: 0 8px 32px rgba(79, 172, 254, 0.2);
    }
}

/* Accessibility - Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .enhanced-thinking-container,
    .ai-brain,
    .neural-line,
    .status-icon,
    .progress-ring-circle,
    .agent-icon,
    .interactive-dot,
    .time-icon,
    .stage-circle {
        animation: none;
    }
    
    .enhanced-thinking-container::before {
        display: none;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .enhanced-thinking-container {
        border: 2px solid white;
    }
    
    .ai-brain {
        border: 2px solid currentColor;
    }
    
    .status-icon, .agent-icon, .stage-circle {
        border: 1px solid currentColor;
    }
}
/**
 * Modern Link Preview Cards - Ultra-Premium Styles v2.0
 * Absolutely stunning glassmorphic design with futuristic effects
 * 
 * Features:
 * - Advanced glassmorphism with noise texture
 * - Holographic shimmer effects
 * - Aurora borealis backgrounds
 * - Animated gradient borders
 * - Parallax thumbnail animations
 * - Magnetic cursor interactions
 * - Butter-smooth transitions
 * - Premium micro-interactions
 * 
 * @version 2.0.0
 * @author Glass Lane AI
 */

/* ============================================
   Container & Layout
   ============================================ */

.link-preview-container-v2 {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 24px 0;
    margin: 20px 0;
    max-height: 600px;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
}

/* Custom Scrollbar */
.link-preview-container-v2::-webkit-scrollbar {
    width: 6px;
}

.link-preview-container-v2::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.link-preview-container-v2::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #00D4FF, #7B2FFF);
    border-radius: 10px;
    transition: background 0.3s ease;
}

.link-preview-container-v2::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #00E5FF, #8B3FFF);
}

/* Section Header */
.link-preview-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: linear-gradient(135deg, 
        rgba(0, 212, 255, 0.08) 0%, 
        rgba(123, 47, 255, 0.08) 100%);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    position: relative;
    overflow: hidden;
}

.link-preview-section-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.05), 
        transparent);
    animation: shimmerHeader 3s infinite;
}

@keyframes shimmerHeader {
    0%, 100% { transform: translateX(-100%); }
    50% { transform: translateX(100%); }
}

.header-icon-wrapper {
    position: relative;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #00D4FF, #7B2FFF);
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.4);
}

.header-icon-wrapper i {
    color: white;
    font-size: 16px;
    z-index: 1;
}

.icon-glow {
    position: absolute;
    inset: -4px;
    background: radial-gradient(circle, rgba(0, 212, 255, 0.4), transparent 70%);
    border-radius: 12px;
    animation: pulse 2s ease-in-out infinite;
}

.header-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    letter-spacing: 0.5px;
}

.header-count {
    margin-left: auto;
    padding: 6px 12px;
    background: rgba(0, 212, 255, 0.2);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    color: #00D4FF;
}

/* Grid Layout */
.link-preview-grid-v2 {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ============================================
   Card Base Styles
   ============================================ */

.modern-link-preview-card-v2 {
    position: relative;
    display: block;
    width: 100%;
    min-height: 140px;
    background: linear-gradient(135deg, 
        rgba(6, 182, 212, 0.05) 0%, 
        rgba(59, 130, 246, 0.05) 50%, 
        rgba(147, 51, 234, 0.05) 100%);
    backdrop-filter: blur(40px) saturate(150%);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 
        inset 0 0 0 1px rgba(255, 255, 255, 0.05),
        0 0 0 1px rgba(0, 212, 255, 0.1),
        0 10px 40px -10px rgba(0, 212, 255, 0.25),
        0 0 80px -20px rgba(147, 51, 234, 0.15);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    animation: slideInWithGlow 0.6s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

@keyframes slideInWithGlow {
    from {
        opacity: 0;
        transform: translateX(-30px) scale(0.95);
        filter: blur(10px);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
        filter: blur(0);
    }
}

/* Holographic Shimmer Effect */
.link-preview-holographic-shine {
    position: absolute;
    inset: -2px;
    background: linear-gradient(45deg, 
        transparent, 
        rgba(0, 212, 255, 0.3), 
        transparent);
    transform: translateX(-100%);
    pointer-events: none;
    z-index: 2;
}

.modern-link-preview-card-v2:hover .link-preview-holographic-shine {
    animation: holographicSlide 0.8s ease-out;
}

@keyframes holographicSlide {
    to { transform: translateX(100%); }
}

/* Aurora Background */
.link-preview-aurora-bg {
    position: absolute;
    inset: 0;
    opacity: 0;
    background: radial-gradient(
        circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
        rgba(0, 212, 255, 0.15) 0%,
        rgba(123, 47, 255, 0.1) 40%,
        transparent 70%
    );
    transition: opacity 0.6s ease;
    pointer-events: none;
    z-index: 1;
}

.modern-link-preview-card-v2:hover .link-preview-aurora-bg {
    opacity: 1;
}

/* Glass Refraction Line */
.modern-link-preview-card-v2::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.5), 
        transparent);
    animation: shimmerLine 3s infinite;
    pointer-events: none;
    z-index: 3;
}

@keyframes shimmerLine {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.8; }
}

/* Hover State */
.modern-link-preview-card-v2:hover {
    transform: translateY(-8px);
    box-shadow: 
        inset 0 0 0 1px rgba(255, 255, 255, 0.1),
        0 0 0 1px rgba(0, 212, 255, 0.3),
        0 20px 60px -10px rgba(0, 212, 255, 0.4),
        0 0 120px -20px rgba(147, 51, 234, 0.3);
    border-color: rgba(0, 212, 255, 0.3);
}

/* ============================================
   Content Layout
   ============================================ */

.link-preview-content-layout {
    display: flex;
    gap: 0;
    position: relative;
    z-index: 2;
    height: 100%;
}

/* ============================================
   Thumbnail Section
   ============================================ */

.link-preview-thumbnail-section {
    position: relative;
    width: 200px;
    min-height: 180px;
    overflow: hidden;
    border-radius: 20px 0 0 20px;
}

.link-preview-thumbnail-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.modern-link-preview-card-v2:hover .link-preview-thumbnail-image {
    transform: scale(1.1);
}

.link-preview-thumbnail-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, 
        #00D4FF 0%, 
        #7B2FFF 50%, 
        #FF006E 100%);
    overflow: hidden;
}

.link-preview-mesh-gradient {
    position: absolute;
    inset: 0;
    background-image: 
        radial-gradient(at 40% 20%, rgba(0, 212, 255, 0.6) 0px, transparent 50%),
        radial-gradient(at 80% 0%, rgba(123, 47, 255, 0.6) 0px, transparent 50%),
        radial-gradient(at 0% 50%, rgba(255, 0, 110, 0.4) 0px, transparent 50%),
        radial-gradient(at 80% 50%, rgba(255, 128, 0, 0.4) 0px, transparent 50%),
        radial-gradient(at 0% 100%, rgba(0, 212, 255, 0.5) 0px, transparent 50%);
    animation: meshFloat 8s ease-in-out infinite;
}

@keyframes meshFloat {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(-5%, 5%) rotate(2deg); }
    66% { transform: translate(5%, -5%) rotate(-2deg); }
}

/* Number Badge - Hidden */
.link-preview-number-badge {
    display: none;
    position: absolute;
    top: 16px;
    left: 16px;
    width: 48px;
    height: 48px;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(20px);
    border-radius: 50%;
    border: 2px solid var(--badge-color, #00D4FF);
    box-shadow: 0 0 20px var(--badge-color, #00D4FF);
    z-index: 10;
    transition: all 0.3s ease;
}

.modern-link-preview-card-v2:hover .link-preview-number-badge {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 0 30px var(--badge-color, #00D4FF);
}

.badge-number {
    font-size: 18px;
    font-weight: 700;
    color: var(--badge-color, #00D4FF);
    text-shadow: 0 0 10px var(--badge-color, #00D4FF);
}

.badge-glow {
    position: absolute;
    inset: -6px;
    background: radial-gradient(circle, var(--badge-color, #00D4FF), transparent 70%);
    border-radius: 50%;
    opacity: 0.4;
    animation: pulse 2s ease-in-out infinite;
}

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

/* ============================================
   Content Section
   ============================================ */

.link-preview-content-section {
    flex: 1;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
}

/* Header Row */
.link-preview-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.link-preview-meta-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.link-preview-favicon {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    object-fit: cover;
}

.link-preview-domain-letter {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #00D4FF, #7B2FFF);
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    color: white;
}

.link-preview-domain {
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 0.3px;
}

.link-preview-meta-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Source Badge */
.link-preview-source-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--badge-color, #00D4FF);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    color: var(--badge-color, #00D4FF);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.link-preview-source-badge::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.1), 
        transparent);
    transform: translateX(-100%);
}

.modern-link-preview-card-v2:hover .link-preview-source-badge::before {
    animation: badgeShimmer 1s ease-out;
}

@keyframes badgeShimmer {
    to { transform: translateX(100%); }
}

.link-preview-source-badge i {
    font-size: 12px;
}

/* Read Time */
.link-preview-read-time {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

.link-preview-read-time i {
    font-size: 11px;
}

/* Title */
.link-preview-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.95);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.3s ease;
}

.modern-link-preview-card-v2:hover .link-preview-title {
    background: linear-gradient(135deg, #00D4FF, #7B2FFF);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Description */
.link-preview-description {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.7);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Meta Info Row */
.link-preview-meta-info-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: auto;
}

.link-preview-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

.link-preview-meta-item i {
    font-size: 11px;
    opacity: 0.8;
}

/* ============================================
   Action Buttons
   ============================================ */

.link-preview-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

/* Primary Button */
.link-preview-btn-primary {
    position: relative;
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.2), rgba(123, 47, 255, 0.2));
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    color: #00D4FF;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.link-preview-btn-primary:hover {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.3), rgba(123, 47, 255, 0.3));
    border-color: rgba(0, 212, 255, 0.5);
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.4);
    transform: translateY(-2px);
}

.link-preview-btn-primary:active {
    transform: translateY(0);
}

.btn-gradient-border {
    position: absolute;
    inset: -2px;
    background: linear-gradient(90deg, 
        #00D4FF, 
        #7B2FFF, 
        #FF006E, 
        #00D4FF);
    background-size: 300% 100%;
    border-radius: 14px;
    opacity: 0;
    z-index: -1;
    transition: opacity 0.3s ease;
}

.link-preview-btn-primary:hover .btn-gradient-border {
    opacity: 0.5;
    animation: gradientFlow 3s linear infinite;
}

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

.btn-arrow {
    transition: transform 0.3s ease;
}

.link-preview-btn-primary:hover .btn-arrow {
    transform: translateX(4px);
}

/* Secondary Buttons */
.link-preview-btn-secondary {
    position: relative;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
}

.link-preview-btn-secondary:hover {
    background: rgba(0, 212, 255, 0.2);
    border-color: rgba(0, 212, 255, 0.4);
    color: #00D4FF;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
}

.link-preview-btn-secondary i {
    font-size: 16px;
    z-index: 1;
}

/* Ripple Effect */
.btn-ripple,
.click-ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0);
    animation: rippleEffect 0.6s ease-out;
    pointer-events: none;
}

@keyframes rippleEffect {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

.click-ripple {
    width: 20px;
    height: 20px;
    margin-left: -10px;
    margin-top: -10px;
}

/* ============================================
   Skeleton Loading
   ============================================ */

.skeleton-loading {
    pointer-events: none;
}

.skeleton-shimmer {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.05), 
        transparent);
    animation: skeletonShimmer 1.5s infinite;
    z-index: 10;
}

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

.skeleton-box {
    background: linear-gradient(90deg, 
        rgba(255, 255, 255, 0.05), 
        rgba(255, 255, 255, 0.1), 
        rgba(255, 255, 255, 0.05));
    background-size: 200% 100%;
    animation: skeletonPulse 1.5s ease-in-out infinite;
    border-radius: 8px;
}

@keyframes skeletonPulse {
    0%, 100% { background-position: 200% 0; }
    50% { background-position: 0 0; }
}

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

.link-preview-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 14px 24px;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 12px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: var(--z-toast, 1300);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.link-preview-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 767px) {
    .link-preview-thumbnail-section {
        width: 140px;
        min-height: 160px;
    }
    
    .link-preview-content-section {
        padding: 16px 18px;
    }
    
    .link-preview-title {
        font-size: 16px;
    }
    
    .link-preview-description {
        font-size: 13px;
    }
}

@media (max-width: 640px) {
    .modern-link-preview-card-v2 {
        min-height: auto;
    }
    
    .link-preview-content-layout {
        flex-direction: column;
    }
    
    .link-preview-thumbnail-section {
        width: 100%;
        height: 160px;
        min-height: auto;
        border-radius: 20px 20px 0 0;
    }
    
    .link-preview-content-section {
        padding: 20px;
    }
    
    .link-preview-actions {
        flex-direction: column;
    }
    
    .link-preview-btn-primary {
        width: 100%;
    }
    
    .link-preview-meta-right {
        flex-direction: column;
        align-items: flex-end;
    }
}

/* ============================================
   Accessibility
   ============================================ */

.modern-link-preview-card-v2:focus-visible {
    outline: 2px solid #00D4FF;
    outline-offset: 4px;
}

button:focus-visible {
    outline: 2px solid #00D4FF;
    outline-offset: 2px;
}

/*
 * Reduced Motion - Accessibility
 * Uses html body selector for higher specificity (0,0,2) to override most animations.
 * This respects user's OS-level motion sensitivity preferences.
 */
@media (prefers-reduced-motion: reduce) {
    html body *,
    html body *::before,
    html body *::after {
        animation-duration: 0.01ms;
        animation-iteration-count: 1;
        transition-duration: 0.01ms;
    }

    .modern-link-preview-card-v2:hover {
        transform: none;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .modern-link-preview-card-v2 {
        border: 2px solid currentColor;
    }
    
    .link-preview-btn-primary,
    .link-preview-btn-secondary {
        border: 2px solid currentColor;
    }
}

/* Dark Theme Adjustments */
.dark-theme .modern-link-preview-card-v2,
.dark-mode .modern-link-preview-card-v2 {
    background: linear-gradient(135deg, 
        rgba(6, 182, 212, 0.08) 0%, 
        rgba(59, 130, 246, 0.08) 50%, 
        rgba(147, 51, 234, 0.08) 100%);
}

/* ============================================
   Modern Sources Display System
   ============================================ */

/*
 * Sources Chips Bar - Horizontal display at top of messages
 * Uses html body prefix for higher specificity (0,1,2) to ensure
 * consistent layout regardless of parent flex/grid context.
 */
html body .sources-chips-container {
    width: 100%;
    display: block;
    margin: 0 0 14px 0;
    padding: 0;
    background: none;
    border-radius: 0;
    border: none;
    backdrop-filter: none;
    box-sizing: border-box;
    clear: both;
    float: none;
    position: relative;
    z-index: var(--z-dropdown, 100);
    /* Force top positioning regardless of parent layout */
    flex: 0 0 auto;
    grid-column: 1 / -1;
    order: -999;
    align-self: stretch;
    /* Reset any positioning */
    top: auto;
    left: auto;
    right: auto;
    bottom: auto;
    transform: none;
}

.sources-chips-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
}

.sources-label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 4px;
    flex-shrink: 0;
}

.sources-label i {
    color: rgba(0, 242, 254, 0.7);
    font-size: 11px;
    text-shadow: none;
}

.source-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 11px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 9px;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    overflow: hidden;
    box-shadow: none;
    flex-shrink: 0;
    text-decoration: none;
}

.source-chip:hover {
    background: rgba(0, 242, 254, 0.08);
    border-color: rgba(0, 242, 254, 0.3);
    transform: none;
    box-shadow: none;
}

.source-chip::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.1), 
        transparent);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.source-chip:hover::before {
    transform: translateX(100%);
}

.source-chip-number {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 242, 254, 0.15);
    color: #00f2fe;
    border-radius: 50%;
    font-size: 10px;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: none;
}

.source-chip-content {
    display: flex;
    align-items: center;
    gap: 7px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    font-weight: 500;
    text-shadow: none;
}

.source-chip-content i {
    font-size: 10px;
    opacity: 0.8;
}

.source-chip-domain {
    font-weight: 500;
    opacity: 0.9;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    max-width: 120px;
}

/* ============================================
   Detailed Sources Panel - Full screen overlay
   ============================================ */

.detailed-sources-panel {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal, 1050);
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(20px);
    background: rgba(0, 0, 0, 0.4);
    /* Prevent body scroll when panel is open */
    overscroll-behavior: contain;
}

.detailed-sources-panel.open {
    opacity: 1;
    visibility: visible;
}

/* Prevent background scrolling when panel is open */
body:has(.detailed-sources-panel.open) {
    overflow: hidden;
}

.detailed-sources-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    cursor: pointer;
}

.detailed-sources-container {
    position: absolute;
    top: 5%;
    right: 5%;
    bottom: 5%;
    width: 500px;
    max-width: 90vw;
    background: linear-gradient(135deg, 
        rgba(6, 25, 47, 0.95) 0%,
        rgba(10, 25, 47, 0.98) 100%);
    backdrop-filter: blur(30px);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 20px;
    box-shadow: 
        0 0 0 1px rgba(255, 255, 255, 0.05),
        0 20px 80px rgba(0, 0, 0, 0.5),
        0 0 100px rgba(0, 212, 255, 0.1);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.detailed-sources-panel.open .detailed-sources-container {
    transform: translateX(0);
}

.detailed-sources-header-bar {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 212, 255, 0.05);
    border-radius: 20px 20px 0 0;
    flex-shrink: 0;
}

.detailed-sources-header-bar h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 12px;
}

.detailed-sources-header-bar h2 i {
    color: #00D4FF;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

.detailed-sources-close {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #ffffff;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
}

.detailed-sources-close:hover {
    background: rgba(255, 0, 0, 0.2);
    border-color: rgba(255, 0, 0, 0.4);
    transform: scale(1.05);
}

.detailed-sources-content {
    flex: 1;
    padding: 20px 24px;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
}

.detailed-sources-header {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.detailed-sources-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.detailed-sources-header h3 i {
    color: #00D4FF;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

.sources-count {
    padding: 4px 12px;
    background: rgba(0, 212, 255, 0.2);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 15px;
    font-size: 12px;
    font-weight: 600;
    color: #00D4FF;
}

/* ============================================
   Detailed Source Cards
   ============================================ */

.detailed-source-card {
    margin-bottom: 16px;
    background: linear-gradient(135deg, 
        rgba(6, 182, 212, 0.05) 0%, 
        rgba(59, 130, 246, 0.05) 50%, 
        rgba(147, 51, 234, 0.05) 100%);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 16px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.detailed-source-card:hover {
    transform: translateY(-4px);
    box-shadow: 
        0 0 0 1px var(--source-color, #00D4FF),
        0 12px 40px rgba(var(--source-color-rgb, 0, 212, 255), 0.2);
    border-color: var(--source-color, #00D4FF);
}

.detailed-source-card.highlighted {
    transform: translateY(-4px);
    box-shadow: 
        0 0 0 2px var(--source-color, #00D4FF),
        0 12px 40px rgba(var(--source-color-rgb, 0, 212, 255), 0.4);
    border-color: var(--source-color, #00D4FF);
}

.detailed-source-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.detailed-source-number {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--source-color, #00D4FF);
    color: rgba(0, 0, 0, 0.8);
    border-radius: 50%;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 0 15px rgba(var(--source-color-rgb, 0, 212, 255), 0.4);
}

.detailed-source-type {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(var(--source-color-rgb, 0, 212, 255), 0.2);
    border: 1px solid var(--source-color, #00D4FF);
    border-radius: 12px;
    color: var(--source-color, #00D4FF);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detailed-source-domain {
    margin-left: auto;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
}

.detailed-source-title {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
    color: rgba(255, 255, 255, 0.95);
}

.detailed-source-description {
    margin: 0 0 12px 0;
    font-size: 13px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.7);
}

.detailed-source-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.source-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
}

.source-meta-item i {
    font-size: 10px;
    opacity: 0.8;
}

.detailed-source-actions {
    display: flex;
    gap: 8px;
}

.detailed-source-button {
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.detailed-source-button.primary {
    background: linear-gradient(135deg, var(--source-color, #00D4FF), rgba(var(--source-color-rgb, 0, 212, 255), 0.8));
    color: rgba(0, 0, 0, 0.8);
    flex: 1;
}

.detailed-source-button.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(var(--source-color-rgb, 0, 212, 255), 0.4);
}

.detailed-source-button.secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.8);
}

.detailed-source-button.secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Custom Scrollbar for Detailed Sources */
.detailed-sources-content::-webkit-scrollbar {
    width: 6px;
}

.detailed-sources-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.detailed-sources-content::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #00D4FF, #7B2FFF);
    border-radius: 10px;
    transition: background 0.3s ease;
}

.detailed-sources-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #7B2FFF, #00D4FF);
}

/* Responsive Design for Sources System */
@media (max-width: 1200px) {
    .sources-chips-container {
        padding: 15px 19px;
        margin: 0 0 19px 0;
    }
    
    .source-chip {
        padding: 7px 15px;
    }
    
    .detailed-sources-container {
        width: 480px;
    }
}

@media (max-width: 1024px) {
    .sources-chips-container {
        padding: 14px 18px;
        margin: 0 0 18px 0;
    }
    
    .source-chip {
        padding: 7px 14px;
    }
    
    .source-chip-content {
        font-size: 13px;
    }
    
    .source-chip-domain {
        max-width: 100px;
    }
    
    .detailed-sources-container {
        width: 450px;
        top: 3%;
        bottom: 3%;
    }
}

@media (max-width: 767px) {
    .sources-chips-container {
        padding: 12px 16px;
        margin: 0 0 16px 0;
    }
    
    .sources-chips-bar {
        gap: 8px;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .sources-label {
        font-size: 13px;
        margin-right: 0;
        margin-bottom: 8px;
        width: 100%;
    }
    
    .source-chip {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .source-chip-number {
        width: 20px;
        height: 20px;
        font-size: 11px;
    }
    
    .source-chip-content {
        font-size: 12px;
        gap: 6px;
    }
    
    .source-chip-domain {
        max-width: 80px;
    }
    
    .detailed-sources-container {
        width: 95vw;
        top: 5vh;
        right: 2.5vw;
        bottom: 5vh;
        left: 2.5vw;
        max-width: none;
    }
    
    .detailed-sources-header-bar {
        padding: 16px 20px;
    }
    
    .detailed-sources-header-bar h2 {
        font-size: 18px;
    }
    
    .detailed-sources-content {
        padding: 16px 20px;
    }
}

@media (max-width: 480px) {
    .sources-chips-container {
        padding: 10px 12px;
        margin: 0 0 14px 0;
    }
    
    .sources-chips-bar {
        gap: 6px;
    }
    
    .sources-label {
        font-size: 12px;
        margin-bottom: 6px;
    }
    
    .source-chip {
        padding: 5px 10px;
        border-radius: 20px;
    }
    
    .source-chip-number {
        width: 18px;
        height: 18px;
        font-size: 10px;
    }
    
    .source-chip-content {
        font-size: 11px;
        gap: 4px;
    }
    
    .source-chip-domain {
        max-width: 60px;
        font-size: 10px;
    }
    
    .detailed-sources-container {
        top: 2vh;
        bottom: 2vh;
        border-radius: 16px;
    }
    
    .detailed-sources-header-bar {
        padding: 14px 16px;
        border-radius: 16px 16px 0 0;
    }
    
    .detailed-sources-header-bar h2 {
        font-size: 16px;
        gap: 8px;
    }
    
    .detailed-sources-content {
        padding: 14px 16px;
    }
    
    .detailed-source-card {
        padding: 12px;
        margin-bottom: 12px;
    }
    
    .detailed-source-header {
        margin-bottom: 10px;
        padding-bottom: 10px;
    }
    
    .detailed-source-number {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
}

/* ============================================
   Custom Color Variables for Different Source Types
   ============================================ */

.source-chip[style*="--source-color: #3b82f6"],
.detailed-source-card[style*="--source-color: #3b82f6"] {
    --source-color-rgb: 59, 130, 246;
}

.source-chip[style*="--source-color: #8b5cf6"],
.detailed-source-card[style*="--source-color: #8b5cf6"] {
    --source-color-rgb: 139, 92, 246;
}

.source-chip[style*="--source-color: #f59e0b"],
.detailed-source-card[style*="--source-color: #f59e0b"] {
    --source-color-rgb: 245, 158, 11;
}

.source-chip[style*="--source-color: #10b981"],
.detailed-source-card[style*="--source-color: #10b981"] {
    --source-color-rgb: 16, 185, 129;
}

.source-chip[style*="--source-color: #00D4FF"],
.detailed-source-card[style*="--source-color: #00D4FF"] {
    --source-color-rgb: 0, 212, 255;
}

.source-chip[style*="--source-color: #ef4444"],
.detailed-source-card[style*="--source-color: #ef4444"] {
    --source-color-rgb: 239, 68, 68;
}

.source-chip[style*="--source-color: #7B2FFF"],
.detailed-source-card[style*="--source-color: #7B2FFF"] {
    --source-color-rgb: 123, 47, 255;
}

/* ============================================
   Accessibility and Focus Management
   ============================================ */

.source-chip:focus {
    outline: 2px solid var(--source-color, #00D4FF);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(var(--source-color-rgb, 0, 212, 255), 0.2);
}

.detailed-sources-panel:focus-within {
    outline: none;
}

.detailed-sources-close:focus {
    outline: 2px solid #00D4FF;
    outline-offset: 2px;
}

.detailed-source-button:focus {
    outline: 2px solid var(--source-color, #00D4FF);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .sources-chips-container {
        border: 2px solid #00D4FF;
        background: rgba(0, 212, 255, 0.1);
    }
    
    .source-chip {
        border: 2px solid var(--source-color, #00D4FF);
        background: rgba(var(--source-color-rgb, 0, 212, 255), 0.2);
    }
    
    .detailed-sources-panel {
        background: rgba(0, 0, 0, 0.9);
    }
    
    .detailed-sources-container {
        border: 2px solid #00D4FF;
        background: rgba(6, 25, 47, 1);
    }
}

/* Reduced motion support - higher specificity for accessibility */
@media (prefers-reduced-motion: reduce) {
    html body .source-chip,
    html body .detailed-sources-container,
    html body .detailed-sources-panel,
    html body .source-chip::before {
        transition: none;
        animation: none;
        transform: none;
    }

    html body .source-chip:hover {
        transform: none;
    }
}

/* Print styles - higher specificity to ensure hidden when printing */
@media print {
    html body .sources-chips-container,
    html body .detailed-sources-panel {
        display: none;
    }
}

/* ============================================
   End Modern Sources Display System
   ============================================ */

/* ============================================
   Enhanced Typography & Content Formatting
   ============================================ 
   
   NOTE: Chat message styles (.assistant-message, .user-message) removed
   from shared-ui.css to prevent conflicts with features/chat/chat.css
   premium design. Only content formatting within messages remains.
   ============================================ */

/* Import premium fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* Base typography improvements - ONLY for content within messages */
.message-text, .message-bubble .message-text {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-feature-settings: 'liga' 1, 'kern' 1, 'calt' 1;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.7;
    letter-spacing: 0.01em;
}

/* Enhanced headings WITHIN message bubbles */
.message-text h1, .message-text h2, .message-text h3, .message-text h4,
.message-bubble h1, .message-bubble h2, .message-bubble h3, .message-bubble h4 {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    line-height: 1.3;
    margin: 1.5em 0 0.75em 0;
    letter-spacing: -0.02em;
}

.message-text h1, .message-bubble h1 { font-size: 2.25rem; font-weight: 800; margin-top: 0; }
.message-text h2, .message-bubble h2 { font-size: 1.875rem; font-weight: 700; }
.message-text h3, .message-bubble h3 { font-size: 1.5rem; font-weight: 600; }
.message-text h4, .message-bubble h4 { font-size: 1.25rem; font-weight: 600; }

/* Enhanced paragraph styling WITHIN messages */
.message-text p, .message-bubble p {
    margin: 0 0 1.25em 0;
    font-size: 1rem;
    line-height: 1.75;
    text-align: left;
}

.message-text p:last-child, .message-bubble p:last-child {
    margin-bottom: 0;
}

/* Enhanced list styling WITHIN messages */
.message-text ul, .message-text ol, .message-bubble ul, .message-bubble ol {
    margin: 1em 0 1.5em 0;
    padding-left: 1.5em;
}

.message-text li, .message-bubble li {
    margin: 0.5em 0;
    line-height: 1.6;
}

/* Custom bullet points for unordered lists */
.message-text ul li::marker, .message-bubble ul li::marker {
    color: rgba(0, 212, 255, 0.8);
}

/* Enhanced code styling WITHIN messages */
.message-text code, .message-bubble code {
    font-family: 'JetBrains Mono', 'Fira Code', Consolas, Monaco, 'Courier New', monospace;
    font-size: 0.9em;
    font-weight: 500;
    background: rgba(0, 0, 0, 0.4);
    color: #00E5FF;
    padding: 0.2em 0.5em;
    border-radius: 6px;
    border: 1px solid rgba(0, 212, 255, 0.2);
}

.message-text pre, .message-bubble pre {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 12px;
    padding: 1em;
    margin: 1em 0;
    overflow-x: auto;
}

.message-text pre code, .message-bubble pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.875rem;
}

/* Enhanced table styling WITHIN messages */
.message-text table, .message-bubble table {
    width: 100%;
    margin: 1em 0;
    border-collapse: collapse;
}

.message-text th, .message-bubble th {
    background: rgba(0, 212, 255, 0.2);
    padding: 0.75em 1em;
    text-align: left;
    font-weight: 600;
}

.message-text td, .message-bubble td {
    padding: 0.75em 1em;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Enhanced markdown and content formatting - Removed container-level overrides */
/* Typography only applies to content inside messages, not message containers */

/* Enhanced link styling WITHIN messages */
.message-text a, .message-bubble a {
    color: #00E5FF;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.message-text a:hover, .message-bubble a:hover {
    color: #ffffff;
    text-shadow: 0 0 8px rgba(0, 229, 255, 0.4);
}

/* Enhanced emphasis styling WITHIN messages */
.message-text strong, .message-text b, .message-bubble strong, .message-bubble b {
    font-weight: 700;
}

.message-text em, .message-text i, .message-bubble em, .message-bubble i {
    font-style: italic;
}

/* Removed all .message, .assistant-message, .system-message container-level styles */
/* These were conflicting with premium chat.css bubble designs */
/* Only content-level typography remains above */

/* Responsive typography adjustments */
@media (max-width: 767px) {
    .message-text, .message-bubble {
        font-size: 0.95rem;
    }
    
    .message-text h1, .message-bubble h1 { font-size: 1.875rem; }
    .message-text h2, .message-bubble h2 { font-size: 1.5rem; }
    .message-text h3, .message-bubble h3 { font-size: 1.25rem; }
}

@media (max-width: 480px) {
    .message-text, .message-bubble {
        font-size: 0.9rem;
        line-height: 1.6;
    }
    
    .message-text h1, .message-bubble h1 { font-size: 1.5rem; }
    .message-text h2, .message-bubble h2 { font-size: 1.25rem; }
}

/* REMOVED: All container-level styles for .message, .assistant-message, .system-message,
   .user-message, .message-content that were overriding chat.css premium bubbles.
   Only typography for content INSIDE bubbles remains. */

/* ============================================
   End Enhanced Typography & Content Formatting
   ============================================ */ 
        rgba(0, 212, 255, 0.1) 0%, 
        rgba(123, 47, 255, 0.1) 100%);
    padding: 0.1em 0.3em;
    border-radius: 4px;
}

.message-content em,
.message-content i {
    font-style: italic;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

/* ============================================
   End Enhanced Typography & Content Formatting
   ============================================ */

/* ============================================
   Citations Sidebar Layout - Floating Independent
   ============================================ */

.citations-sidebar {
    position: fixed;
    top: 120px;
    right: 0;
    bottom: 120px;
    width: 400px;
    min-width: 350px;
    max-width: 500px;
    background: linear-gradient(135deg, 
        rgba(6, 25, 47, 0.95) 0%,
        rgba(10, 25, 47, 0.98) 100%);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 16px 0 0 16px;
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: var(--z-modal, 1050);
    transform: translateX(100%);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
}

.citations-sidebar.open {
    transform: translateX(0);
}

.citations-sidebar.collapsed {
    width: 60px;
    min-width: 60px;
}

.citations-sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 212, 255, 0.05);
    position: relative;
    overflow: hidden;
}

.citations-sidebar-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(0, 212, 255, 0.5), 
        transparent);
}

.citations-title {
    color: #ffffff;
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.citations-title i {
    color: #00D4FF;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

.citations-sidebar.collapsed .citations-title {
    opacity: 0;
    transform: scale(0.8);
}

.citations-toggle {
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 8px;
    color: #00D4FF;
    padding: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.citations-toggle:hover {
    background: rgba(0, 212, 255, 0.2);
    transform: scale(1.1);
}

.citations-sidebar.collapsed .citations-toggle i {
    transform: rotate(180deg);
}

.citations-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
}

.citations-sidebar.collapsed .citations-content {
    opacity: 0;
    pointer-events: none;
}

.citations-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
}

.citations-empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.citations-empty-state p {
    font-size: 16px;
    margin: 0;
}

/* Citations Sidebar Cards */
.citations-sidebar .link-preview-container-v2 {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    padding: 0;
    max-height: none;
    overflow: visible;
}

.citations-sidebar .modern-link-preview-card-v2 {
    min-height: 80px;
    max-height: 120px;
    margin-bottom: 8px;
    transform: scale(0.95);
    opacity: 0;
    animation: slideInFromRight 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    overflow: hidden;
}

.citations-sidebar .modern-link-preview-card-v2:nth-child(1) { animation-delay: 0.1s; }
.citations-sidebar .modern-link-preview-card-v2:nth-child(2) { animation-delay: 0.2s; }
.citations-sidebar .modern-link-preview-card-v2:nth-child(3) { animation-delay: 0.3s; }
.citations-sidebar .modern-link-preview-card-v2:nth-child(4) { animation-delay: 0.4s; }
.citations-sidebar .modern-link-preview-card-v2:nth-child(5) { animation-delay: 0.5s; }
.citations-sidebar .modern-link-preview-card-v2:nth-child(6) { animation-delay: 0.6s; }

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

/* Compact card layout for sidebar */
.citations-sidebar .link-preview-content {
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    height: 100%;
    justify-content: space-between;
}

.citations-sidebar .link-preview-source-badge {
    padding: 2px 6px;
    font-size: 8px;
    border-radius: 8px;
}

.citations-sidebar .link-preview-header {
    margin-bottom: 4px;
}

.citations-sidebar .link-preview-body {
    flex: 1;
    min-height: 0;
}

.citations-sidebar .link-preview-title {
    font-size: 12px;
    line-height: 1.2;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    margin-bottom: 3px;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.citations-sidebar .link-preview-meta {
    gap: 4px;
    margin: 3px 0 0 0;
    display: flex;
    flex-wrap: wrap;
}

.citations-sidebar .link-preview-meta-item {
    font-size: 9px;
    opacity: 0.8;
}

.citations-sidebar .link-preview-footer {
    padding-top: 4px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.citations-sidebar .link-preview-button {
    padding: 3px 6px;
    font-size: 9px;
    border-radius: 6px;
}

.citations-sidebar .link-preview-stats {
    font-size: 8px;
    opacity: 0.7;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .citations-sidebar {
        width: 350px;
        min-width: 320px;
        right: 0;
    }
}

@media (max-width: 767px) {
    .citations-sidebar {
        width: 90%;
        right: 5%;
        top: 100px;
        bottom: 100px;
        border: 1px solid rgba(0, 212, 255, 0.2);
        border-radius: 12px;
    }
    
    .citations-sidebar-header {
        padding: 16px;
    }
    
    .citations-content {
        padding: 16px;
    }
}

/* Ensure main content doesn't get covered */
.main-content,
.chat-container,
main {
    transition: margin-right 0.3s ease;
}

.citations-sidebar.open ~ .main-content,
.citations-sidebar.open ~ .chat-container,
body:has(.citations-sidebar.open) .main-content,
body:has(.citations-sidebar.open) .chat-container {
    margin-right: 400px;
}

@media (max-width: 1200px) {
    .citations-sidebar.open ~ .main-content,
    .citations-sidebar.open ~ .chat-container,
    body:has(.citations-sidebar.open) .main-content,
    body:has(.citations-sidebar.open) .chat-container {
        margin-right: 0;
    }
}

/* Custom Scrollbar for Citations */
.citations-content::-webkit-scrollbar {
    width: 6px;
}

.citations-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.citations-content::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #00D4FF, #7B2FFF);
    border-radius: 10px;
    transition: background 0.3s ease;
}

.citations-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #7B2FFF, #00D4FF);
}
/* ============================================================================
   WORKSPACE TOAST NOTIFICATIONS
   ============================================================================ */

.workspace-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: var(--z-toast, 1300);
    animation: slideInRight 0.3s ease;
    font-size: 14px;
    max-width: 350px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: opacity 0.3s ease, transform 0.3s ease;
    color: white;
}

.workspace-toast-success {
    background: linear-gradient(135deg, #22c55e, #16a34a);
}

.workspace-toast-error {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.workspace-toast-info {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

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

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

/* ============================================================
   Connection Recovery Overlay
   ============================================================ */

.connection-recovery-overlay {
    margin: 12px 0;
    animation: crFadeIn 0.35s ease-out;
}

.cr-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px 20px 20px;
    border-radius: 16px;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid rgba(99, 102, 241, 0.25);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
    text-align: center;
}

/* Subtle shimmer sweep */
.cr-inner::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.08), transparent);
    animation: crShimmer 2.5s ease-in-out infinite;
    pointer-events: none;
}

/* ---- Icon area: overlapping WiFi + countdown ring ---- */
.cr-icon-wrap {
    position: relative;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}

.cr-wifi-icon {
    position: absolute;
    color: #818cf8;
    animation: crPulse 1.8s ease-in-out infinite;
    z-index: 2;
}

/* Sequentially fading Wi-Fi waves */
.cr-wave-1 { animation: crWaveFade 1.6s ease-in-out infinite 0s; }
.cr-wave-2 { animation: crWaveFade 1.6s ease-in-out infinite 0.2s; }
.cr-wave-3 { animation: crWaveFade 1.6s ease-in-out infinite 0.4s; }

.cr-countdown-ring {
    position: absolute;
    color: #6366f1;
    z-index: 1;
}

.cr-ring-bg { opacity: 0.2; }

.cr-countdown-text {
    position: absolute;
    bottom: -2px;
    right: -2px;
    font-size: 11px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.5);
    z-index: 3;
    font-variant-numeric: tabular-nums;
}

/* ---- Text ---- */
.cr-message {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #e2e8f0;
    letter-spacing: 0.01em;
}

.cr-sub {
    margin: 0;
    font-size: 13px;
    color: #94a3b8;
    line-height: 1.4;
    max-width: 280px;
}

/* ---- Attempt dots ---- */
.cr-dots {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}

.cr-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.cr-dot--done {
    background: #6366f1;
    opacity: 0.5;
}

.cr-dot--active {
    background: #818cf8;
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.6);
    animation: crDotPulse 1s ease-in-out infinite;
}

.cr-dot--pending {
    background: rgba(255, 255, 255, 0.15);
}

/* ---- Error state ---- */
.cr-error .cr-inner {
    border-color: rgba(239, 68, 68, 0.3);
    background: linear-gradient(135deg, #1e1b2e 0%, #1a0f0f 100%);
}

.cr-error .cr-inner::before {
    display: none;
}

.cr-icon-error {
    width: 48px;
    height: 48px;
}

.cr-error-icon {
    color: #f87171;
    animation: crShake 0.5s ease-in-out;
}

.cr-error .cr-message {
    color: #fca5a5;
}

.cr-retry-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 10px 24px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 2px 12px rgba(99, 102, 241, 0.35);
}

.cr-retry-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.5);
}

.cr-retry-btn:active {
    transform: translateY(0);
}

.cr-retry-btn svg {
    flex-shrink: 0;
}

/* ---- Animations ---- */
@keyframes crFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes crShimmer {
    0%, 100% { transform: translateX(-100%); }
    50%      { transform: translateX(100%); }
}

@keyframes crPulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.5; }
}

@keyframes crWaveFade {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.25; }
}

@keyframes crDotPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%      { transform: scale(1.35); opacity: 0.7; }
}

@keyframes crShake {
    0%, 100% { transform: translateX(0); }
    20%      { transform: translateX(-4px); }
    40%      { transform: translateX(4px); }
    60%      { transform: translateX(-3px); }
    80%      { transform: translateX(2px); }
}

/* ---- Mobile ---- */
@media (max-width: 768px) {
    .cr-inner {
        padding: 18px 16px 16px;
    }
    .cr-message { font-size: 14px; }
    .cr-sub { font-size: 12px; }
}