/* Thêm các quy tắc này để đảm bảo layout co giãn đúng */
html {
    height: 100%;
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    width: 100%;
    /* Sử dụng min-height thay vì height để body có thể lớn hơn 100vh */
    min-height: 100vh; 
}

/* Container chính cũng cần co giãn linh hoạt */
.container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* Đảm bảo container chiếm ít nhất toàn bộ chiều cao màn hình */
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}
h1 {
    color: #2196F3;
    margin: 0;
    flex-grow: 1;
    text-align: center;
    font-size: 24px;
}
#language-toggle {
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}
#language-toggle:hover {
    background-color: #e0e0e0;
}
#chatbox {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    background-color: #f9f9f9;
    border-radius: 0;
    box-shadow: none;
}
#messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 30px;
    background-color: #f9f9f9;
}
.message {
    margin: 15px 0;
    padding: 12px 18px;
    border-radius: 12px;
    max-width: 75%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: relative;
}
.user-message {
    background-color: #e1f5fe;
    align-self: flex-start;
    margin-right: auto;
    margin-left: 30px;
    border-bottom-left-radius: 4px;
}
.bot-message {
    background-color: #f0f4f8;
    align-self: flex-end;
    margin-left: auto;
    margin-right: 30px;
    border-bottom-right-radius: 4px;
}
.system-message {
    background-color: #f0f0f0;
    font-style: italic;
    text-align: center;
    width: calc(100% - 60px);
    margin: 10px auto;
    border-radius: 8px;
}
.message-sender {
    font-weight: bold;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.message-content {
    line-height: 1.5;
}
.message-content ul, .message-content ol {
    padding-left: 20px;
}
.message-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
    gap: 8px;
}
.action-button {
    background-color: #f8f9fa;
    border: 1px solid #dadce0;
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    color: #5f6368;
    display: flex;
    align-items: center;
    gap: 5px;
}
.action-button:hover {
    background-color: #f1f3f4;
    color: #202124;
}
.action-button i {
    font-size: 14px;
}
.suggested-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    padding: 12px 15px;
    border-top: 1px dashed #ccc;
}
.question-button {
    background-color: #e3f2fd;
    border: 1px solid #bbdefb;
    border-radius: 16px;
    padding: 8px 14px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.question-button:hover {
    background-color: #bbdefb;
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.question-button i {
    color: #1976d2;
    font-size: 14px;
}
#inputArea {
    display: flex;
    padding: 20px 30px;
    border-top: 1px solid #e0e0e0;
    background-color: #fff;
}
#userInput {
    flex: 1;
    min-height: 60px;
    max-height: 150px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    resize: vertical;
    font-family: inherit;
    margin-right: 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
#userInput:focus {
    outline: none;
    border-color: #2196F3;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
}
.buttons-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
#sendButton, #newChatButton {
    padding: 12px 16px;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
#sendButton {
    background-color: #4CAF50;
}
#sendButton:hover {
    background-color: #45a049;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
#newChatButton {
    background-color: #2196F3;
}
#newChatButton:hover {
    background-color: #0b7dda;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0,0,0,0.1);
    border-radius: 50%;
    border-top-color: #2196F3;
    animation: spin 1s ease-in-out infinite;
    margin-right: 10px;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Media queries cho điện thoại di động */
@media (max-width: 768px) {
    .header {
        padding: 10px 15px;
    }
    h1 {
        font-size: 20px;
    }
    #messages {
        padding: 15px;
    }
    .message {
        max-width: 85%;
        margin-left: 15px;
        margin-right: 15px;
    }
    #inputArea {
        flex-direction: column;
        padding: 15px;
    }
    #userInput {
        min-height: 80px;
        margin-right: 0;
        margin-bottom: 10px;
    }
    .buttons-container {
        flex-direction: row;
    }
    #sendButton, #newChatButton {
        flex: 1;
        padding: 12px 10px;
        font-size: 14px;
    }
    .suggested-questions {
        flex-direction: column;
        padding: 8px;
    }
    .question-button {
        width: 100%;
        margin-bottom: 5px;
        text-align: left;
    }
}