/* AI Chat Widget - Premium AI Version */
/* Полностью интегрированная версия с AI-элементами */

:root {
    /* AI Gradient Colors - Фирменные цвета AI */
    --chat-ai-primary: #667eea;
    --chat-ai-secondary: #764ba2;
    --chat-ai-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --chat-ai-gradient-hover: linear-gradient(135deg, #7c8adb 0%, #8e57be 100%);
    --chat-ai-rgb: 102, 126, 234;
    
    /* Кнопка открытия (коричневый для сайта) */
    --chat-toggle-bg: rgb(181, 105, 62);
    --chat-toggle-hover: rgb(165, 95, 52);
    --chat-toggle-rgb: 181, 105, 62;
    
    /* Фоны */
    --chat-bg-primary: #f8fafc;
    --chat-bg-secondary: #ffffff;
    --chat-bg-message: #f1f5f9;
    
    /* Текст */
    --chat-text-primary: #1e293b;
    --chat-text-secondary: #64748b;
    --chat-text-tertiary: #94a3b8;
    
    /* Границы и тени */
    --chat-border-light: rgba(0, 0, 0, 0.06);
    --chat-border-medium: rgba(0, 0, 0, 0.1);
    --chat-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --chat-shadow-md: 0 4px 16px rgba(0, 0, 0, 0.1);
    --chat-shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
    --chat-shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.15);
    
    /* Типографика */
    --font-primary: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    
    /* Размеры */
    --chat-width: 420px;
    --chat-height: 580px;
    --chat-radius: 16px;
    --chat-radius-sm: 12px;
    --chat-radius-xs: 8px;
    
    /* Анимации */
    --chat-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --chat-transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --chat-ease-premium: cubic-bezier(0.33, 1, 0.68, 1);
    --chat-ease-out-expo: cubic-bezier(0.19, 1, 0.22, 1);
}

/* Темная тема */
body.night-mode {
    --chat-bg-primary: #0f172a;
    --chat-bg-secondary: #1e293b;
    --chat-bg-message: #334155;
    --chat-text-primary: #f1f5f9;
    --chat-text-secondary: #cbd5e1;
    --chat-text-tertiary: #94a3b8;
    --chat-border-light: rgba(255, 255, 255, 0.1);
    --chat-border-medium: rgba(255, 255, 255, 0.15);
    --chat-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --chat-shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --chat-shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --chat-shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.6);
}

/* ========================================
   ОСНОВНОЙ КОНТЕЙНЕР
   ======================================== */

.ai-chat-widget {
    position: fixed;
    bottom: 24px;
    z-index: 9999;
    font-family: var(--font-primary);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.ai-chat-widget-right { right: 24px; }
.ai-chat-widget-left { left: 24px; }

/* ========================================
   КНОПКА ОТКРЫТИЯ - PREMIUM AI ВАРИАНТ
   ======================================== */

.ai-chat-toggle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--chat-ai-gradient);
    border: none;
    box-shadow: 0 8px 24px rgba(var(--chat-ai-rgb), 0.35);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.4s var(--chat-ease-premium),
                box-shadow 0.4s var(--chat-ease-premium),
                background 0.4s ease;
    position: relative;
    overflow: visible;
    color: white;
}

/* AI бейдж в углу */
.ai-chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: linear-gradient(135deg, #ffd89b 0%, #19547b 100%);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 7px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.5px;
    z-index: 2;
    animation: badgePulse 2s ease-in-out infinite;
}

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

/* Sparkles (блестки) - символ AI */
.ai-chat-sparkles {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.sparkle {
    position: absolute;
    fill: white;
    opacity: 0;
    animation: sparkleFloat 3s ease-in-out infinite;
    filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.5));
}

.sparkle-1 {
    width: 12px;
    height: 12px;
    top: 8px;
    right: 8px;
    animation-delay: 0s;
}

.sparkle-2 {
    width: 10px;
    height: 10px;
    bottom: 8px;
    left: 8px;
    animation-delay: 1.5s;
}

