/* Modern Zoxalaw Styles - Complete Version with Layout Fixes */
:root {
    /* Color Palette */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #06b6d4;
    --accent: #f59e0b;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    
    /* Background Colors */
    --bg-primary: #0f0f23;
    --bg-secondary: #1a1b3a;
    --bg-tertiary: #2d2d54;
    --bg-glass: rgba(255, 255, 255, 0.05);
    --bg-card: rgba(255, 255, 255, 0.08);
    
    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: #a5a5f0;
    --text-muted: #6b7280;
    
    /* Border Colors */
    --border: rgba(255, 255, 255, 0.1);
    --border-hover: rgba(255, 255, 255, 0.2);
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.3);
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

/* Animated Background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 20%, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(6, 182, 212, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 60%, rgba(245, 158, 11, 0.05) 0%, transparent 50%);
    z-index: -2;
}

/* Animated Mesh Gradient */
.bg-mesh {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(45deg, transparent 30%, rgba(99, 102, 241, 0.03) 50%, transparent 70%),
        linear-gradient(-45deg, transparent 30%, rgba(6, 182, 212, 0.03) 50%, transparent 70%);
    background-size: 100px 100px;
    animation: meshMove 20s ease-in-out infinite;
    z-index: -1;
}

@keyframes meshMove {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(10px, -10px) rotate(1deg); }
    50% { transform: translate(-5px, 5px) rotate(-1deg); }
    75% { transform: translate(-10px, -5px) rotate(0.5deg); }
}

/* Container - ИСПРАВЛЕНО */
.container {
    max-width: 1000px; /* ИЗМЕНЕНО: было 1400px */
    margin: 0 auto;
    padding: 1.5rem; /* ИЗМЕНЕНО: было 2rem */
    position: relative;
    z-index: 1;
}

/* Header Styles - ИСПРАВЛЕНО */
.header {
    text-align: center;
    margin-bottom: 2rem; /* ИЗМЕНЕНО: было 3rem */
    position: relative;
}

.hero-section {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 2.5rem 2rem; /* ИЗМЕНЕНО: было 4rem 3rem */
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem; /* ИЗМЕНЕНО: было 2rem */
    animation: slideDown 0.8s ease-out;
}

.logo-icon {
    width: 60px; /* ИЗМЕНЕНО: было 80px */
    height: 60px; /* ИЗМЕНЕНО: было 80px */
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-glow);
    position: relative;
    overflow: hidden;
    animation: float 3s ease-in-out infinite;
}

.logo-icon::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: shine 3s infinite;
}

@keyframes shine {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

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

.logo-icon i {
    font-size: 2rem; /* ИЗМЕНЕНО: было 2.5rem */
    color: white;
    z-index: 2;
}

.brand-name {
    font-size: 3rem; /* ИЗМЕНЕНО: было 4rem */
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    letter-spacing: -0.02em;
    position: relative;
    background-size: 200% 200%;
    animation: gradient-shift 3s ease infinite;
}

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

.subtitle {
    font-size: 1.2rem; /* ИЗМЕНЕНО: было 1.5rem */
    color: var(--text-secondary);
    font-weight: 400;
    margin-bottom: 1.5rem; /* ИЗМЕНЕНО: было 2rem */
    animation: fadeIn 0.8s ease-out 0.2s both;
}

.hero-features {
    display: flex;
    justify-content: center;
    gap: 1.5rem; /* ИЗМЕНЕНО: было 2rem */
    flex-wrap: wrap;
    animation: fadeIn 0.8s ease-out 0.4s both;
}

.hero-feature {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem; /* ИЗМЕНЕНО: было 0.75rem 1.5rem */
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    font-size: 0.85rem; /* ИЗМЕНЕНО: было 0.9rem */
    color: var(--text-secondary);
    transition: var(--transition);
    cursor: pointer;
}

.hero-feature:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.hero-feature:hover i {
    transform: scale(1.2) rotate(5deg);
}

.hero-feature i {
    color: var(--primary);
    transition: transform 0.3s ease;
}

/* Chat Interface - ИСПРАВЛЕНО */
.chat-interface {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem; /* ИЗМЕНЕНО: было 2rem */
    margin-bottom: 2rem; /* ИЗМЕНЕНО: было 3rem */
}

.chat-container {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.3),
        0 1px 8px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    animation: slideUp 0.8s ease-out 0.6s both;
}

