/* Global styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f5f5;
    background-image: url('image.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* Chat Widget Styles */
#chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

/* Toggle Button */
.chat-toggle {
    background: #4285f4; /* Blue color */
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.chat-toggle:hover {
    background: #3367d6; /* Darker blue on hover */
    transform: scale(1.05);
}

/* Chat Container */
.chat-container {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 525px; /* Увеличили ширину на 50% (было 350px) */
    height: 450px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.chat-container.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

/* Chat Header */
.chat-header {
    background: #f8f9fa;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
}

.chat-header h3 {
    color: #333;
    font-size: 16px;
    font-weight: 500;
}

.chat-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #777;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.chat-close:hover {
    background: #eee;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    position: relative;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* User Message */
.user-message {
    align-self: flex-end;
    background: #4285f4;
    color: white;
    border-bottom-right-radius: 5px;
}

/* Bot Message */
.bot-message {
    align-self: flex-start;
    background: #f1f1f1;
    color: #333;
    border-bottom-left-radius: 5px;
}

/* Markdown styles in bot messages */
.bot-message h1,
.bot-message h2,
.bot-message h3,
.bot-message h4,
.bot-message h5,
.bot-message h6 {
    margin: 10px 0 5px 0;
    font-weight: bold;
}

.bot-message h1 {
    font-size: 1.5em;
}

.bot-message h2 {
    font-size: 1.4em;
}

.bot-message h3 {
    font-size: 1.3em;
}

.bot-message h4 {
    font-size: 1.2em;
}

.bot-message h5 {
    font-size: 1.1em;
}

.bot-message h6 {
    font-size: 1em;
}

.bot-message strong {
    font-weight: bold;
}

.bot-message em {
    font-style: italic;
}

.bot-message del {
    text-decoration: line-through;
}

.bot-message code {
    background-color: #e0e0e0;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: monospace;
}

.bot-message ul,
.bot-message ol {
    margin: 10px 0;
    padding-left: 20px;
}

.bot-message li {
    margin: 5px 0;
    display: list-item;
}

.bot-message a {
    color: #4285f4;
    text-decoration: underline;
}

.bot-message a:hover {
    color: #3367d6;
}

.bot-message p {
    margin: 5px 0;
}

/* Typing Indicator */
.typing-indicator {
    align-self: flex-start;
    background: #f1f1f1;
    padding: 10px 15px;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border-bottom-left-radius: 5px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-5px); }
}

/* Chat Input Area */
.chat-input-area {
    display: flex;
    padding: 15px;
    border-top: 1px solid #eee;
    gap: 10px;
    background: white;
}

.message-input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
    transition: border 0.2s;
}

.message-input:focus {
    border-color: #4285f4;
}

.send-button {
    background: #4285f4;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 10px 20px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}

.send-button:hover {
    background: #3367d6;
}

.send-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Responsive Design */
@media (max-width: 480px) {
    .chat-container {
        width: calc(100vw - 40px);
        height: calc(100vh - 100px);
    }
}