/*assets/chatbot.css  */
/* Контейнер для иконки и окна чата */
#wpca-chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

/* Иконка-чип (кружок) */
#wpca-chatbot-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4c6fff, #9a4cfd);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    position: relative;
    animation: wpca-pulse 2s infinite;
}

/* Внутренний круг (подложка под знак вопроса) */
#wpca-chatbot-icon::before {
    content: '';
    position: absolute;
    inset: 14px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8);
    box-sizing: border-box;
}

/* Белый знак вопроса по центру, лёгкое мигание */
#wpca-chatbot-icon::after {
    content: '?';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -52%);
    font-size: 30px;
    font-weight: 700;
    color: #4c6fff;
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.35);
    animation: wpca-question-blink 1.4s infinite;
}

/* Анимация пульсации иконки */
@keyframes wpca-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(76, 111, 255, 0.7);
    }

    70% {
        box-shadow: 0 0 0 12px rgba(76, 111, 255, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(76, 111, 255, 0);
    }
}

/* Анимация мигания знака вопроса */
@keyframes wpca-question-blink {
    0%, 100% {
        opacity: 1;
        transform: translate(-50%, -52%) scale(1);
    }
    50% {
        opacity: 0.45;
        transform: translate(-50%, -52%) scale(1.05);
    }
}

/* Всплывающее приветствие рядом с иконкой — привлекает внимание тех,
   кто саму иконку в углу не замечает. */
.wpca-teaser {
    position: fixed;
    bottom: 86px;
    right: 20px;
    max-width: 220px;
    background: #ffffff;
    color: #1a1a1a;
    padding: 12px 32px 12px 14px;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    font-size: 13px;
    line-height: 1.4;
    cursor: pointer;
    z-index: 9998;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
}

.wpca-teaser.wpca-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Хвостик, указывающий на иконку под облачком */
.wpca-teaser::after {
    content: '';
    position: absolute;
    bottom: -6px;
    right: 22px;
    width: 12px;
    height: 12px;
    background: #ffffff;
    transform: rotate(45deg);
    box-shadow: 3px 3px 6px rgba(0, 0, 0, 0.06);
}

.wpca-teaser-close {
    position: absolute;
    top: 2px;
    right: 4px;
    background: transparent;
    border: none;
    color: #9aa0a6;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 6px;
}

/* Окно чата */
#wpca-chatbot-window {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 300px;
    /* Уменьшено на 1/3 от предыдущего размера */
    height: 500px;
    max-height: calc(100vh - 50px);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
    display: none;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

/* Видимое состояние окна */
#wpca-chatbot-window.wpca-visible {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

/* Шапка чата */
.wpca-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: linear-gradient(135deg, #4c6fff, #9a4cfd);
    color: #ffffff;
}

.wpca-chat-title {
    font-weight: 600;
    font-size: 14px;
}

.wpca-chat-close {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
}

/* Тело чата */
.wpca-chat-body {
    flex: 1;
    padding: 10px;
    background: #f6f7fb;
    overflow: hidden;
}

.wpca-messages {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    padding-right: 4px;
    box-sizing: border-box;
}

/* Сообщения */
.wpca-message {
    display: flex;
    margin-bottom: 8px;
}

.wpca-message-bot {
    justify-content: flex-start;
}

.wpca-message-user {
    justify-content: flex-end;
}

.wpca-message-bubble {
    max-width: 80%;
    padding: 8px 10px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.4;
    word-wrap: break-word;
}

.wpca-message-bot .wpca-message-bubble {
    background: #ffffff;
    color: #000000 !important;
    border-top-left-radius: 2px;
}

/* Абзацы в сообщениях бота */
.wpca-message-bot .wpca-message-bubble p {
    margin: 0 0 10px 0;
    color: #000000 !important;
    line-height: 1.5;
}

.wpca-message-bot .wpca-message-bubble p:last-child {
    margin-bottom: 0;
}

/* Ссылки, телефон, почта и Telegram-ник в ответе бота */
.wpca-message-bot .wpca-message-bubble a {
    color: #4c6fff !important;
    text-decoration: underline;
}

.wpca-message-user .wpca-message-bubble {
    background: #4c6fff;
    color: #ffffff;
    border-top-right-radius: 2px;
}

/* Индикатор ожидания — три пульсирующие точки */
.wpca-typing-bubble {
    display: flex;
    align-items: center;
    gap: 4px;
}

.wpca-typing-bubble span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #9aa0a6;
    animation: wpca-typing-bounce 1.2s infinite ease-in-out;
}

.wpca-typing-bubble span:nth-child(2) {
    animation-delay: 0.2s;
}

.wpca-typing-bubble span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes wpca-typing-bounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

/* Футер чата */
.wpca-chat-footer {
    border-top: 1px solid #e1e4f0;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #ffffff;
}

#wpca-user-input {
    flex: 1;
    resize: none;
    padding: 6px 8px;
    font-size: 13px;
    border-radius: 8px;
    border: 1px solid #d2d6e5;
    outline: none;
    min-height: 40px;
    max-height: 80px;
    width: 100%;
    box-sizing: border-box;
}

#wpca-user-input:focus {
    border-color: #4c6fff;
    box-shadow: 0 0 0 1px rgba(76, 111, 255, 0.2);
}

.wpca-footer-buttons {
    display: flex;
    gap: 6px;
    width: 100%;
}

#wpca-clear-btn {
    background: #4c6fff;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 0 14px;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    flex: 1;
    height: 32px;
}

#wpca-clear-btn:hover {
    background: #3d57d1;
}

#wpca-send-btn {
    background: #4c6fff;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 0 14px;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    flex: 1;
    height: 32px;
}

#wpca-send-btn:hover {
    background: #3d57d1;
}

/* Скроллбар (кастомизация под современные браузеры) */
.wpca-messages::-webkit-scrollbar {
    width: 6px;
}

.wpca-messages::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

/* Адаптивность: на очень узких экранах окно растягиваем шире */
@media (max-width: 480px) {
    #wpca-chatbot-window {
        right: 10px;
        width: calc(100% - 20px);
        height: 40vh;
        /* уменьшено пропорционально */
        bottom: 10px;
    }

    #wpca-chatbot-container {
        right: 10px;
        bottom: 15px;
    }

    .wpca-teaser {
        right: 10px;
        max-width: calc(100vw - 90px);
    }
}