body,
#chatbot-container,
#chatbot-window,
#chatbot-header h3,
#chatbot-messages,
#chatbot-input-container,
#chatbot-input,
#chatbot-send,
.chatbot-message,
#chatbot-clear {
    font-family: 'Roboto', sans-serif;
}

#chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

#chatbot-text {
    font-size: 16px;
    font-weight: 500;
    color: #fff;
    text-align: center;
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: auto;
    padding: 12px 20px;
    border-radius: 30px;
    background: linear-gradient(135deg, #cf0000, #fd0101);
    box-shadow: 0 4px 12px rgb(207 0 0);
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: pulse 2s infinite;
    white-space: nowrap;
}

#chatbot-text:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgb(215 0 0);
}

#chatbot-text:before {
    content: '';
    display: inline-block;
    vertical-align: middle;
    margin-right: 8px;
    width: 12px;
    height: 12px;
    background: #48d900;
    border-radius: 50%;
    border: 2px solid #fff;
}

#chatbot-window {
    width: 360px;
    height: 500px;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px);
    transition: transform 0.3s ease-out, opacity 0.3s ease;
    position: fixed;
    bottom: 90px;
    right: 20px;
    opacity: 0;
}

/* --- Скрытое окно убираем из потока полностью --- */
#chatbot-window.hidden {
    display: none !important;
    /* элемент вообще не участвует в верстке */
    opacity: 0;
    /* оставляем для совместимости с анимацией */
    transform: translateY(20px);
    /* исходное положение для анимации */
}

#chatbot-window:not(.hidden) {
    transform: translateY(0);
    opacity: 1;
}

.welcome-message {
    animation: fadeIn 0.5s ease-out;
    background-color: #f8f9fa;
    border-left: 4px solid #ffaf05;
}

.quick-suggestions {
    display: grid;
    gap: 8px;
    padding: 10px 0;
}

.quick-suggestions button {
    background: #e9ecef;
    color: #363a45;
    border: none;
    padding: 6px 12px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s;
    border: 1px solid #ffaf05;
    margin-right: 5px;
    opacity: 1 !important;
    animation: fadeIn 0.5s ease-out;
}

.quick-suggestions button:hover {
    background: #ffaf05;
    color: #fff;
}

#chatbot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(135deg, #fd0101, #cf0000);
    color: #fff;
    box-shadow: 0 4px 8px rgba(37, 117, 252, 0.4);
}

#chatbot-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 500;
}

#chatbot-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    transition: transform 0.2s ease;
    padding: 0;
    margin: 0;
    line-height: 100%;
}

#chatbot-close:hover {
    transform: rotate(90deg);
}

#chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    font-size: 14px;
    background: #f9f9f9;
    animation: none !important;
}

#chatbot-messages h4{
    font-size: 18px;
}

#chatbot-window:not(.hidden) .welcome-message {
    display: block !important;
    opacity: 1 !important;
}

#chatbot-input-container {
    display: flex;
    padding: 15px 20px;
    background: #fff;
    border-top: 1px solid #eee;
}

#chatbot-input {
    flex: 1;
    padding: 12px 15px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 25px;
    transition: border-color 0.3s ease;
}

#chatbot-input:focus {
    outline: none;
    border-color: #d40000;
}

#chatbot-send {
    margin-left: 10px;
    padding: 12px 20px;
    font-size: 14px;
    color: #fff;
    background: linear-gradient(135deg, #fa0000, #d40000);
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease;
    box-shadow: 0 4px 12px rgb(246 1 1);
}

#chatbot-send:hover {
    background: linear-gradient(135deg, #d40000, #fa0000);
    transform: scale(1.05);
}

#chatbot-clear {
    margin-left: 10px;
    padding: 8px 12px;
    font-size: 13px;
    background: #fff;
    color: #d40000;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.3s ease, color 0.3s ease;
}

#chatbot-clear:hover {
    background: #d40000;
    color: #fff;
}

.chatbot-message-bot {
    background: #f1f1f1;
    padding: 12px 16px;
    border-radius: 15px;
    margin-bottom: 10px;
    animation: fadeIn 0.3s ease-out;
}

.chatbot-message.chatbot-message-bot a {
    font-weight: bold;
    color: #ff804d;
}

