body {
    font-family: 'Inter', Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 20px;
    line-height: 1.6;
}

/* Основные стили виджета */
#chat_widget_container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
}

/* Кнопка, которая превращается в чат */
.chat-widget {
    border-radius: 30px;
    background: #50B848;
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    /* Плавные переходы для трансформации */
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
    transform-origin: bottom right;
    position: relative;
    width: 60px;
    height: 60px;
    font-size: 15px;
}

.chat-widget.expanded {
    width: 350px;
    height: 500px;
    border-radius: 25px;
    background: white;
    flex-direction: column;
    transform: scale(1);
    box-shadow: 0 0px 54px #0000001C;
}
/* При открытии чата:
    Скрываем кнопоку виджета */
.chat-widget.expanded .widget-button {
    display: none;
}

/* Показываем окно */
.chat-widget.expanded .chat-window {
    display: flex;
    animation: chatContentAppear 0.2s ease-out 0.1s both;
}

/* Содержимое виджета */
.widget-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    transition: all 0.3s ease;
    opacity: 1;
    transform: scale(1);
}

/* Окно чата скрыто по умолчанию */
.chat-window {
    display: none;
    cursor: default;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

/*------------ Анимация появления ------------*/
.chat-widget {
    animation: widgetAppear 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes widgetAppear {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.02) translateY(-2px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes chatContentAppear {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

/*------------ Анимация закрытия ------------*/
.chat-widget.closing {
    animation: widgetClose 0.4s ease-out forwards;
}

@keyframes widgetClose {
    0% {
        opacity: 1;
        transform: scale(1);
        border-radius: 25px;
        background: white;
    }
    100% {
        opacity: 0;
        transform: scale(0.7);
        border-radius: 50%;
        background: #50B848;
    }
}

/*------------ Шапка виджета ------------*/
.chat-header {
    padding: 12px 16px;
    font-weight: 500;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #FFFFFF;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    height: 54px;
    box-sizing: border-box;
}

.header-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    flex: 1;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.close-button {
    background: #F5F5F6;
    margin:5px 8px 8px 0px;
    border: none;
    color: #02071DB8;
    font-size: 20px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: center;
}

.close-button:hover {
    background: #EAEAEA;
}

.menu-button {
    background: #F5F5F6;
    border: none;
    color: #02071DB8;
    font-size: 18px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.menu-button:hover {
    background: #EAEAEA;
}

.menu-dropdown {
    position: absolute;
    top: 45px;
    right: 16px;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 20;
    min-width: 120px;
    display: none;
}

.menu-dropdown.show {
    display: block;
}

.menu-item {
    padding: 10px 16px;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: background-color 0.2s ease;
}

.menu-item:hover {
    background: #f8f9fa;
}

.menu-item.clear-chat {
    color: #e74c3c;
}

.menu-item.clear-chat:hover {
    background: #fee;
    color: #c0392b;
    border-radius: 8px;
}

/*------------ Сообщения виджета ------------*/
.chat-messages {
    flex: 1;
    padding: 60px 16px 16px 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    max-width: 260px;
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 18px;
    line-height: 1.4;
    overflow-wrap: break-word;
}

.message-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    max-width: 100%;
}

.message-wrapper.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-wrapper.bot {
    align-self: flex-start;
    flex-direction: row;
}

.message-content {
    max-width: calc(100% - 40px);
    display: flex;
    flex-direction: column;
}

.message.bot {
    background: #EBEBEDDE;
    color: #333;
    border-bottom-left-radius: 6px;
    border-top-left-radius: 18px;
    border-top-right-radius: 18px;
    border-bottom-right-radius: 18px;
    align-self: flex-start;
}

.message.user {
    background: #50B848;
    color: black !important;
    border-bottom-right-radius: 6px;
    border-top-left-radius: 18px;
    border-top-right-radius: 18px;
    border-bottom-left-radius: 18px;
    align-self: flex-end;
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
}

.avatar.bot {
    color: white;
    align-self: flex-end;
    margin-bottom: 2px;
}

.avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/*------------ Поле ввода виджета ------------*/
.chat-input-container {
    padding: 16px;
    background: #fff;
}

.chat-input-form {
    position: relative;
    display: flex;
    align-items: center;
}

.chat-input {
    flex: 1;
    padding: 12px 50px 12px 16px;
    border: 1px solid #ddd;
    border-radius: 24px;
    outline: none;
    font-size: 14px;
    transition: border-color 0.2s ease;
    width: 100%;
}

.send-button {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    padding: 0;
    background: #50B848;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.send-button svg {
    width: 36px;
    height: 36px;
}

.send-button:hover:not(:disabled) {
    background: #50B848;
}

.send-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Стили для индикатора печатания */
.typing-indicator {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 18px;
    border: 1px solid #e9ecef;
}

.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #6c757d;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

.typing-text {
    margin-left: 12px;
    color: #6c757d;
    font-size: 14px;
}

@keyframes typing {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: translateY(0);
    }
    30% {
        opacity: 1;
        transform: translateY(-4px);
    }
}
.chat-messages::-webkit-scrollbar {
    display: none;
}

/* ---------- FIX: видимость текста/каретки в инпуте ---------- */
#chat_widget_container .chat-window {
  color: #222; /* базовый цвет текста в окне чата */
}

/* сам инпут */
#chat_widget_container .chat-input {
  color: #111 !important;         /* цвет текста */
  caret-color: #111 !important;   /* цвет каретки */
  background: #fff !important;    /* белый фон инпута */
  -webkit-text-fill-color: #111;  /* для Edge/Chrome в некоторых темах */
}

/* placeholder */
#chat_widget_container .chat-input::placeholder {
  color: #8a8f98;                  /* серый плейсхолдер */
  opacity: 1;                      /* во всех браузерах */
}

/* выделение текста в инпуте (по желанию) */
#chat_widget_container .chat-input::selection {
  background: #cfead8;
  color: #111;
}

/* чтобы глобальные стили Superset не подсунули «тёмную» палитру */
#chat_widget_container .chat-input,
#chat_widget_container .chat-window input {
  border-color: #ddd !important;
  box-shadow: none !important;
}

/* если при disabled инпут тоже «бледнеет» — зафиксируем читабельность */
#chat_widget_container .chat-input:disabled {
  -webkit-text-fill-color: #666;
  color: #666;
  background: #f6f6f6;
}