.sparkle-3 {
    width: 8px;
    height: 8px;
    top: 50%;
    left: 2px;
    animation-delay: 0.7s;
}

@keyframes sparkleFloat {
    0%, 100% {
        opacity: 0;
        transform: translate(0, 0) rotate(0deg) scale(0);
    }
    20% {
        opacity: 1;
        transform: translate(2px, -2px) rotate(20deg) scale(1);
    }
    80% {
        opacity: 1;
        transform: translate(-2px, -2px) rotate(-20deg) scale(1);
    }
}

/* Пульсирующее кольцо вокруг кнопки */
.ai-chat-toggle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border: 2px solid rgba(var(--chat-ai-rgb), 0.6);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: ringPulse 2s ease-out infinite;
    pointer-events: none;
}

@keyframes ringPulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0;
    }
}

/* Иконки в кнопке */
.ai-chat-toggle-icon {
    width: 32px;
    height: 32px;
    position: absolute;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 1;
}

.ai-chat-toggle-open {
    opacity: 1;
    transform: scale(1);
}

.ai-chat-toggle-close {
    opacity: 0;
    transform: scale(0.5) rotate(90deg);
}

/* Состояние при активном чате */
.ai-chat-toggle.active .ai-chat-toggle-open {
    opacity: 0;
    transform: scale(0.5) rotate(-90deg);
}

.ai-chat-toggle.active .ai-chat-toggle-close {
    opacity: 1;
    transform: scale(1) rotate(0);
}

.ai-chat-toggle.active {
    background: var(--chat-ai-gradient-hover);
}

.ai-chat-toggle:hover {
    transform: translateY(-3px) scale(1.08);
    box-shadow: 0 12px 40px rgba(var(--chat-ai-rgb), 0.5), 
                0 0 0 12px rgba(var(--chat-ai-rgb), 0.1);
}

.ai-chat-toggle:active {
    transform: translateY(-1px) scale(1.02);
    transition: transform 0.1s ease;
}

/* ========================================
   ОКНО ЧАТА
   ======================================== */

.ai-chat-window {
    position: absolute;
    bottom: 0;
    margin-bottom: 80px;
    width: var(--chat-width);
    height: var(--chat-height);
    max-height: calc(100vh - 100px);
    background: var(--chat-bg-secondary);
    border-radius: var(--chat-radius);
    box-shadow: var(--chat-shadow-xl);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: var(--chat-transition);
    overflow: hidden;
    border: 1px solid var(--chat-border-light);
}

.ai-chat-widget-right .ai-chat-window { right: 0; }
.ai-chat-widget-left .ai-chat-window { left: 0; }

.ai-chat-window.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
    animation: chatOpen 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes chatOpen {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }
    60% {
        transform: translateY(-5px) scale(1.02);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ========================================
   ПОЛНОЭКРАННЫЙ РЕЖИМ (DESKTOP)
   ======================================== */

.ai-chat-window.fullscreen {
    position: fixed;
    top: 20px;
    left: 20px;
    right: 20px;
    bottom: 20px;
    width: auto !important;
    height: auto !important;
    max-height: none !important;
    max-width: 1400px;
    margin: 0 auto;
    border-radius: var(--chat-radius);
    z-index: 10000;
    animation: expandToFullscreen 0.4s var(--chat-ease-premium);
}

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

/* ========================================
   ШАПКА ЧАТА - С AI ГРАДИЕНТОМ
   ======================================== */

.ai-chat-header {
    padding: 20px 24px;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

/* Анимированный градиентный блик */
.ai-chat-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 200%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(102, 126, 234, 0.1) 50%, 
        transparent 100%);
    animation: shimmer 3s ease-in-out infinite;
    pointer-events: none;
}

@keyframes shimmer {
    0%, 100% {
        left: -100%;
    }
    50% {
        left: 100%;
    }
}

.ai-chat-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    position: relative;
    z-index: 1;
}

.ai-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 1;
}