.chat-header {
    padding: 1.2rem 1.5rem; /* ИЗМЕНЕНО: было 1.5rem 2rem */
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.status-indicator {
    width: 12px;
    height: 12px;
    background: radial-gradient(circle, var(--success), #059669);
    border-radius: 50%;
    position: relative;
    box-shadow: 
        0 0 0 0 var(--success),
        0 0 10px var(--success);
    animation: status-pulse 2s infinite;
}

.status-indicator::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border: 2px solid var(--success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.5); opacity: 0; }
}

@keyframes status-pulse {
    0% {
        box-shadow: 
            0 0 0 0 var(--success),
            0 0 10px var(--success);
    }
    70% {
        box-shadow: 
            0 0 0 8px rgba(16, 185, 129, 0),
            0 0 10px var(--success);
    }
    100% {
        box-shadow: 
            0 0 0 0 rgba(16, 185, 129, 0),
            0 0 10px var(--success);
    }
}

.chat-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn:hover {
    background: var(--primary);
    color: white;
    transform: scale(1.1);
}

.chat-messages {
    height: 400px; /* ИЗМЕНЕНО: было 500px */
    overflow-y: auto;
    padding: 1.5rem; /* ИЗМЕНЕНО: было 2rem */
    scroll-behavior: smooth;
    position: relative;
}

.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(45deg, var(--primary-dark), var(--secondary));
}

.message-wrapper {
    margin-bottom: 1.5rem; /* ИЗМЕНЕНО: было 2rem */
    animation: messageSlideIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes messageSlideIn {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
        filter: blur(5px);
    }
    50% {
        opacity: 0.7;
        transform: translateY(10px) scale(0.95);
        filter: blur(2px);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

.message {
    max-width: 85%;
    padding: 1rem 1.2rem; /* ИЗМЕНЕНО: было 1.25rem 1.5rem */
    border-radius: var(--radius-lg);
    position: relative;
    word-wrap: break-word;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.message:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.message-wrapper.user {
    display: flex;
    justify-content: flex-end;
}

.message-wrapper.user .message {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-bottom-right-radius: var(--radius-sm);
}

.message-wrapper.assistant {
    display: flex;
    justify-content: flex-start;
}

.message-wrapper.assistant .message {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-bottom-left-radius: var(--radius-sm);
}

.message-wrapper.system {
    display: flex;
    justify-content: center;
}

.message-wrapper.system .message {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    text-align: center;
    max-width: 95%;
    border-radius: var(--radius-xl);
}

.message h2 {
    font-size: 1.3rem; /* ИЗМЕНЕНО: было 1.5rem */
    font-weight: 700;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    background-size: 200% 200%;
    animation: gradient-shift 3s ease infinite;
}

.timestamp {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    opacity: 0.7;
}

/* Input Area - ИСПРАВЛЕНО */
.input-area {
    padding: 1.5rem; /* ИЗМЕНЕНО: было 2rem */
    border-top: 1px solid var(--border);
    background: var(--bg-card);
    position: relative;
}

.input-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.input-wrapper {
    position: relative;
    background: var(--bg-tertiary);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    transition: var(--transition);
    overflow: hidden;
}

.input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
    background: var(--bg-tertiary);
}

.input-wrapper:focus-within::before {
    content: '';
    position: absolute;
    inset: 0;
    padding: 2px;
    background: linear-gradient(45deg, var(--primary), var(--secondary), var(--accent));
    border-radius: inherit;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    -webkit-mask-composite: xor;
}

.message-input {
    width: 100%;
    background: transparent;
    border: none;
    padding: 1rem 1.2rem; /* ИЗМЕНЕНО: было 1.25rem 1.5rem */
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    resize: none;
    min-height: 50px; /* ИЗМЕНЕНО: было 60px */
    max-height: 150px;
    outline: none;
}

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

.input-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.btn {
    padding: 0.75rem 1.5rem; /* ИЗМЕНЕНО: было 0.875rem 2rem */
    border: none;
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: 0.9rem; /* ИЗМЕНЕНО: было 0.95rem */
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: var(--shadow-sm);
    flex: 1;
    position: relative;
    overflow: hidden;
}

.btn-primary::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover::after {
    left: 100%;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 50px;
    position: relative;
    overflow: hidden;
}

.btn-secondary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transition: width 0.3s ease, height 0.3s ease;
    transform: translate(-50%, -50%);
}

.btn-secondary:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-2px);
}

