/* AI Chat Widget Styles */

/* Основной контейнер виджета */
#ai-chat-widget {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}

/* Кнопка чата (свернутое состояние) */
#ai-chat-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
}

#ai-chat-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

#ai-chat-button svg {
    width: 28px;
    height: 28px;
    fill: white;
}

/* Индикатор непрочитанных (опционально) */
#ai-chat-button .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 11px;
    display: none;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Окно чата */
#ai-chat-window {
    display: none;
    flex-direction: column;
    width: 380px;
    height: 600px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    position: fixed;
    bottom: 20px;
    right: 20px;
}

#ai-chat-window.open {
    display: flex;
}

/* Шапка чата */
#ai-chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#ai-chat-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

#ai-chat-header .status {
    font-size: 12px;
    opacity: 0.9;
    margin-top: 4px;
}

#ai-chat-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

#ai-chat-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Область сообщений */
#ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Скроллбар */
#ai-chat-messages::-webkit-scrollbar {
    width: 6px;
}

#ai-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

#ai-chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

/* Сообщение */
.chat-message {
    display: flex;
    gap: 10px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.user {
    flex-direction: row-reverse;
}

.chat-message .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
}

.chat-message.user .avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.chat-message.assistant .avatar {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.chat-message .content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.5;
    font-size: 14px;
}

.chat-message.user .content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.assistant .content {
    background: white;
    color: #2d3748;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Индикатор печатания */
.typing-indicator {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    background: white;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    max-width: 70px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #cbd5e0;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Футер с полем ввода */
#ai-chat-footer {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 10px;
    align-items: center;
}

#ai-chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
    font-family: inherit;
}

#ai-chat-input:focus {
    border-color: #667eea;
}

#ai-chat-input::placeholder {
    color: #a0aec0;
}

#ai-chat-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, opacity 0.2s ease;
    flex-shrink: 0;
}

#ai-chat-send:hover:not(:disabled) {
    transform: scale(1.05);
}

#ai-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#ai-chat-send svg {
    width: 20px;
    height: 20px;
    fill: white;
}

/* Приветственное сообщение */
.welcome-message {
    text-align: center;
    padding: 40px 20px;
    color: #718096;
}

.welcome-message h4 {
    margin: 0 0 8px 0;
    color: #2d3748;
    font-size: 16px;
}

.welcome-message p {
    margin: 0;
    font-size: 14px;
}

/* Адаптив для мобильных */
@media (max-width: 480px) {
    #ai-chat-window {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
    
    #ai-chat-button {
        bottom: 15px;
        right: 15px;
        width: 56px;
        height: 56px;
    }
    
    .chat-message .content {
        max-width: 80%;
    }
}

/* Скрыть кнопку когда чат открыт */
#ai-chat-widget.chat-open #ai-chat-button {
    display: none;
}