.ai-chat-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--chat-ai-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(var(--chat-ai-rgb), 0.3);
    position: relative;
}

/* AI бейдж на аватаре */
.ai-chat-avatar::after {
    content: 'AI';
    position: absolute;
    bottom: -2px;
    right: -2px;
    background: white;
    color: var(--chat-ai-primary);
    font-size: 8px;
    font-weight: 700;
    padding: 2px 4px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

body.night-mode .ai-chat-avatar::after {
    background: #1e293b;
    color: var(--chat-ai-primary);
}

.ai-chat-avatar-icon {
    width: 22px;
    height: 22px;
    color: white;
}

.ai-chat-header-text {
    flex: 1;
}

.ai-chat-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 2px 0;
    letter-spacing: -0.01em;
    color: white;
}

.ai-chat-subtitle {
    font-size: 13px;
    margin: 0;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-chat-subtitle::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
    animation: pulse 2s ease-in-out infinite;
}

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

/* Кнопка полноэкранного режима */
.ai-chat-fullscreen {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s var(--chat-ease-premium),
                transform 0.3s var(--chat-ease-premium);
    position: relative;
}

.ai-chat-fullscreen svg {
    width: 20px;
    height: 20px;
}

.ai-chat-fullscreen-expand,
.ai-chat-fullscreen-collapse {
    position: absolute;
    transition: opacity 0.2s ease;
}

.ai-chat-fullscreen-expand {
    opacity: 1;
}

.ai-chat-fullscreen-collapse {
    opacity: 0;
}

.fullscreen .ai-chat-fullscreen-expand {
    opacity: 0;
}

.fullscreen .ai-chat-fullscreen-collapse {
    opacity: 1;
}

.ai-chat-fullscreen:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.ai-chat-fullscreen:active {
    transform: scale(0.95);
}

/* Кнопка закрытия */
.ai-chat-close {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s var(--chat-ease-premium),
                transform 0.3s var(--chat-ease-premium);
}

.ai-chat-close-icon {
    width: 20px;
    height: 20px;
}

.ai-chat-close:hover {
    background: rgba(255, 67, 54, 0.3);
    transform: scale(1.1);
}

.ai-chat-close:active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
}

/* ========================================
   ОБЛАСТЬ СООБЩЕНИЙ
   ======================================== */

.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--chat-bg-primary);
    scroll-behavior: smooth;
}

/* Кастомный скроллбар */
.ai-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.ai-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.ai-chat-messages::-webkit-scrollbar-thumb {
    background: var(--chat-border-medium);
    border-radius: 3px;
}

.ai-chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--chat-text-tertiary);
}

/* ========================================
   СООБЩЕНИЯ
   ======================================== */