.btn-secondary:hover::before {
    width: 100%;
    height: 100%;
}

/* Добавьте эти стили в конец вашего static/css/styles.css файла */

/* ИСПРАВЛЕНИЯ ДЛЯ АУДИО СООБЩЕНИЙ */

/* Аудио сообщение контейнер */
.audio-message {
    padding: 1rem;
    max-width: 280px;
    min-width: 250px;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* Пользовательские аудио сообщения */
.message-wrapper.user .audio-message {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark)) !important;
    border-radius: var(--radius-lg) !important;
    border-bottom-right-radius: var(--radius-sm) !important;
    color: white;
}

/* Аудио сообщения ассистента */
.message-wrapper.assistant .audio-message {
    background: var(--bg-card) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-lg) !important;
    border-bottom-left-radius: var(--radius-sm) !important;
    color: var(--text-primary);
}

/* Аудио плеер */
.audio-player {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 40px;
    width: 100%;
    position: relative;
}

/* Кнопка воспроизведения */
.audio-play-button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.3s ease;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Кнопка для пользовательских сообщений */
.message-wrapper.user .audio-play-button {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.message-wrapper.user .audio-play-button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* Кнопка для сообщений ассистента */
.message-wrapper.assistant .audio-play-button {
    background: var(--primary);
    color: white;
}

.message-wrapper.assistant .audio-play-button:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

/* Длительность аудио */
.audio-duration {
    font-size: 0.8rem;
    font-family: 'JetBrains Mono', monospace;
    margin-left: auto;
    flex-shrink: 0;
    min-width: 35px;
    text-align: right;
}

/* Длительность для пользовательских сообщений */
.message-wrapper.user .audio-duration {
    color: rgba(255, 255, 255, 0.8);
}

/* Длительность для сообщений ассистента */
.message-wrapper.assistant .audio-duration {
    color: var(--text-secondary);
}

/* Волновая форма */
.audio-waveform {
    flex-grow: 1;
    height: 24px;
    display: flex;
    align-items: center;
    gap: 2px;
    position: relative;
    min-width: 100px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 4px 8px;
    overflow: hidden;
}

/* Волновая форма для пользовательских сообщений */
.message-wrapper.user .audio-waveform {
    background: rgba(255, 255, 255, 0.15);
}

/* Волновая форма для сообщений ассистента */
.message-wrapper.assistant .audio-waveform {
    background: var(--bg-tertiary);
}

/* Полоски волновой формы */
.waveform-bar {
    width: 3px;
    background: currentColor;
    border-radius: 2px;
    opacity: 0.6;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

/* Полоски для пользовательских сообщений */
.message-wrapper.user .waveform-bar {
    background: rgba(255, 255, 255, 0.7);
}

/* Полоски для сообщений ассистента */
.message-wrapper.assistant .waveform-bar {
    background: var(--primary);
}

/* Анимация воспроизведения */
.audio-waveform.playing .waveform-bar {
    animation: waveform-pulse 1.5s ease-in-out infinite;
}

.audio-waveform.playing .waveform-bar:nth-child(odd) {
    animation-delay: 0.1s;
}

.audio-waveform.playing .waveform-bar:nth-child(even) {
    animation-delay: 0.3s;
}

@keyframes waveform-pulse {
    0%, 100% { 
        height: 4px; 
        opacity: 0.6; 
    }
    50% { 
        height: 16px; 
        opacity: 1; 
    }
}

/* Прогресс воспроизведения */
.audio-waveform::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: var(--progress, 0%);
    background: linear-gradient(90deg, 
        rgba(255, 255, 255, 0.3), 
        rgba(255, 255, 255, 0.1)
    );
    border-radius: inherit;
    transition: width 0.1s linear;
    z-index: 1;
}

.message-wrapper.assistant .audio-waveform::before {
    background: linear-gradient(90deg, 
        rgba(99, 102, 241, 0.3), 
        rgba(99, 102, 241, 0.1)
    );
}

/* Лейбл аудио (если используется) */
.audio-label {
    font-size: 0.8rem;
    opacity: 0.8;
    flex-grow: 1;
    text-align: center;
}

/* Транскрипция аудио */
.audio-transcription {
    margin-top: 8px;
    font-size: 0.8rem;
    font-style: italic;
    opacity: 0.8;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    line-height: 1.4;
    display: none;
}

.message-wrapper.user .audio-transcription {
    color: rgba(255, 255, 255, 0.9);
    border-top-color: rgba(255, 255, 255, 0.2);
}

.message-wrapper.assistant .audio-transcription {
    color: var(--text-secondary);
    border-top-color: var(--border);
}

/* Показать транскрипцию при наличии */
.audio-transcription:not(:empty) {
    display: block;
    animation: fadeIn 0.5s ease-out;
}

/* Скрытый audio элемент */
audio {
    display: none;
}

/* Состояние ошибки */
.audio-player.error .audio-play-button {
    opacity: 0.5;
    cursor: not-allowed;
}

.audio-player.error .audio-duration {
    opacity: 0.5;
}

/* Состояние загрузки */
.audio-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
}