.chatbot-message-user {
    background: linear-gradient(135deg, #fe0101, #cf0000);
    color: #fff;
    padding: 12px 16px;
    border-radius: 15px;
    text-align: right;
    margin-bottom: 10px;
    animation: fadeIn 0.3s ease-out;
}

.loading {
    display: inline-block;
    width: 1em;
    height: 1em;
    border-radius: 50%;
    background: #6a11cb;
    animation: loading 1s infinite alternate;
}

@keyframes loading {
    from {
        transform: scale(1);
        opacity: 0.7;
    }

    to {
        transform: scale(1.4);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 117, 252, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(37, 117, 252, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(37, 117, 252, 0);
    }
}

.chatbot-message-bot h1,
.chatbot-message-bot h2,
.chatbot-message-bot h3,
.chatbot-message-bot h4,
.chatbot-message-bot h5,
.chatbot-message-bot h6 {
    font-weight: bold;
    color: #2c3e50;
    margin: 15px 0 10px;
    line-height: 1.3;
}

.chatbot-message-bot h1 {
    font-size: 1.5em;
    border-bottom: 2px solid #eee;
    padding-bottom: 5px;
}

.chatbot-message-bot h2 {
    font-size: 1.3em;
}

.chatbot-message-bot h3 {
    font-size: 1.1em;
}

.chatbot-message-bot p {
    margin: 10px 0;
    line-height: 1.6;
}

.chatbot-message-bot ul,
.chatbot-message-bot ol {
    margin: 10px 0;
    padding-left: 25px;
}

.chatbot-message-bot ul {
    list-style-type: disc;
}

.chatbot-message-bot ol {
    list-style-type: decimal;
}

.chatbot-message-bot li {
    margin: 5px 0;
}

.chatbot-message-bot strong {
    font-weight: 600;
    color: #2c3e50;
}

.chatbot-message-bot em {
    font-style: italic;
}

.chatbot-message-bot code {
    background-color: #f3f4f6;
    padding: 2px 5px;
    border-radius: 3px;
    font-family: Monaco, Consolas, "Courier New", monospace;
    font-size: 0.9em;
}

.chatbot-message-bot pre {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 15px 0;
}

.chatbot-message-bot pre code {
    background-color: transparent;
    padding: 0;
    font-size: 0.9em;
    line-height: 1.5;
}

.chatbot-message-bot blockquote {
    border-left: 4px solid #ddd;
    margin: 15px 0;
    padding: 5px 15px;
    color: #666;
}

.chatbot-message-bot a {
    color: #2575fc;
    text-decoration: underline;
    position: relative;
    padding-right: 15px;
}

.chatbot-message-bot a::after {
    content: "↗";
    position: absolute;
    right: -2px;
    top: -2px;
    font-size: 0.8em;
}

.chatbot-message-bot a:hover {
    color: #1a5bbf;
}

.chatbot-message-bot table {
    border-collapse: collapse;
    margin: 15px 0;
    width: 100%;
}

.chatbot-message-bot th,
.chatbot-message-bot td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

.chatbot-message-bot th {
    background-color: #f8f9fa;
    font-weight: 600;
}

.loading-dots {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    height: 1em;
}

.loading-dots span {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin: 0 2px;
    background-color: #ff9c00;
    border-radius: 50%;
    animation: bounce 1.2s infinite ease-in-out;
}


.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}


.loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

.error-message {
    background: #fff0f0;
    border-left: 4px solid #ff5252;
    padding: 12px;
    margin: 10px 0;
    border-radius: 4px;
    cursor: help;
    position: relative;
}

.error-message:hover::after {
    content: "Vajutage, et korrata.";
    position: absolute;
    background: #fff;
    border: 1px solid #ccc;
    padding: 5px;
    right: 0;
    top: -25px;
}

.error-icon {
    margin-right: 8px;
}

.clear-chat-btn {
    background: #FF5252;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    margin-left: 10px;
    cursor: pointer;
}

.session-expired {
    background: #fff3cd !important;
    border-left: 4px solid #ffc107;
    padding: 15px;
    margin: 10px 0;
    border-radius: 4px;
}

.session-expired .expired-message {
    margin-bottom: 10px;
    color: #ff6f00;
}

.session-button {
    background: #ffc107;
    color: #000;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 10px;
    transition: background 0.3s ease;
}

.session-button:hover {
    background: #e0a800;
}

.session-button,
.retry-button {
    margin-top: 8px;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

.language-selector {
    padding: 15px;
    text-align: center;
}

.lang-btn {
    display: block;
    width: 100%;
    margin: 10px 0;
    padding: 5px 20px;
    border: 2px solid #ff9f01;
    border-radius: 25px;
    background: transparent;
    color: #363a45;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 16px;
}

.lang-btn:hover {
    background: #ff9801;
    color: white;
}

.welcome-message {
    font-size: 15px;
    line-height: 1.6;
    padding: 20px;
}


.chatbot-message-bot a {
    display: inline;
}


#chatbot-icon img {
    height: 68px;
    width: auto;
    display: inherit;
    position: relative;
    margin-top: -33px;
    margin-bottom: -18px;
}

#chatbot-icon-header img {
    height: 60px;
    width: auto;
    display: inherit;
    position: relative;
    margin-top: -24px;
    margin-bottom: -28px;
}

.chatbot-page-context {
    font-size: 0.6em;
    color: #ffffff;
    padding: 5px 10px;
    border-bottom: 1px solid #ddd;
    display: none;
}

@media (max-width: 767px) {
    #chatbot-window {
        max-width: 340px !important;
        height: 500px !important;
        right: 0 !important;
        bottom: 0 !important;
        border-radius: 12px 12px 0 0;
    }

    #chatbot-header h3 {
        font-size: 16px;
    }

    #chatbot-text {
        padding: 10px 16px;
    }

    #chatbot-input {
        font-size: 16px;
    }

    #chatbot-send {
        padding: 10px 16px;
        font-size: 14px;
    }

    #chatbot-icon img {
        height: 68px;
        width: auto;
        display: inherit;
        position: relative;
        margin-top: -36px;
        margin-bottom: -16px;
    }
}