.ai-chat-message {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.ai-chat-message.user {
    flex-direction: row-reverse;
    animation: messageSlideReverse 0.3s ease-out;
}

.ai-chat-message.assistant {
    animation: aiMessageAppear 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

@keyframes aiMessageAppear {
    0% {
        opacity: 0;
        transform: translateY(10px) scale(0.95);
    }
    50% {
        transform: translateY(-2px) scale(1.02);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.ai-chat-message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: var(--chat-shadow-sm);
}

.ai-chat-message.assistant .ai-chat-message-avatar {
    background: var(--chat-ai-gradient);
}

.ai-chat-message.user .ai-chat-message-avatar {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
}

.ai-chat-message-avatar-icon {
    width: 18px;
    height: 18px;
    color: white;
}

.ai-chat-message-content {
    max-width: 75%;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ai-chat-message-bubble {
    padding: 14px 18px;
    border-radius: var(--chat-radius-sm);
    word-wrap: break-word;
    line-height: 1.6;
    box-shadow: var(--chat-shadow-sm);
    transition: var(--chat-transition-fast);
    position: relative;
    overflow: hidden;
}

.ai-chat-message-bubble > *:first-child {
    margin-top: 0 !important;
}

.ai-chat-message-bubble > *:last-child {
    margin-bottom: 0 !important;
}

.ai-chat-message-bubble:hover {
    box-shadow: var(--chat-shadow-md);
}

.ai-chat-message.user .ai-chat-message-bubble {
    background: var(--chat-ai-gradient);
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-chat-message.assistant .ai-chat-message-bubble {
    background: var(--chat-bg-message);
    color: var(--chat-text-primary);
    border-bottom-left-radius: 4px;
}

/* Блеск при наведении на сообщение AI */
.ai-chat-message.assistant .ai-chat-message-bubble::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 70%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ai-chat-message.assistant .ai-chat-message-bubble:hover::before {
    opacity: 1;
    animation: shine 1.5s ease-in-out;
}

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

/* ========================================
   MARKDOWN СТИЛИ
   ======================================== */

.ai-chat-heading {
    font-weight: 600;
    line-height: 1.4;
    margin: 20px 0 8px 0;
}

.ai-chat-heading:first-child {
    margin-top: 0;
}

.ai-chat-h1 {
    font-size: 1.5em;
    border-bottom: 2px solid var(--chat-border-light);
    padding-bottom: 6px;
    margin: 24px 0 10px 0;
}

.ai-chat-h1:first-child {
    margin-top: 0;
}

.ai-chat-h2 {
    font-size: 1.3em;
    border-bottom: 1px solid var(--chat-border-light);
    padding-bottom: 4px;
    margin: 20px 0 8px 0;
}

.ai-chat-h2:first-child {
    margin-top: 0;
}

.ai-chat-h3 {
    font-size: 1.1em;
    margin: 16px 0 6px 0;
}

.ai-chat-h3:first-child {
    margin-top: 0;
}

.ai-chat-message-bubble strong,
.ai-chat-message-bubble b {
    font-weight: 600;
    color: inherit;
}

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

.ai-chat-list {
    margin: 10px 0;
    padding-left: 24px;
}

.ai-chat-heading + .ai-chat-list,
.ai-chat-heading + ul,
.ai-chat-heading + ol {
    margin-top: 8px;
}

.ai-chat-list li {
    margin: 6px 0;
    line-height: 1.6;
}

.ai-chat-list li:first-child {
    margin-top: 0;
}

.ai-chat-list li:last-child {
    margin-bottom: 0;
}

.ai-chat-ordered-list {
    list-style-type: decimal;
}

.ai-chat-code {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
    font-size: 0.9em;
    padding: 2px 6px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
    color: var(--chat-ai-primary);
}

.ai-chat-message.user .ai-chat-code {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.ai-chat-code-block {
    margin: 12px 0;
    padding: 12px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 6px;
    overflow-x: auto;
    border-left: 3px solid var(--chat-ai-primary);
}

.ai-chat-heading + .ai-chat-code-block {
    margin-top: 10px;
}

.ai-chat-code-block code {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
    font-size: 0.9em;
    line-height: 1.5;
    color: var(--chat-text-primary);
}

.ai-chat-message.user .ai-chat-code-block {
    background: rgba(255, 255, 255, 0.1);
    border-left-color: white;
}

.ai-chat-message.user .ai-chat-code-block code {
    color: white;
}

.ai-chat-link {
    color: var(--chat-ai-primary);
    text-decoration: underline;
    transition: opacity 0.2s ease;
}

.ai-chat-link:hover {
    opacity: 0.8;
}

.ai-chat-message.user .ai-chat-link {
    color: white;
    text-decoration-color: rgba(255, 255, 255, 0.5);
}

.ai-chat-divider {
    margin: 16px 0;
    border: none;
    border-top: 1px solid var(--chat-border-light);
}

.ai-chat-heading + .ai-chat-divider {
    margin-top: 10px;
}

.ai-chat-divider + .ai-chat-heading {
    margin-top: 20px;
}

.ai-chat-message-bubble p {
    margin: 0 0 10px 0;
}

.ai-chat-message-bubble p:last-child {
    margin-bottom: 0;
}

.ai-chat-heading + p {
    margin-top: 0;
}

.ai-chat-message-bubble p + p {
    margin-top: 10px;
}

.ai-chat-message-time {
    font-size: 11px;
    color: var(--chat-text-tertiary);
    padding: 0 4px;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.ai-chat-message.user .ai-chat-message-time {
    text-align: right;
}

/* ========================================
   ИНДИКАТОР ПЕЧАТИ
   ======================================== */

.ai-chat-typing {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    background: var(--chat-bg-message);
    border-radius: var(--chat-radius-sm);
    box-shadow: var(--chat-shadow-sm);
    width: fit-content;
}

.ai-chat-typing-dots {
    display: flex;
    gap: 5px;
}

.ai-chat-typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--chat-ai-primary);
    animation: typingDot 1.4s infinite;
}

.ai-chat-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.ai-chat-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

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

/* ========================================
   ФОРМА ВВОДА
   ======================================== */

.ai-chat-input-container {
    padding: 14px 16px;
    background: var(--chat-bg-secondary);
    border-top: 1px solid var(--chat-border-light);
    flex-shrink: 0;
}

.ai-chat-input-wrapper {
    display: flex;
    gap: 12px;
    align-items: center;
}

.ai-chat-input {
    flex: 1;
    min-height: 40px;
    max-height: 100px;
    padding: 10px 14px;
    border: 2px solid var(--chat-border-medium);
    border-radius: var(--chat-radius-xs);
    font-family: var(--font-primary);
    font-size: 15px;
    color: var(--chat-text-primary);
    background: var(--chat-bg-primary);
    resize: none;
    outline: none;
    transition: var(--chat-transition-fast);
    line-height: 1.5;
}

.ai-chat-input:focus {
    border-color: var(--chat-ai-primary);
    box-shadow: 0 0 0 3px rgba(var(--chat-ai-rgb), 0.1);
    background: var(--chat-bg-secondary);
}

.ai-chat-input::placeholder {
    color: var(--chat-text-tertiary);
}

.ai-chat-send {
    width: 44px;
    height: 44px;
    border: none;
    background: var(--chat-ai-gradient);
    border-radius: var(--chat-radius-xs);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s var(--chat-ease-premium),
                box-shadow 0.3s var(--chat-ease-premium),
                background 0.3s ease;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(var(--chat-ai-rgb), 0.3);
    position: relative;
}

.ai-chat-send-icon {
    width: 20px;
    height: 20px;
    transition: transform 0.3s var(--chat-ease-premium);
}

.ai-chat-send:hover:not(:disabled) {
    background: var(--chat-ai-gradient-hover);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 20px rgba(var(--chat-ai-rgb), 0.4);
}

.ai-chat-send:hover:not(:disabled) .ai-chat-send-icon {
    transform: translateX(2px);
}

.ai-chat-send:active:not(:disabled) {
    transform: translateY(0) scale(1);
    box-shadow: 0 2px 8px rgba(var(--chat-ai-rgb), 0.3);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.ai-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

/* ========================================
   ПРИВЕТСТВЕННОЕ СООБЩЕНИЕ
   ======================================== */

.ai-chat-welcome {
    text-align: center;
    padding: 48px 24px;
    color: var(--chat-text-secondary);
}

.ai-chat-welcome-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    background: var(--chat-ai-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(var(--chat-ai-rgb), 0.3);
}

.ai-chat-welcome-icon svg {
    width: 32px;
    height: 32px;
    color: white;
}

.ai-chat-welcome-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--chat-text-primary);
    margin: 0 0 10px 0;
    letter-spacing: -0.02em;
}

.ai-chat-welcome-text {
    font-size: 15px;
    margin: 0;
    line-height: 1.7;
    color: var(--chat-text-secondary);
}

/* ========================================
   МОБИЛЬНАЯ АДАПТАЦИЯ
   ======================================== */

@media (max-width: 768px) {
    :root {
        --chat-width: calc(100vw - 40px);
        --chat-height: 70vh;
    }
    
    .ai-chat-widget {
        bottom: 16px;
        right: 16px !important;
        left: auto !important;
    }
    
    .ai-chat-toggle {
        width: 56px;
        height: 56px;
        box-shadow: 0 6px 20px rgba(var(--chat-ai-rgb), 0.4);
    }
    
    .ai-chat-toggle-icon {
        width: 28px;
        height: 28px;
    }
    
    .ai-chat-badge {
        font-size: 9px;
        padding: 2px 5px;
        top: -3px;
        right: -3px;
    }
    
    .sparkle-1 {
        width: 10px;
        height: 10px;
    }
    
    .sparkle-2 {
        width: 8px;
        height: 8px;
    }
    
    .sparkle-3 {
        width: 6px;
        height: 6px;
    }
}

/* Полноэкранный режим на мобильных устройствах */
@media (max-width: 480px) {
    .ai-chat-widget.ai-chat-mobile .ai-chat-window {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        border-radius: 0 !important;
        margin: 0 !important;
        border: none !important;
    }
    
    .ai-chat-widget.ai-chat-mobile .ai-chat-window.active {
        animation: slideUp 0.3s ease-out;
    }
    
    @keyframes slideUp {
        from {
            transform: translateY(100%);
        }
        to {
            transform: translateY(0);
        }
    }
    
    .ai-chat-widget.ai-chat-mobile .ai-chat-toggle {
        position: fixed;
        bottom: 20px;
        right: 20px;
        z-index: 9999;
    }
    
    .ai-chat-widget.ai-chat-mobile .ai-chat-header {
        padding: 16px 20px;
        border-radius: 0;
    }
    
    .ai-chat-widget.ai-chat-mobile .ai-chat-close {
        width: 40px;
        height: 40px;
        background: rgba(255, 255, 255, 0.15);
    }
    
    .ai-chat-widget.ai-chat-mobile .ai-chat-close:hover {
        background: rgba(255, 67, 54, 0.4);
    }
    
    .ai-chat-widget.ai-chat-mobile .ai-chat-avatar {
        width: 36px;
        height: 36px;
    }
    
    .ai-chat-widget.ai-chat-mobile .ai-chat-title {
        font-size: 15px;
    }
    
    .ai-chat-widget.ai-chat-mobile .ai-chat-subtitle {
        font-size: 12px;
    }
    
    .ai-chat-widget.ai-chat-mobile .ai-chat-messages {
        padding: 16px;
    }
    
    .ai-chat-widget.ai-chat-mobile .ai-chat-message-content {
        max-width: 85%;
    }
    
    .ai-chat-widget.ai-chat-mobile .ai-chat-message-bubble {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .ai-chat-widget.ai-chat-mobile .ai-chat-input-container {
        padding: 12px;
        border-top: 1px solid var(--chat-border-medium);
    }
    
    .ai-chat-widget.ai-chat-mobile .ai-chat-input {
        font-size: 16px;
        padding: 10px 12px;
    }
    
    .ai-chat-widget.ai-chat-mobile .ai-chat-send {
        width: 40px;
        height: 40px;
    }
    
    .ai-chat-widget.ai-chat-mobile .ai-chat-window {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .ai-chat-widget.ai-chat-mobile .ai-chat-header {
        padding-top: calc(16px + env(safe-area-inset-top));
    }
    
    .ai-chat-widget.ai-chat-mobile .ai-chat-input-container {
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }
}

@media (max-width: 812px) and (orientation: landscape) {
    .ai-chat-widget.ai-chat-mobile .ai-chat-header {
        padding: 12px 20px;
    }
    
    .ai-chat-widget.ai-chat-mobile .ai-chat-messages {
        padding: 12px;
    }
    
    .ai-chat-widget.ai-chat-mobile .ai-chat-input-container {
        padding: 10px;
    }
}

/* ========================================
   УТИЛИТЫ
   ======================================== */

.ai-chat-hidden {
    display: none !important;
}

body.ai-chat-no-scroll {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
}