/* chat-widget.css */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: transparent;
    overflow: hidden;
}

.chat-widget-container {
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Шапка */
.chat-header {
    background: rgba(255, 255, 255, 0.95);
    padding: 15px 20px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 800px;
    margin: 0 auto;
}

.avatar {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-right: 15px;
}

.header-info {
    flex: 1;
}

.title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.subtitle {
    font-size: 14px;
    color: #667eea;
    font-weight: 500;
}

.header-time {
    font-size: 14px;
    color: #666;
    background: #f5f5f5;
    padding: 4px 12px;
    border-radius: 20px;
}

/* Контейнер сообщений */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

/* Общие стили сообщений */
.message {
    max-width: 75%;
    padding: 15px;
    border-radius: 18px;
    position: relative;
    animation: messageAppear 0.3s ease;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.5;
}

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

/* Сообщения от пользователя */
.message-user {
    align-self: flex-end;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

/* Сообщения от AI */
.message-ai {
    align-self: flex-start;
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Время сообщения */
.message-time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 8px;
    text-align: right;
}

.message-user .message-time {
    color: rgba(255, 255, 255, 0.8);
}

.message-ai .message-time {
    color: #666;
}

/* Индикатор набора текста */
.typing-indicator {
    align-self: flex-start;
    display: flex;
    gap: 8px;
    padding: 15px;
    background: white;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    animation: typingAnimation 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingAnimation {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.6; }
    40% { transform: scale(1); opacity: 1; }
}

/* Область ввода */
.input-area {
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.input-wrapper {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.message-input {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid #e1e5e9;
    border-radius: 25px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s;
    background: white;
}

.message-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.send-btn {
    padding: 15px 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    min-width: 120px;
}

.send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

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

.call-btn {
    width: 100%;
    padding: 15px;
    background: transparent;
    border: 2px solid #667eea;
    color: #667eea;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.call-btn:hover {
    background: #667eea;
    color: white;
}

.call-btn.active {
    background: #f72585;
    border-color: #f72585;
    color: white;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(247, 37, 133, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(247, 37, 133, 0); }
    100% { box-shadow: 0 0 0 0 rgba(247, 37, 133, 0); }
}

/* Полоса прокрутки */
.messages-container::-webkit-scrollbar {
    width: 6px;
}

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

.messages-container::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.5);
    border-radius: 10px;
}

.messages-container::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.7);
}

/* Адаптивность */
@media (max-width: 768px) {
    .chat-widget-container {
        border-radius: 0;
    }
    
    .message {
        max-width: 85%;
    }
    
    .send-btn span {
        display: none;
    }
    
    .send-btn {
        min-width: 50px;
        width: 50px;
        height: 50px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .send-btn::after {
        content: '➤';
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .chat-header {
        padding: 12px 15px;
    }
    
    .avatar {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .title {
        font-size: 16px;
    }
    
    .subtitle {
        font-size: 12px;
    }
    
    .messages-container {
        padding: 15px;
    }
    
    .message {
        padding: 12px;
    }
    
    .input-area {
        padding: 15px;
    }
    
    .message-input {
        padding: 12px 15px;
        font-size: 14px;
    }
}