.audio-loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    opacity: 0.7;
}

/* Адаптивность для аудио */
@media (max-width: 480px) {
    .audio-message {
        max-width: 220px;
        min-width: 200px;
        padding: 0.8rem;
    }
    
    .audio-player {
        height: 36px;
        gap: 8px;
    }
    
    .audio-play-button {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
    
    .audio-waveform {
        height: 20px;
        padding: 2px 6px;
        min-width: 80px;
    }
    
    .waveform-bar {
        width: 2px;
    }
    
    .audio-duration {
        font-size: 0.75rem;
        min-width: 30px;
    }
    
    .audio-transcription {
        font-size: 0.75rem;
        margin-top: 6px;
        padding-top: 6px;
    }
}

/* Исправление для простых аудио сообщений (если используется addSimpleAudioMessage) */
.audio-message .audio-label {
    font-size: 0.8rem;
    color: inherit;
    opacity: 0.9;
}

.message-wrapper.user .audio-label {
    color: rgba(255, 255, 255, 0.9);
}

.message-wrapper.assistant .audio-label {
    color: var(--text-secondary);
}
/* Audio Recording */
.audio-recorder {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    padding: 1.2rem 1.5rem; /* ИЗМЕНЕНО: было 1.5rem 2rem */
    display: none;
    animation: slideUp 0.3s ease-out;
}

.audio-recorder.active {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.recording-status {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.recording-pulse {
    width: 14px; /* ИЗМЕНЕНО: было 16px */
    height: 14px; /* ИЗМЕНЕНО: было 16px */
    background: var(--error);
    border-radius: 50%;
    position: relative;
    box-shadow: 0 0 10px var(--error);
}

.recording-pulse.active::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border: 2px solid var(--error);
    border-radius: 50%;
    animation: pulse 1s infinite;
}

.recording-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.recording-text {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.9rem; /* ДОБАВЛЕНО */
}

.recording-timer {
    color: var(--error);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem; /* ИЗМЕНЕНО: было 0.9rem */
}

.audio-controls {
    display: flex;
    gap: 0.75rem; /* ИЗМЕНЕНО: было 1rem */
}

.audio-btn {
    width: 42px; /* ИЗМЕНЕНО: было 48px */
    height: 42px; /* ИЗМЕНЕНО: было 48px */
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.audio-btn:hover {
    transform: scale(1.1);
}

.audio-btn.record {
    background: linear-gradient(135deg, var(--error), #dc2626);
    color: white;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
}

.audio-btn.stop {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.audio-btn.send {
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.audio-btn.cancel {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

/* Features Section - ИСПРАВЛЕНО */
.features-section {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 2rem; /* ИЗМЕНЕНО: было 3rem */
    margin-bottom: 2rem; /* ИЗМЕНЕНО: было 3rem */
    animation: fadeIn 1s ease-out 0.8s both;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.3),
        0 1px 8px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.section-title {
    font-size: 2rem; /* ИЗМЕНЕНО: было 2.5rem */
    font-weight: 700;
    text-align: center;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.section-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1rem; /* ИЗМЕНЕНО: было 1.1rem */
    margin-bottom: 2rem; /* ИЗМЕНЕНО: было 3rem */
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); /* ИЗМЕНЕНО: было 350px */
    gap: 1.5rem; /* ИЗМЕНЕНО: было 2rem */
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem; /* ИЗМЕНЕНО: было 2rem */
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transform-style: preserve-3d;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--secondary), var(--accent));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.5s ease;
}

.feature-card:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-hover);
    transform: perspective(1000px) rotateX(5deg) rotateY(5deg) scale3d(1.02, 1.02, 1.02);
    box-shadow: var(--shadow-lg);
}

.feature-card:hover::before {
    transform: scaleX(1);
}

.feature-card:hover .feature-icon i {
    transform: scale(1.2) rotate(5deg);
}

.feature-icon {
    width: 50px; /* ИЗМЕНЕНО: было 60px */
    height: 50px; /* ИЗМЕНЕНО: было 60px */
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.2rem; /* ИЗМЕНЕНО: было 1.5rem */
    box-shadow: var(--shadow-glow);
}

.feature-icon i {
    font-size: 1.2rem; /* ИЗМЕНЕНО: было 1.5rem */
    color: white;
    transition: transform 0.3s ease;
}

.feature-title {
    font-size: 1.1rem; /* ИЗМЕНЕНО: было 1.25rem */
    font-weight: 600;
    margin-bottom: 0.8rem; /* ИЗМЕНЕНО: было 1rem */
    color: var(--text-primary);
}

.feature-desc {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 0.9rem; /* ДОБАВЛЕНО */
}

/* Legal Areas - ИСПРАВЛЕНО */
.legal-areas {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 2rem; /* ИЗМЕНЕНО: было 3rem */
    margin-bottom: 2rem; /* ИЗМЕНЕНО: было 3rem */
    animation: fadeIn 1s ease-out 1s both;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.3),
        0 1px 8px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.legal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); /* ИЗМЕНЕНО: было 300px */
    gap: 1rem; /* ИЗМЕНЕНО: было 1.5rem */
}

