/* ==========================================================================
   CHAT WIDGET | PREMIUM RETRO EDITION (POLISHED)
   ========================================================================== */

.ai-chat-container {
    position: fixed;
    bottom: 25px; /* Чуть приподняли от края для легкости */
    right: 25px;
    width: 320px;
    z-index: 1000;
    font-family: 'MyRetroFont', sans-serif;
    /* Плавное появление всего виджета */
    animation: fadeInChat 0.8s ease-out;
}

@keyframes fadeInChat {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

#chat-header {
    background: rgba(20, 20, 20, 0.7) !important; /* Полупрозрачный темный */
    backdrop-filter: blur(12px); /* Эффект стекла */
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--gold);
    padding: 12px 18px;
    color: var(--gold);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-size: 0.75rem;
    border-radius: 12px 12px 0 0; /* Скругление только сверху */
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 10px rgba(184, 134, 11, 0.2); /* Легкое золотое свечение */
    transition: all 0.3s ease;
}

.ai-badge {
    background: linear-gradient(to bottom, #fcf6ba 0%, #d4af37 50%, #b8860b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: bold;
    margin-left: 2px;
}

#chat-header:hover {
    background: rgba(30, 30, 30, 0.8) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 15px rgba(184, 134, 11, 0.4);
}

#chat-body {
    background: rgba(15, 15, 15, 0.85) !important; /* Еще более прозрачный фон */
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--gold);
    border-top: none;
    height: 380px;
    display: flex;
    flex-direction: column;
    border-radius: 0 0 12px 12px; /* Скругление только снизу */
    overflow: hidden; /* Чтобы контент не вылезал за скругления */
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.7);
}

/* Стили сообщений (чуть подправим для премиальности) */
.msg {
    margin-bottom: 12px;
    padding: 10px 14px;
    border-radius: 15px; /* Более мягкие скругления для пузырьков */
    font-size: 0.85rem;
    line-height: 1.4;
    max-width: 85%;
}

.msg-user {
    background: linear-gradient(135deg, var(--gold-dim), var(--gold)); /* Градиент для пользователя */
    color: #000; /* Черный текст на золотом лучше читается */
    align-self: flex-end;
    margin-left: auto;
    border-bottom-right-radius: 2px; /* Эффект "хвостика" сообщения */
}

.msg-bot {
    background: rgba(40, 40, 40, 0.6);
    color: var(--text-main);
    border: 1px solid rgba(184, 134, 11, 0.3);
    align-self: flex-start;
    border-bottom-left-radius: 2px; /* Эффект "хвостика" сообщения */
}

/* Поле ввода */
.chat-input-area {
    display: flex;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(184, 134, 11, 0.2);
}

#chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(184, 134, 11, 0.3);
    color: white;
    padding: 8px 12px;
    border-radius: 20px; /* Круглое поле ввода */
    outline: none;
    transition: border 0.3s ease;
}

#chat-input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 8px rgba(184, 134, 11, 0.5); /* Мягкое золотое сияние вокруг поля */
    outline: none;
}

#chat-send {
    background: transparent;
    border: none;
    color: var(--gold);
    cursor: pointer;
    font-size: 1.4rem;
    margin-left: 10px;
    transition: transform 0.2s ease;
}

#chat-send:hover {
    transform: scale(1.2); /* Эффект при наведении */
}

/* Скрытие тела чата */
.chat-body-hidden {
    display: none !important;
}
