/* ai_chat.css - Виджет ИИ-чата (правый нижний угол) */

.ai-chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 100;
    font-family: 'Inter', 'Roboto', 'Arial', sans-serif;
}

.ai-chat-button {
    width: 60px;
    height: 60px;
    background: #2C5F8A;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border: none;
}

.ai-chat-button:hover {
    background: #1D3E5C;
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.ai-chat-button svg {
    width: 32px;
    height: 32px;
    fill: white;
}

.ai-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #E5E7EB;
}

.ai-chat-window.open {
    display: flex;
}

.ai-chat-header {
    background: #2C5F8A;
    color: white;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-chat-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
}

.ai-chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #F5F7FA;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-message {
    background: white;
    padding: 10px 14px;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    max-width: 85%;
    align-self: flex-start;
    font-size: 14px;
    line-height: 1.4;
    color: #1A1A1A;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.user-message {
    background: #2C5F8A;
    color: white;
    padding: 10px 14px;
    border-radius: 12px;
    border-bottom-right-radius: 4px;
    max-width: 85%;
    align-self: flex-end;
    font-size: 14px;
    line-height: 1.4;
}

.ai-chat-input-area {
    display: flex;
    padding: 12px;
    border-top: 1px solid #E5E7EB;
    background: white;
    gap: 8px;
}

.ai-chat-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #E5E7EB;
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
    resize: none;
    height: 40px;
}

.ai-chat-input:focus {
    outline: none;
    border-color: #2C5F8A;
}

.ai-chat-send {
    background: #2C5F8A;
    border: none;
    color: white;
    padding: 0 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}

.ai-chat-send:hover {
    background: #1D3E5C;
}

.ai-typing {
    background: white;
    padding: 10px 14px;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    max-width: 85%;
    align-self: flex-start;
    font-size: 14px;
    color: #6B7280;
}

.ai-chat-contact-form {
    padding: 16px;
    border-top: 1px solid #E5E7EB;
    background: #F5F7FA;
}

.ai-chat-contact-form input {
    width: 100%;
    padding: 8px 10px;
    margin-bottom: 8px;
    border: 1px solid #E5E7EB;
    border-radius: 4px;
    font-size: 13px;
}

.ai-chat-contact-form button {
    width: 100%;
    background: #2C5F8A;
    color: white;
    border: none;
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
}

@media (max-width: 480px) {
    .ai-chat-window {
        width: calc(100vw - 48px);
        right: 0;
        bottom: 70px;
    }

    .ai-chat-button {
        width: 50px;
        height: 50px;
    }
}

.floating-help-button {
    position: fixed;
    bottom: 50px;
    right: 20px;
    background: #dc2626;
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
    z-index: 1000;
    transition: transform 0.2s, background 0.2s;
}

.floating-help-button:hover {
    background: #b91c1c;
    transform: scale(1.05);
}

.floating-help-button svg {
    width: 20px;
    height: 20px;
}
/* Добавьте в ваш styles.css */
.ai-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 15px;
    background: #f0f0f0;
    border-radius: 18px;
    width: fit-content;
    margin: 8px 0;
}

.ai-typing span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typingAnimation 1.4s infinite ease-in-out;
}

.ai-typing span:nth-child(1) {
    animation-delay: 0s;
}

.ai-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.ai-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingAnimation {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Стили для окна чата */
.ai-chat-window {
    display: none;
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 380px;
    height: 500px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    flex-direction: column;
    z-index: 10000;
}

.ai-chat-window.open {
    display: flex !important;
}

/* Стили для сообщений */
.user-message {
    background: #1e3a5f;
    color: white;
    padding: 10px 15px;
    border-radius: 18px;
    margin: 8px 0;
    margin-left: auto;
    max-width: 80%;
    width: fit-content;
}

.ai-message {
    background: #f0f0f0;
    color: #333;
    padding: 10px 15px;
    border-radius: 18px;
    margin: 8px 0;
    max-width: 80%;
    width: fit-content;
}

@media (max-width: 768px) {
    .floating-help-button {
        bottom: 10px;
        right: 10px;
    }
}

/* ===== ИИ-ЧАТ ВИДЖЕТ ===== */
.ai-chat-widget {
    position: fixed;
    bottom: 100px;
    right: 30px;
    z-index: 9999;
    font-family: 'Inter', 'Roboto', 'Arial', sans-serif;
}

.floating-help-button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 24px;
    background: #F9C100;
    color: #1a1a1a;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(249, 193, 0, 0.4);
    transition: all 0.3s ease;
}