.legal-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.2rem; /* ИЗМЕНЕНО: было 1.5rem */
    transition: var(--transition);
    cursor: pointer;
    transform-style: preserve-3d;
}

.legal-item:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary);
    transform: perspective(1000px) rotateX(5deg) rotateY(5deg) scale3d(1.02, 1.02, 1.02);
}

.legal-item:hover .legal-title i {
    transform: scale(1.2) rotate(5deg);
}

.legal-title {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem; /* ДОБАВЛЕНО */
}

.legal-title i {
    transition: transform 0.3s ease;
}

.legal-desc {
    color: var(--text-secondary);
    font-size: 0.85rem; /* ИЗМЕНЕНО: было 0.9rem */
    line-height: 1.5;
}

/* Disclaimer - ИСПРАВЛЕНО */
.disclaimer {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(239, 68, 68, 0.1));
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-lg);
    padding: 1.5rem; /* ИЗМЕНЕНО: было 2rem */
    margin-top: 1.5rem; /* ИЗМЕНЕНО: было 2rem */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.disclaimer h4 {
    color: var(--warning);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem; /* ДОБАВЛЕНО */
}

.disclaimer p {
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    font-size: 0.9rem; /* ДОБАВЛЕНО */
}

/* Footer - ИСПРАВЛЕНО */
.footer {
    text-align: center;
    padding: 1.5rem; /* ИЗМЕНЕНО: было 2rem */
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    margin-top: 2rem; /* ИЗМЕНЕНО: было 3rem */
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem; /* ИЗМЕНЕНО: было 2rem */
    margin-bottom: 1rem;
}

.footer-link {
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    font-size: 0.9rem; /* ДОБАВЛЕНО */
}

.footer-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transition: width 0.3s ease;
}

.footer-link:hover {
    color: var(--primary);
}

.footer-link:hover::after {
    width: 100%;
}

.social-icons {
    display: flex;
    justify-content: center;
    gap: 0.75rem; /* ИЗМЕНЕНО: было 1rem */
    margin-top: 1rem;
}

.social-icon {
    width: 36px; /* ИЗМЕНЕНО: было 40px */
    height: 36px; /* ИЗМЕНЕНО: было 40px */
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-secondary);
    transition: var(--transition);
    cursor: pointer;
}

