:root {
    --bg-color: #2c2f38;
    --text-color: #f0f0f0;
    --input-bg: #3e434d;
    --button-bg: #4a8bf0;
    --button-text: #fff;
    --button-hover-bg: #3367d3;
}

[data-theme="dark"] {
    --bg-color: #f9f9f9;
    --text-color: #333;
    --bubble-bg-user: #3a8bfd;
    --bubble-bg-ai: #e5e5e5;
    --input-bg: #fff;
    --button-bg: #3a8bfd;
    --button-text: #fff;
    --button-hover-bg: #2a6fb2;
}

#chatbot {
    display: flex;
    flex-direction: column;
    margin: 0 auto;
    background-color: var(--bg-color);
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

#chat-log {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
    overflow-y: auto;
    max-height: calc(100vh - 250px);
    flex-grow: 1;
    padding: 10px;
    padding-bottom: 80px;
}

.chat-bubble {
    padding: 12px;
    border-radius: 12px;
    max-width: 70%;
    font-size: 16px;
    line-height: 1.4;
    word-wrap: break-word;
}

.user-bubble {
    background-color: var(--bubble-bg-user);
    align-self: flex-end;
    color: white;
}

.ai-bubble {
    background-color: var(--bubble-bg-ai);
    align-self: flex-start;
    color: var(--text-color);
}

.chat-input-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    border-top: 1px solid #ddd;
    background-color: var(--bg-color);
}

#chat-input {
    flex: 1;
    min-height: 45px;
    max-height: 200px;
    padding: 12px;
    font-size: 15px;
    border: 1px solid #ccc;
    border-radius: 12px;
    background-color: var(--input-bg);
    color: var(--text-color);
    transition: all 0.3s ease;
    resize: vertical;
    box-sizing: border-box;
    font-family: inherit;
}

button {
    padding: 0 25px;
    font-size: 15px;
    border: none;
    border-radius: 12px;
    background-color: var(--button-bg);
    color: var(--button-text);
    height: 45px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}

button:hover {
    background-color: var(--button-hover-bg);
}

#chat-input:focus {
    outline: none;
    border-color: #4a8bf0;
}

.mode-toggle {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 22px;
    border: none;
    background: transparent;
    cursor: pointer;
}

@media (max-width: 768px) {
    #chat-log {
        max-height: calc(100vh - 180px);
    }

    .chat-input-container {
        flex-direction: column;
        align-items: stretch;
    }

    #chat-input,
    button {
        width: 100%;
    }

    button {
        margin-top: 12px;
    }
}

@media (max-width: 480px) {
    h2 {
        font-size: 20px;
    }

    .mode-toggle {
        font-size: 18px;
    }

    #chat-input {
        font-size: 14px;
    }

    button {
        font-size: 14px;
    }
}