.floating-help-button:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 32px rgba(249, 193, 0, 0.5);
}

.floating-help-button:active {
    transform: scale(0.95);
}

/* ===== ОКНО ЧАТА ===== */
.ai-chat-window {
    display: none;
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 380px;
    max-width: 90vw;
    height: 500px;
    max-height: 70vh;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    flex-direction: column;
    overflow: hidden;
    animation: chatFadeIn 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

@keyframes chatFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ===== ЗАГОЛОВОК ЧАТА ===== */
.ai-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #1a2a4a;
    color: white;
    flex-shrink: 0;
}

.ai-chat-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: white;
}

.ai-chat-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.2s;
}

.ai-chat-close:hover {
    color: white;
}

/* ===== СООБЩЕНИЯ ===== */
.ai-chat-messages {
    flex: 1;
    padding: 16px 20px;
    overflow-y: auto;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Стилизация скролла */
.ai-chat-messages::-webkit-scrollbar {
    width: 4px;
}

.ai-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.ai-chat-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

/* ===== СООБЩЕНИЕ ===== */
.message {
    display: flex;
    gap: 10px;
    max-width: 90%;
    animation: messageSlide 0.3s ease;
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message.ai {
    align-self: flex-start;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    background: #e9ecef;
}

.message.user .message-avatar {
    background: #0066cc;
}

.message.ai .message-avatar {
    background: #F9C100;
}

.message-content {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.message.user .message-content {
    background: #0066cc;
    color: white;
    border-bottom-right-radius: 4px;
}

.message.ai .message-content {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.message.ai .message-content a {
    color: #0066cc;
    text-decoration: none;
}

.message.ai .message-content a:hover {
    text-decoration: underline;
}

/* ===== ИНДИКАТОР ПЕЧАТИ ===== */
.message.ai.typing .message-content {
    padding: 12px 16px;
}

.typing-dots {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}
.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-6px);
    }
}

/* ===== ПОЛЕ ВВОДА ===== */
.ai-chat-input-area {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #e9ecef;
    flex-shrink: 0;
    align-items: flex-end;
}

.ai-chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Inter', 'Roboto', 'Arial', sans-serif;
    resize: none;
    min-height: 44px;
    max-height: 120px;
    outline: none;
    transition: border-color 0.2s;
    line-height: 1.4;
}

.ai-chat-input:focus {
    border-color: #0066cc;
}

.ai-chat-send {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 8px;
    background: #0066cc;
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

.ai-chat-send:hover {
    background: #0052a3;
}

.ai-chat-send:active {
    transform: scale(0.95);
}

/* ===== АДАПТИВ ===== */
@media (max-width: 768px) {
    .ai-chat-widget {
        bottom: 80px;
        right: 16px;
    }

    .floating-help-button {
        padding: 12px 18px;
        font-size: 14px;
    }

    .floating-help-button span {
        font-size: 14px;
    }

    .ai-chat-window {
        width: 100vw;
        max-width: 100vw;
        height: 70vh;
        max-height: 70vh;
        right: -10px;
        bottom: 60px;
        border-radius: 12px 12px 0 0;
    }

    .message {
        max-width: 95%;
    }
}

@media (max-width: 480px) {
    .ai-chat-widget {
        bottom: 70px;
        right: 10px;
    }

    .floating-help-button {
        padding: 10px 14px;
        font-size: 13px;
        gap: 6px;
    }

    .ai-chat-window {
        height: 65vh;
        max-height: 65vh;
        right: -5px;
        bottom: 50px;
    }
}