/* chatbot.css - Авангардный стиль NOMBRE.RU */
:root {
    --chat-red: #00B4D8;
    /* Сине-зеленый акцент */
    --chat-black: #111111;
    --chat-yellow: #00FF41;
    /* Неоново-зеленый акцент */
    --chat-bg: #F8F9FA;
    --chat-border: #111111;
}

/* Плавающая кнопка-триггер */
#avant-chat-trigger {
    position: fixed;
    top: 50%;
    margin-top: -35px;
    right: 20px;
    width: 76px;
    height: 76px;
    background: var(--chat-black);
    /* fallback */
    border: 4px solid var(--chat-black);
    box-shadow: 4px 4px 0 var(--chat-yellow);
    border-radius: 50%;
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 38px;
    color: white;
    transition: transform 0.2s, box-shadow 0.2s;
    animation: pulse 2s infinite;
}

#avant-chat-trigger:hover {
    transform: scale(1.1) rotate(-5deg);
    box-shadow: 6px 6px 0 var(--chat-yellow);
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 180, 216, 0.7), 4px 4px 0 var(--chat-yellow);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(0, 180, 216, 0), 4px 4px 0 var(--chat-yellow);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(0, 180, 216, 0), 4px 4px 0 var(--chat-yellow);
    }
}

/* Основное окно чат-бота */
#avant-chat-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    height: 550px;
    background: var(--chat-bg);
    border: 5px solid #005f73;
    /* Синий/яркий цвет для контраста с черным фоном сайта */
    box-shadow: 10px 10px 0 var(--chat-red);
    z-index: 10000;
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: 'Space Grotesk', sans-serif;
    transform-origin: bottom right;
    animation: slideUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: scale(0.5) translateY(100px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Шапка (Draggable) */
#avant-chat-header {
    background: var(--chat-black);
    color: white;
    padding: 15px 20px;
    cursor: grab;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid var(--chat-red);
    user-select: none;
}

#avant-chat-header:active {
    cursor: grabbing;
}

.avant-chat-label {
    position: absolute;
    bottom: -22px;
    background: var(--chat-black);
    color: white;
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 12px;
    font-family: monospace;
    white-space: nowrap;
    line-height: 1;
    box-shadow: 2px 2px 0 var(--chat-yellow);
    pointer-events: none;
}

#avant-chat-title {
    font-weight: 900;
    font-size: 16px;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-dot {
    width: 10px;
    height: 10px;
    background: #0f0;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 5px #0f0;
}

#avant-chat-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

#avant-chat-close:hover {
    color: var(--chat-red);
}

/* Область сообщений */
#avant-chat-messages {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    background: white;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Скроллбар */
#avant-chat-messages::-webkit-scrollbar {
    width: 8px;
}

#avant-chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-left: 1px solid #ddd;
}

#avant-chat-messages::-webkit-scrollbar-thumb {
    background: var(--chat-black);
}

#avant-chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--chat-red);
}

/* Сообщения */
.chat-msg {
    max-width: 85%;
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.chat-msg.bot {
    align-self: flex-start;
    background: var(--chat-bg);
    border: 2px solid var(--chat-black);
    border-radius: 0 15px 15px 15px;
    box-shadow: 3px 3px 0 var(--chat-black);
}

.chat-msg.user {
    align-self: flex-end;
    background: var(--chat-black);
    color: white;
    border: 2px solid var(--chat-black);
    border-radius: 15px 0 15px 15px;
    box-shadow: -3px 3px 0 var(--chat-yellow);
}

/* Индикатор печати */
.typing-indicator {
    display: none;
    align-self: flex-start;
    background: var(--chat-bg);
    border: 2px solid var(--chat-black);
    border-radius: 0 15px 15px 15px;
    padding: 10px 15px;
    gap: 5px;
}

.typing-indicator.active {
    display: flex;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--chat-black);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typingBounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Ввод */
#avant-chat-input-area {
    padding: 15px;
    background: var(--chat-bg);
    border-top: 3px solid var(--chat-black);
    display: flex;
    gap: 10px;
}

#avant-chat-input {
    flex-grow: 1;
    padding: 10px 15px;
    border: 3px solid var(--chat-black);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    border-radius: 0;
}

#avant-chat-input:focus {
    border-color: var(--chat-red);
}

#avant-chat-send {
    background: var(--chat-black);
    color: white;
    border: 3px solid var(--chat-black);
    padding: 0 20px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
    font-family: inherit;
}

#avant-chat-send:hover {
    background: var(--chat-red);
    border-color: var(--chat-red);
    box-shadow: 4px 4px 0 var(--chat-yellow);
    transform: translateY(-2px);
}

/* Мобильная адаптация */
@media (max-width: 480px) {
    #avant-chat-window {
        width: calc(100% - 30px) !important;
        height: 65vh !important;
        bottom: 90px !important;
        right: 15px !important;
        top: auto !important;
        left: auto !important;
        border: 4px solid var(--chat-black) !important;
        box-shadow: 6px 6px 0 var(--chat-red) !important;
        border-radius: 10px !important;
    }

    #avant-chat-trigger {
        top: auto;
        bottom: 15px;
        width: 60px;
        height: 60px;
        font-size: 30px;
        margin-top: 0;
        right: 15px;
    }
}