/* Виджет VD2 — вынесено из elena_widget/VD2 for bot.html */
.simple-bot-widget,
.simple-bot-widget * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.simple-bot-widget {
    position: fixed;
    bottom: 0;
    right: 0;
    z-index: 999999;
}

.simple-bot-widget .widget-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #0084ff;
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(0,0,0,0.2);
    font-size: 30px;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: Arial, sans-serif;
    z-index: 999999;
}

/* Рядом с оранжевым bis AI-виджетом (~120px ширина) — сдвиг синей кнопки влево */
.simple-bot-widget.elena-vd2-bis-page .widget-button {
    right: 100px;
}

.simple-bot-widget.elena-vd2-bis-page .widget-chat {
    right: 100px;
}

/* Тильда: синяя кнопка слева от зелёной (та же строка, right больше) */
.simple-bot-widget.elena-vd2-tilda .widget-button {
    bottom: 20px !important;
    right: 92px !important;
}

.simple-bot-widget.elena-vd2-tilda .widget-chat {
    bottom: 90px !important;
    right: 92px !important;
}

.simple-bot-widget.elena-vd2-search .widget-button {
    display: none;
}

.simple-bot-widget.elena-vd2-search .widget-chat {
    bottom: 20px;
    right: 20px;
}

.simple-bot-widget.elena-vd2-inline {
    position: relative;
    display: inline-block;
    margin: 0 0 10px;
    z-index: 20;
}

.simple-bot-widget.elena-vd2-inline .widget-button {
    position: relative;
    right: auto;
    bottom: auto;
    width: auto;
    height: 40px;
    border-radius: 8px;
    padding: 0 14px;
    font-size: 16px;
    gap: 8px;
}

.simple-bot-widget.elena-vd2-inline .widget-chat {
    position: fixed;
    top: auto;
    bottom: 20px;
    right: 20px;
    z-index: 999999;
}

.simple-bot-widget.elena-vd2-inline .widget-button:hover::after {
    bottom: calc(100% + 10px);
}

/* Карточка компании: виджет выключен (871 / 57184) — иконка видна, без клика */
.simple-bot-widget.elena-vd2-disabled-state {
    pointer-events: none;
}

.simple-bot-widget.elena-vd2-disabled-state .widget-button {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.12);
}

.simple-bot-widget.elena-vd2-disabled-state .widget-button:hover {
    transform: none;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.12);
}

.simple-bot-widget.elena-vd2-disabled-state .widget-button:hover::after {
    content: none;
}

.simple-bot-widget.elena-vd2-disabled-state .online-indicator {
    background-color: #95a5a6;
    animation: none;
    box-shadow: none;
}

.simple-bot-widget .online-indicator {
    position: absolute;
    bottom: 2px;
    right: 4px;
    width: 14px;
    height: 14px;
    background-color: #2ecc71;
    border-radius: 50%;
    border: 2px solid white;
    animation: elena-pulse-green 1.5s infinite;
}

@keyframes elena-pulse-green {
    0% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.7); }
    70% { box-shadow: 0 0 0 6px rgba(46, 204, 113, 0); }
    100% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0); }
}

.simple-bot-widget .widget-button:hover::after {
    content: "Администратор онлайн";
    position: absolute;
    bottom: 70px;
    right: 0;
    background: #1e1e1e;
    color: white;
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 20px;
    white-space: nowrap;
    font-family: system-ui, sans-serif;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    z-index: 999999;
    pointer-events: none;
}

.simple-bot-widget .widget-button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.simple-bot-widget .widget-chat {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    height: 550px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.25);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 999998;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    border: 1px solid rgba(0,0,0,0.1);
}

.simple-bot-widget .widget-chat.open {
    display: flex;
}

.simple-bot-widget .widget-header {
    background: #0084ff;
    color: white;
    padding: 15px 18px;
    font-weight: 600;
    font-size: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.simple-bot-widget .widget-header span:first-child {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.simple-bot-widget .header-online {
    font-size: 14px;
    color: white;
    font-weight: normal;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.simple-bot-widget .widget-close {
    background: none;
    border: none;
    color: white;
    font-size: 22px;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.simple-bot-widget .widget-close:hover {
    opacity: 1;
}

.simple-bot-widget .widget-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #f9f9f9;
    display: flex;
    flex-direction: column;
}

.simple-bot-widget .message {
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
}

.simple-bot-widget .message.user {
    align-items: flex-end;
}

.simple-bot-widget .message.bot {
    align-items: flex-start;
}

.simple-bot-widget .message-text {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 18px;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.4;
}

.simple-bot-widget .message.user .message-text {
    background: #0084ff;
    color: white;
    border-bottom-right-radius: 4px;
}

.simple-bot-widget .message.bot .message-text {
    background: white;
    color: #1a1a1a;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.simple-bot-widget .message-status {
    font-size: 11px;
    margin-top: 4px;
    margin-right: 4px;
    color: #8e8e8e;
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: flex-end;
}

.simple-bot-widget .message-status.read {
    color: #0084ff;
}

.simple-bot-widget .message-status .checkmark {
    font-size: 12px;
}

.simple-bot-widget .typing-indicator {
    padding: 10px 14px;
    background: white;
    border-radius: 18px;
    display: inline-block;
    font-size: 13px;
    color: #666;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.simple-bot-widget .typing-indicator span {
    animation: elena-widget-blink 1.4s infinite;
    animation-fill-mode: both;
}

.simple-bot-widget .typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.simple-bot-widget .typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes elena-widget-blink {
    0%, 60%, 100% { opacity: 0; }
    30% { opacity: 1; }
}

.simple-bot-widget .widget-input-area {
    padding: 15px;
    background: white;
    border-top: 1px solid #e5e5e5;
    display: flex;
    gap: 10px;
    align-items: center;
}

.simple-bot-widget .widget-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 24px;
    outline: none;
    font-family: inherit;
    font-size: 14px;
    transition: border-color 0.2s;
    color: #333;
}

.simple-bot-widget .widget-input:focus {
    border-color: #0084ff;
}

.simple-bot-widget .widget-input::placeholder {
    color: #aaa;
    opacity: 1;
    font-size: 14px;
}

.simple-bot-widget .widget-send {
    background: #0084ff;
    color: white;
    border: none;
    border-radius: 24px;
    padding: 10px 18px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.simple-bot-widget .widget-send:hover {
    background: #0073e6;
}

@media (max-width: 480px) {
    .simple-bot-widget .widget-chat {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
    .simple-bot-widget .widget-button {
        bottom: 20px;
        right: 20px;
    }
    .simple-bot-widget.elena-vd2-bis-page .widget-button {
        right: 20px;
    }
    .simple-bot-widget.elena-vd2-bis-page .widget-chat {
        right: 0;
    }
    .simple-bot-widget.elena-vd2-tilda .widget-button {
        bottom: 20px !important;
        right: 80px !important;
    }
    .simple-bot-widget.elena-vd2-tilda .widget-chat {
        bottom: 90px !important;
        right: 80px !important;
    }
    .simple-bot-widget.elena-vd2-search .widget-chat {
        right: 8px;
        bottom: 8px;
    }
    .simple-bot-widget.elena-vd2-inline .widget-chat {
        width: min(380px, calc(100vw - 16px));
        right: 8px;
        bottom: 8px;
    }
}
