/* --- Reset & Global Styles --- */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f8f8;
    position: relative;
}

/* --- Main Container --- */
.main-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 100%;
    position: relative;
    overflow: hidden;
}

/* --- Header --- */
.header {
    background-color: #2c3e50;
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom-left-radius: 25px;
    border-bottom-right-radius: 25px;
    z-index: 10;
    flex-shrink: 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
}

.header-title {
    flex-grow: 1;
    text-align: center;
    font-size: 1.2em;
    font-weight: 600;
}

/* --- Language Selector --- */
.language-selector {
    cursor: pointer;
    position: relative;
    display: inline-block;
    margin-right: 10px;
}

.language-selector .dropdown-content {
    display: none;
    position: absolute;
    background-color: #f9f9f9;
    min-width: 80px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
    right: 0;
    border-radius: 5px;
}

.language-selector:hover .dropdown-content {
    display: block;
}

.language-selector .dropdown-content a {
    color: black;
    padding: 8px 12px;
    text-decoration: none;
    display: block;
    text-align: left;
}

.language-selector .dropdown-content a:hover {
    background-color: #ddd;
}

.language-selector img {
    border-radius: 50%;
}

/* --- Chat Container --- */
.chat-container {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 0;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    position: relative;
    height: calc(100% - 140px);
    will-change: transform;
    overscroll-behavior: contain;
}

.message-wrapper {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* 默认左对齐 */
}

.message-wrapper.user-message {
    align-items: flex-end; /* 用户消息右对齐 */
}

.message-content{
    display: flex;
    align-items: flex-start;
    width: 100%;
}

.user-message .message-content{
    flex-direction: row-reverse;
}

.ai-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 10px;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.user-message .ai-avatar {
    margin-right: 0;
    margin-left: 10px;
}

.message {
    padding: 10px 15px;
    border-radius: 20px;
    word-wrap: break-word;
    max-width: 70%; /* 设置最大宽度 */
}

.ai-message {
    background-color: #fff;
    color: #333;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-top-left-radius: 0;
}

/*  不再为 .user-message 设置背景颜色 */
.user-message {
    color: white;
}

/* 新增的类，专门用于用户消息文本 */
.user-message-text {
    background-color: #007bff;
    color: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    border-top-right-radius: 0;
}

.message-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    margin-bottom: 15px;
}

.message-option {
    background-color: #fff;
    color: #444;
    border: 1px solid #ccc;
    border-radius: 20px;
    padding: 10px 18px;
    cursor: pointer;
    font-size: 0.95em;
    transition: background-color 0.2s, color 0.2s;
    white-space: nowrap; /* 防止选项文本换行 */
}

.message-option:hover, .message-option:active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

/* --- Input Area --- */
.input-area-wrapper {
    position: sticky;
    bottom: 0;
    background-color: #f0f0f0;
    border-top: none;
    box-shadow: none;
    z-index: 10;
    flex-shrink: 0;
    border-radius: 25px;
    padding: 10px 15px;
    margin: 0 10px 0px 10px;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

.input-area {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    position: relative;
}

.input-area input[type="text"] {
    flex-grow: 1;
    width: calc(100% - 40px);
    padding: 10px 15px;
    border: none;
    border-radius: 25px;
    font-size: 1em;
    outline: none;
    position: relative;
    background-color: #fff;
    padding-right: 40px;
}

.input-area {
    position: relative;
}

.send-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    pointer-events: auto;
    opacity: 0.5;
    cursor: pointer;
}
.input-area button {
    background-color: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    order: -1; /* 确保按钮在最左侧 */
}

.input-area button img {
    width: 20px;
    height: 20px;
    transition: opacity 0.2s;
    opacity: 0.3;
}

.input-area button:hover img{
    opacity: 0.7;
}

/* --- Timestamp --- */
.timestamp {
    font-size: 0.7em;
    color: #888;
    margin-top: 4px;
    text-align: left; /* AI 时间戳左对齐 */
}

.user-message .timestamp {
    text-align: right; /* 用户时间戳右对齐 */
    padding-right: 2ch;
}

/* --- Typing Indicator --- */
.typing-indicator {
    position: relative;
    bottom: 0;
    left: 0;
    font-size: 0.8em;
    color: #888;
}

.typing-indicator span {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #888;
    margin-right: 3px;
    animation: bounce 1.2s infinite;
}
/* 新增的样式，用于包裹 AI 消息和时间戳 */
.message-and-timestamp {
    display: flex;
    flex-direction: column; /* 垂直排列 */
    align-items: flex-start; /* 左对齐 */
}
.message-and-timestamp .timestamp{
    text-align: left;
    padding-left: 2ch;
}
/* --- Media Queries --- */
@media (max-width: 768px) {
    .message-option {
        flex-basis: calc(50% - 10px); /* 小屏幕上两列 */
        /* 移除 min-width */
    }
    .message {
        max-width: 85%;
    }
}

/* --- Keyframes for bounce animation --- */
@keyframes bounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-3px);
    }
}
/* 新增的样式，用于显示 "asksuite" 信息 */
.vbs-info {
    text-align: center;
    margin-top: 2px;
    margin-bottom: 0px;
    color: #aaa;
    font-size: 0.7em;
}
.vbs-info::before {
    content: "Powered By Vast Blue AI";
    vertical-align: middle;
}