.social-icon:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-3px);
    box-shadow: var(--shadow-glow);
}

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

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    margin-bottom: 8px;
    animation: pulse 1.5s ease infinite;
}

.typing-dot {
    width: 8px;
    height: 8px;
    margin: 0 3px;
    background-color: var(--primary);
    border-radius: 50%;
    opacity: 0.7;
    animation: dot-bounce 1.4s ease-in-out infinite;
}

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

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

/* Loading States */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Copy Button */
.copy-button {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
    display: flex !important;
    gap: 5px;
    color: #7f8c8d;
    font-size: 0.8rem; /* ДОБАВЛЕНО */
}

.copy-button:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.copy-button svg {
    width: 14px; /* ИЗМЕНЕНО: было 16px */
    height: 14px; /* ИЗМЕНЕНО: было 16px */
}

.assistant-message {
    padding-top: 25px !important; /* ИЗМЕНЕНО: было 30px */
}

/* Scroll Button */
.scroll-button {
    position: fixed;
    bottom: 120px; /* ИЗМЕНЕНО: было 175px */
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px; /* ИЗМЕНЕНО: было больше */
    height: 40px; /* ИЗМЕНЕНО: было больше */
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    display: none;
    transition: background-color 0.3s ease;
    justify-content: center;
    align-items: center;
}

.scroll-button:hover {
    background-color: #18364d;
}

.scroll-button svg {
    width: 20px; /* ИЗМЕНЕНО: было 24px */
    height: 20px; /* ИЗМЕНЕНО: было 24px */
    fill: white;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* RESPONSIVE DESIGN - ЗНАЧИТЕЛЬНЫЕ УЛУЧШЕНИЯ */

/* Tablets */
@media (max-width: 1024px) {
    .container {
        padding: 1.2rem;
        max-width: 100%;
    }
    
    .hero-section {
        padding: 2rem 1.5rem;
    }
    
    .brand-name {
        font-size: 2.5rem;
    }
    
    .chat-messages {
        height: 350px;
    }
}

/* Mobile Devices */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .header {
        margin-bottom: 1.5rem;
    }
    
    .brand-name {
        font-size: 2.2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .hero-section {
        padding: 1.8rem 1.2rem;
        margin-bottom: 1rem;
    }
    
    .logo-icon {
        width: 50px;
        height: 50px;
    }
    
    .logo-icon i {
        font-size: 1.5rem;
    }
    
    .hero-features {
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }
    
    .hero-feature {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
        width: fit-content;
    }
    
    .chat-messages {
        height: 300px;
        padding: 1rem;
    }
    
    .message {
        padding: 0.9rem 1rem;
        max-width: 90%;
        font-size: 0.9rem;
    }
    
    .message h2 {
        font-size: 1.2rem;
    }
    
    .message-wrapper {
        margin-bottom: 1.2rem;
    }
    
    .input-area {
        padding: 1rem;
    }
    
    .message-input {
        padding: 0.9rem 1rem;
        min-height: 45px;
        font-size: 0.95rem;
    }
    
    .input-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    .features-section,
    .legal-areas {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
        gap: 1.2rem;
    }
    
    .legal-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .section-title {
        font-size: 1.8rem;
    }
    
    .section-subtitle {
        font-size: 0.95rem;
        margin-bottom: 1.5rem;
    }
    
    .feature-card {
        padding: 1.2rem;
    }
    
    .feature-icon {
        width: 45px;
        height: 45px;
    }
    
    .feature-icon i {
        font-size: 1.1rem;
    }
    
    .feature-title {
        font-size: 1rem;
    }
    
    .feature-desc {
        font-size: 0.85rem;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 1rem;
    }
    
    .footer-link {
        font-size: 0.85rem;
    }
    
    .social-icons {
        gap: 0.5rem;
    }
    
    .social-icon {
        width: 32px;
        height: 32px;
    }
    
    .chat-header {
        padding: 1rem;
    }
    
    .audio-recorder {
        padding: 1rem;
    }
    
    .audio-controls {
        gap: 0.5rem;
    }
    
    .audio-btn {
        width: 36px;
        height: 36px;
    }
    
    .recording-text {
        font-size: 0.8rem;
    }
    
    .recording-timer {
        font-size: 0.75rem;
    }
    
    .recording-pulse {
        width: 12px;
        height: 12px;
        margin-right: 8px;
    }
}

/* Small Mobile Devices */
@media (max-width: 480px) {
    .container {
        padding: 0.75rem;
    }
    
    .hero-section {
        padding: 1.5rem 1rem;
        margin-bottom: 0.75rem;
    }
    
    .brand-name {
        font-size: 1.8rem;
    }
    
    .subtitle {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }
    
    .logo-container {
        margin-bottom: 1rem;
    }
    
    .logo-icon {
        width: 45px;
        height: 45px;
    }
    
    .logo-icon i {
        font-size: 1.3rem;
    }
    
    .chat-messages {
        height: 250px;
        padding: 0.75rem;
    }
    
    .message {
        padding: 0.8rem;
        font-size: 0.85rem;
        max-width: 95%;
    }
    
    .message h2 {
        font-size: 1.1rem;
        margin-bottom: 0.75rem;
    }
    
    .message-wrapper {
        margin-bottom: 1rem;
    }
    
    .input-area {
        padding: 0.75rem;
    }
    
    .message-input {
        padding: 0.8rem;
        min-height: 40px;
        font-size: 0.9rem;
    }
    
    .btn {
        padding: 0.7rem;
        font-size: 0.85rem;
    }
    
    .features-section,
    .legal-areas {
        padding: 1.2rem;
        margin-bottom: 1rem;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .section-subtitle {
        font-size: 0.9rem;
        margin-bottom: 1.2rem;
    }
    
    .feature-card {
        padding: 1rem;
    }
    
    .legal-item {
        padding: 1rem;
    }
    
    .feature-icon {
        width: 40px;
        height: 40px;
        margin-bottom: 1rem;
    }
    
    .feature-icon i {
        font-size: 1rem;
    }
    
    .feature-title {
        font-size: 0.95rem;
        margin-bottom: 0.6rem;
    }
    
    .feature-desc,
    .legal-desc {
        font-size: 0.8rem;
    }
    
    .legal-title {
        font-size: 0.9rem;
    }
    
    .disclaimer {
        padding: 1.2rem;
    }
    
    .disclaimer h4 {
        font-size: 1rem;
    }
    
    .disclaimer p {
        font-size: 0.85rem;
    }
    
    .footer {
        padding: 1rem;
        margin-top: 1rem;
    }
    
    .footer-link {
        font-size: 0.8rem;
    }
    
    .social-icon {
        width: 28px;
        height: 28px;
    }
    
    .copy-button {
        font-size: 0.7rem;
        padding: 2px;
    }
    
    .copy-button svg {
        width: 12px;
        height: 12px;
    }
    
    .scroll-button {
        width: 35px;
        height: 35px;
        bottom: 90px;
    }
    
    .scroll-button svg {
        width: 16px;
        height: 16px;
    }
    
    .audio-recorder {
        padding: 0.75rem 1rem;
    }
    
    .audio-btn {
        width: 32px;
        height: 32px;
    }
    
    .recording-text {
        font-size: 0.7rem;
    }
    
    .recording-timer {
        font-size: 0.7rem;
    }
    
    .recording-pulse {
        width: 10px;
        height: 10px;
        margin-right: 6px;
    }
}

/* Extra Small Devices */
@media (max-width: 360px) {
    .container {
        padding: 0.5rem;
    }
    
    .hero-section {
        padding: 1.2rem 0.8rem;
    }
    
    .brand-name {
        font-size: 1.6rem;
    }
    
    .chat-messages {
        height: 220px;
        padding: 0.5rem;
    }
    
    .message {
        padding: 0.7rem;
        font-size: 0.8rem;
    }
    
    .features-section,
    .legal-areas {
        padding: 1rem;
    }
    
    .feature-card,
    .legal-item {
        padding: 0.8rem;
    }
}

/* Accessibility & Modern Features */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .chat-messages {
        scroll-behavior: auto;
    }
    
    .message-wrapper {
        animation: none;
        opacity: 1;
    }
}

@media (prefers-contrast: high) {
    .message-wrapper.user .message {
        border: 2px solid white;
    }
    
    .message-wrapper.assistant .message {
        border: 2px solid var(--primary);
    }
    
    .btn {
        border: 2px solid currentColor;
    }
}

@media print {
    .chat-container {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .input-area,
    .audio-recorder,
    .chat-actions {
        display: none;
    }
    
    .chat-messages {
        height: auto;
        overflow: visible;
    }
}


/* Добавьте эти стили в ваш static/css/styles.css файл */

/* ФОНОВОЕ ИЗОБРАЖЕНИЕ ДЛЯ ЧАТА */

/* Основной фон для области чата */
.chat-messages {
    height: 400px;
    overflow-y: auto;
    padding: 1.5rem;
    scroll-behavior: smooth;
    position: relative;
    
    /* Добавляем фоновое изображение */
    background-image: url('/static/images/bg.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: local;
    
    /* Добавляем полупрозрачный оверлей для читабельности */
    background-blend-mode: overlay;
    background-color: rgba(15, 15, 35, 0.8);
}

/* Альтернативный вариант - если изображение нужно зафиксировать */
.chat-messages-fixed-bg {
    background-attachment: fixed;
    background-size: cover;
    background-position: center center;
}

/* Если нужен более темный оверлей */
.chat-messages::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 15, 35, 0.6);
    pointer-events: none;
    z-index: 0;
}

/* Убеждаемся что сообщения поверх фона */
.message-wrapper {
    position: relative;
    z-index: 1;
    margin-bottom: 1.5rem;
    animation: messageSlideIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Улучшаем контрастность сообщений на фоне */
.message-wrapper.user .message {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-bottom-right-radius: var(--radius-sm);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.message-wrapper.assistant .message {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    border-bottom-left-radius: var(--radius-sm);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}

.message-wrapper.system .message {
    background: rgba(45, 45, 84, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    text-align: center;
    max-width: 95%;
    border-radius: var(--radius-xl);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}

/* Typing indicator с лучшей видимостью */
.typing-indicator {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Scroll button поверх фона */
.scroll-button {
    z-index: 10;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .chat-messages {
        background-size: cover;
        background-position: center;
        /* На мобильных можем уменьшить прозрачность оверлея */
        background-color: rgba(15, 15, 35, 0.85);
    }
    
    .chat-messages::before {
        background: rgba(15, 15, 35, 0.7);
    }
}

@media (max-width: 480px) {
    .chat-messages {
        /* На очень маленьких экранах делаем фон более темным для читабельности */
        background-color: rgba(15, 15, 35, 0.9);
    }
    
    .chat-messages::before {
        background: rgba(15, 15, 35, 0.8);
    }
}

/* Альтернативный вариант - фон только как паттерн/текстура */
.chat-messages-pattern {
    background-image: url('/static/images/bg.webp');
    background-size: 400px 400px; /* Масштабируем как паттерн */
    background-repeat: repeat;
    background-position: 0 0;
    opacity: 0.1; /* Очень слабо видимый паттерн */
}

/* Вариант с градиентным оверлеем */
.chat-messages-gradient {
    background-image: 
        linear-gradient(135deg, rgba(15, 15, 35, 0.8), rgba(26, 27, 58, 0.9)),
        url('/static/images/bg.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Если нужно изображение только в определенной части */
.chat-messages-bottom {
    background-image: 
        linear-gradient(to bottom, 
            rgba(15, 15, 35, 1) 0%, 
            rgba(15, 15, 35, 0.8) 50%, 
            rgba(15, 15, 35, 0.6) 100%
        ),
        url('/static/images/bg.webp');
    background-position: bottom center;
    background-size: cover;
}

/* Анимированный фон (осторожно с производительностью) */
@keyframes backgroundMove {
    0% { background-position: 0% 0%; }
    50% { background-position: 100% 100%; }
    100% { background-position: 0% 0%; }
}

.chat-messages-animated {
    background-image: url('/static/images/bg.webp');
    background-size: 120% 120%;
    animation: backgroundMove 60s ease-in-out infinite;
}

/* Fallback если изображение не загрузилось */
.chat-messages {
    /* Базовый градиентный фон как fallback */
    background-image: 
        radial-gradient(circle at 30% 20%, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 70% 80%, rgba(6, 182, 212, 0.1) 0%, transparent 50%),
        url('/static/images/bg.webp');
}