/* 通用样式 */
.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* 登录和注册页面样式 */
.auth-container {
    max-width: 400px;
    margin: 50px auto;
    padding: 20px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    border-radius: 5px;
}

.error-message {
    color: red;
    margin-top: 10px;
    display: none;
}

/* 聊天页面样式 */
.chat-container {
    display: flex;
    height: calc(100vh - 60px);
}

.user-list {
    width: 250px;
    border-right: 1px solid #ddd;
    overflow-y: auto;
}

.message-list {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.message-input {
    padding: 20px;
    border-top: 1px solid #ddd;
}

.message-input textarea {
    width: 100%;
    min-height: 32px;      /* 初始高度一行 */
    max-height: 128px;     /* 最大高度四行 */
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: none;          /* 禁用手动调整大小 */
    overflow-y: auto;      /* 超出时显示滚动条 */
    line-height: 1.5;      /* 行高 */
    font-size: 13px;
    box-sizing: border-box;
}

.message-input textarea::placeholder {
    color: #999;
    font-style: italic;
    font-size: 14px;
}

.message-bubble {
    margin: 10px 0;
    padding: 10px;
    border-radius: 10px;
    max-width: 70%;
}

.message-sent {
    background-color: #007bff;
    color: white;
    margin-left: auto;
}

.message-received {
    background-color: #f1f1f1;
    margin-right: auto;
}

/* 管理员页面样式 */
.admin-container {
    max-width: 800px;
    margin: 50px auto;
}

.user-card {
    margin-bottom: 20px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.approval-buttons {
    margin-top: 10px;
}

.language-selector {
    display: flex;
    align-items: center;
    background: #f8f9fa;
    border-radius: 8px;
    /* 移除了 padding: 0px 285px; */
}

.language-selector select,
.language-selector select option {
    font-size: 10px !important;
    font-family: Arial, sans-serif;
}

/* 美化下拉框样式 */
.custom-select {
    position: relative;
    width: 45px;
    height: 30px;
    background: white;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
}

.custom-select:hover {
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
}

/* 下拉选项样式 */
.custom-select select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background: transparent;
    border: none;
    border-radius: 6px;
    padding: 4px;
    color: #333;
}

.custom-select select option {
    background: white;
    color: #333;
    padding: 8px;
    border-radius: 4px;
}

.custom-select select option:hover {
    background-color: #f5f5f5;
}

/* 添加小箭头指示器 */
.custom-select::after {
    content: '';
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 3px solid transparent;
    border-right: 3px solid transparent;
    border-top: 3px solid #666;
    pointer-events: none;
}

.custom-select .lang-select {
    width: 100%;
    height: 100%;
    cursor: pointer;
    opacity: 0;
    position: relative;
    z-index: 2;
}

.custom-select .flag-icon {
    position: absolute;
    top: 50%;
    left: 40%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 16px;
    pointer-events: none;
    z-index: 1;
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.language-selector select option {
    text-align: center;
    padding: 5px;
}

/* 修改全局的 language-selector 样式，移除固定 padding */
.language-selector {
    display: flex;
    align-items: center;
    background: #f8f9fa;
    border-radius: 8px;
    /* 移除了 padding: 0px 285px; */
}

/* 为 voice-processor 页面添加特定类 */
.voice-processor-language-selector {
    /* 替换固定 padding 为更自适应的方式 */
    display: flex;
    justify-content: center;
    padding: 0px 10px;
    max-width: 100%;
}

/* 为 chat 页面添加特定类 */
.chat-language-selector {
    padding: 0px 0px;
}

.language-selector .form-select {
    width: auto;
    background-color: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 6px 28px 6px 12px;
    font-size: 14px;
    text-align: center;
}

.language-selector .fa-arrow-right {
    color: #2196f3;
    margin: 0 12px;
    font-size: 16px;
}

.flag-icon {
    width: 24px;
    height: 16px;
    object-fit: cover;
    vertical-align: middle;
}

.flag-select {
    position: relative;
    display: inline-block;
    width: 50px;
}

.flag-select .flag-icon,
.flag-option {
    width: 24px;
    height: 16px;
    object-fit: cover;
}

.flag-select .flag-icon {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
}

.flag-select .form-select {
    width: 100%;
    height: 34px;
    opacity: 0;
    cursor: pointer;
}

/* 下拉选项中的国旗样式 */
.flag-select .form-select option {
    padding: 5px;
    text-align: center;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 24px 16px;
}

.selected-flag {
    padding: 5px;
    text-align: center;
}

.selected-flag img {
    width: 24px;
    height: 16px;
}

.flag-options {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    z-index: 1000;
}

.custom-select:hover .flag-options {
    display: block;
}

.flag-option {
    padding: 5px;
    text-align: center;
}

.flag-option:hover {
    background-color: #f5f5f5;
}

.flag-option img {
    width: 24px;
    height: 16px;
}

.chat-layout {
    display: flex;
    height: calc(100vh - 35px);
    background: #f0f2f5;
}

/* 左侧好友列表 */
.friends-sidebar {
    position: relative;
    width: 256px;
    height: calc(108% - 56px);
    transition: left 0.3s ease, width 0.3s ease;
    background: white;
    z-index: 1000;
    border-right: 1px solid #ddd;
}

/* 隐藏状态 */
.friends-sidebar.collapsed {
    width: 0;
    overflow: hidden;
    border-right: none;
}

/* 侧边栏切换按钮 - 显示在所有设备上 */
#sidebarToggle {
    display: block;
    cursor: pointer;
}

.friends-header {
    padding: 0px;
    height: 31px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    padding-left: 74px;
    font-weight: bold;
}

.add-friend {
    padding: 10px;
    border-bottom: 1px solid #eee;
}

.friends-list {
    overflow-y: auto;
    max-height: calc(100% - 120px); /* 减去头部和添加好友区域的高度 */
    padding: 5px;
    -webkit-overflow-scrolling: touch; /* 为iOS设备添加惯性滚动 */
    scroll-behavior: smooth;
}

.empty-friends-list {
    padding: 20px 10px;
    text-align: center;
    color: #6c757d;
}

.empty-friends-list i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-friends-list p {
    margin-bottom: 0.5rem;
}

.friend-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 0.875rem;
}

.friend-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.online-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
    display: inline-block;
}

.online-status.online {
    background-color: #28a745;  /* 绿色表示在线 */
}

.online-status.offline {
    background-color: #6c757d;  /* 灰色表示离线 */
}

.unread-badge {
    position: absolute;
    right: 10px;
    background-color: #ff4444;
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 12px;
    display: none;
    z-index: 1;
    min-width: 20px;
    text-align: center;
}

.friend-item:hover {
    background: #f5f5f5;
}

.friend-item.active {
    background: #e3f2fd;
}

.bg-dark {
    padding: 0px;
    --bs-bg-opacity: 1;
    background-color: rgba(var(--bs-dark-rgb), var(--bs-bg-opacity)) !important;
}

/* 右侧聊天区域 */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    transition: margin-left 0.3s ease;
}

/* 当侧边栏隐藏时，聊天区域占据更多空间 */
.chat-area.expanded {
    margin-left: 0;
}

.chat-header {
    padding: 0px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.message {
    position: relative;
    margin: -5px 0;
    padding: 8px 12px;
    border-radius: 12px;
    max-width: 65%;
}

/* LTR布局（默认） */
.message.sent {
    margin-left: auto;
    margin-right: 0;
}

.message.received {
    margin-left: 0;
    margin-right: auto;
}

/* RTL布局 */
.chat-area.rtl .message.sent {
    margin-right: 0;
    margin-left: auto;
}

.chat-area.rtl .message.received {
    margin-right: auto;
    margin-left: 0;
}

/* RTL布局下的消息内容和时间 */
.chat-area.rtl .message-content,
.chat-area.rtl .message-meta {
    direction: rtl;
    text-align: right;
}

.chat-area.rtl .message-time {
    direction: rtl;
    text-align: right;
}

.message-content {
    padding: 8px 16px;
    border-radius: 15px;
    background: #e3f2fd;
    font-size: 14px;
    word-break: break-word;
}

.message.sent .message-content,
.message-bubble.sent .message-content {
    background: #2196f3;
    color: white;
}

.message .original-text,
.message-bubble .original-text {
    font-size: 14px;
}

.message.sent .original-text,
.message-bubble.sent .original-text {
    color: rgba(255, 255, 255, 0.65);
}

.message .translated-text,
.message-bubble .translated-text {
    font-size: 13px;
    color: #666;
    margin-top: 4px;
}

.message.sent .translated-text,
.message-bubble.sent .translated-text {
    color: white;
}

.message.received .message-content {
    background: #f1f1f1;
}

.message.received .original-text,
.message.received .translated-text {
    color: #333;
}

.chat-input {
    padding: 15px;
    border-top: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-input textarea {
    flex: 1;
    font-size: 15px;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 20px;
    resize: none;
    height: 32px;
}

/* 统一按钮基础样式 */
.chat-input button {
    font-size: 15px;
    padding: 6px;
    border-radius: 4px;
    height: 32px;
    width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

/* 录音按钮样式 */
.voice-btn {
    background-color: #fff;
    border: 1px solid #6c757d;
    color: #6c757d;
    padding: 0 !important;
}

.voice-btn:hover:not(:disabled) {
    background-color: #6c757d;
    color: #fff;
}

/* 发送按钮特殊样式 */
.chat-input .btn-primary.voice-btn {
    background-color: #2196f3;
    border-color: #2196f3;
    color: white;
}

.chat-input .btn-primary.voice-btn:hover:not(:disabled) {
    background-color: #1976d2;
    border-color: #1976d2;
}

/* 禁用状态统一样式 */
.chat-input button:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.chat-input .btn-primary.voice-btn:disabled {
    background-color: #2196f3;
    border-color: #2196f3;
}

/* 图标大小统一 */
.chat-input button i {
    font-size: 12px;
}

/* 消息状态样式 */
.message-status {
    font-size: 12px;
    margin-top: 4px;
}

.message.sent .message-status {
    text-align: right;
    color: #78909c;
}

.status-sending {
    color: #78909c;
}

.status-sent {
    color: #4caf50;
}

.status-error {
    color: #f44336;
}

/* 好友请求样式 */
.friend-requests {
    padding: 10px;
    border-bottom: 1px solid #eee;
    max-height: 200px;
    overflow-y: auto;
}

.friend-request {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    animation: slideIn 0.3s ease;
}

.request-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.request-time {
    font-size: 12px;
    color: #666;
}

.request-actions {
    display: flex;
    gap: 8px;
}

.request-actions button {
    padding: 4px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.request-actions button:first-child {
    background: #4caf50;
    color: white;
}

.request-actions button:last-child {
    background: #f44336;
    color: white;
}

@keyframes slideIn {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* 消息已读状态样式 */
.message-status {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
}

.message-status i {
    font-size: 14px;
}

.status-read {
    color: #2196f3;
}

.status-unread {
    color: #9e9e9e;
}

/* 通知动画 */
@keyframes notification {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.new-notification {
    animation: notification 0.5s ease;
}

/* 提示框样式 */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 24px;
    border-radius: 4px;
    color: white;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.error {
    background: #f44336;
}

.toast.success {
    background: #4caf50;
}

.toast.info {
    background-color: #17a2b8;
    color: white;
    border-radius: 4px;
    padding: 12px 24px;
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.toast.info.show {
    opacity: 1;
}

/* 禁用状态的按钮样式 */
button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 好友请求样式补充 */
.no-requests {
    text-align: center;
    color: #666;
    padding: 10px;
    font-size: 14px;
}

.request-user {
    display: flex;
    flex-direction: column;
}

.btn-accept {
    background: #4caf50;
    color: white;
}

.btn-reject {
    background: #f44336;
    color: white;
}

.request-time {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

/* 在现有样式中添加 */
.friend-request-entry {
    background: white;
    transition: background-color 0.2s;
}

.friend-request-entry:hover {
    background: #f5f5f5;
}

.friend-request-entry i {
    margin-right: 8px;
    color: #2196f3;
}

/* 禁用状态样式 */
.chat-input textarea:disabled {
    background-color: #f8f9fa;
    cursor: not-allowed;
}

.btn-primary:disabled {
    font-size: 13px;
    background-color: #a8c7f0;
    border-color: #a8c7f0;
    cursor: not-allowed;
}

/* 当前聊天用户标题样式 */
#currentChatUser {
    font-size: 0.9rem;
    color: #2c3e50;
    font-weight: 500;
    margin-left: 25px;
}

/* 未选择好友时的提示样式 */
#currentChatUser.no-friend {
    color: #6c757d;
    font-style: italic;
}

/* 移动端侧边栏样式 */
@media (max-width: 768px) {
    /* 调整移动端侧边栏切换按钮位置，让它更靠近后退按钮 */
    #sidebarToggle {
        margin-right: 17.25rem !important;
        margin-left: -0.5rem !important;
    }
    
    /* 确保后退按钮的边距保持正常 */
    #backButton {
        margin-right: 0.125rem !important; /* 进一步减少右边距 */
    }
    
    .friends-sidebar {
        position: fixed;
        left: -250px;
        top: 41px;
        bottom: 0;
        width: 250px;
        z-index: 1030;
        transition: left 0.3s ease;
        background-color: white;
        border-right: 1px solid #ddd;
        height: calc(100% - 56px);
        display: flex;
        flex-direction: column;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    }
    
    .friends-sidebar .friends-list {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch; /* 为iOS设备提供流畅滚动 */
        max-height: none; /* 移动端使用flex布局，不需要固定高度 */
        overscroll-behavior: contain; /* 防止滚动穿透 */
    }
    
    .friends-sidebar.show {
        left: 0;
        box-shadow: 2px 0 5px rgba(0,0,0,0.2);
    }
    
    /* 添加一个遮罩层，当侧边栏打开时显示 */
    .sidebar-backdrop {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0,0,0,0.5);
        z-index: 1020;
    }
    
    .sidebar-backdrop.show {
        display: block;
    }

    .friend-item {
        padding: 15px;  /* 增加点击区域 */
    }

    .unread-badge {
        right: 15px;    /* 调整位置 */
        padding: 3px 8px; /* 略微增大尺寸 */
        font-size: 13px;  /* 增大字体 */
    }

    /* 确保在移动端列表项有足够的空间显示未读标记 */
    .friend-info {
        max-width: calc(100% - 40px);  /* 给未读标记留出空间 */
    }

    .chat-input {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        background: white;
        padding: 10px;
        box-shadow: 0 -2px 5px rgba(0,0,0,0.1);
        transition: bottom 0.3s;
    }
    
    /* 为iOS虚拟键盘处理添加的类 */
    .chat-input.keyboard-open {
        position: absolute;
        bottom: auto;
    }
    
    /* 确保消息区域不被输入框遮挡 */
    .chat-messages {
        padding-bottom: 70px;
    }
}

/* 确保在桌面端正常显示 */
@media (min-width: 769px) {
    .friends-sidebar {
        position: relative;
        left: 0;
    }

    #sidebarToggle {
        display: block; /* 确保在桌面端显示切换按钮 */
        cursor: pointer;
    }
}

/* 语言选择器样式补充 */
.lang-select {
    padding: 5px 25px 5px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    appearance: none;
}

/* 确保下拉选项在选择框下方显示而不覆盖选择框本身 */
.lang-select option {
    margin-top: 30px; /* 确保选项在选择框下方 */
    padding: 8px;
    background-color: white;
    color: #333;
}

/* 添加更高权重的样式来防止被覆盖 */
.lang-select option,
select.lang-select option,
.custom-select select.lang-select option {
    margin-top: 30px !important; 
    padding: 8px !important;
    background-color: white !important;
    color: #333 !important;
    position: relative !important;
    z-index: 9999 !important;
    transform: translateY(30px) !important;
}

/* 移动端适配补充 */
@media (max-width: 768px) {
    .language-selector {
        flex-wrap: wrap;
        justify-content: center;
    }

    .custom-select {
        margin: 5px 0;
    }
    
    /* 针对 voice processor 页面的语言选择器特别优化 */
    .voice-processor-language-selector {
        padding: 0px 5px;
    }
    
    .voice-processor-language-selector .custom-select {
        margin: 5px 10px;
    }
    
    /* 保持箭头水平方向 */
    .language-selector .fa-arrow-right {
        transform: none;
        margin: 0 10px;
    }
}

/* RTL 语言支持 */
.rtl-text {
    direction: rtl;
    text-align: right;
}

/* 聊天消息 RTL 支持 */
.message.rtl .message-content {
    direction: rtl;
    text-align: right;
}

.message.rtl .original-text,
.message.rtl .translated-text {
    direction: rtl;
    text-align: right;
}

/* 输入框 RTL 支持 */
.chat-input textarea.rtl {
    direction: rtl;
    text-align: right;
}

/* 语言选择器 RTL 支持 */
.language-selector[data-rtl="true"] {
    flex-direction: row-reverse;
}

.message .translated-text {
    font-size: 13px;
    color: #666;
    margin-top: 4px;
}

.message .original-text {
    font-size: 14px;
}

/* 添加一个侧边栏切换按钮的悬停效果 */
#sidebarToggle:hover {
    opacity: 0.8;
}

/* 侧边栏切换按钮的活动状态 */
#sidebarToggle:active {
    opacity: 0.6;
}

.navbar-brand {
    padding-top: .3125rem;
    padding-bottom: .3125rem;
    margin-right: 0rem;
    font-size: 1.15rem;
    text-decoration: none;
    white-space: nowrap;
}

/* 添加复制按钮样式 */
.translation-content {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.message-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
    font-size: 11px;
    color: #888;
    width: 100%;
}

.message-actions {
    display: flex;
    align-items: center;
    gap: 4px;  /* 添加统一的间距 */
    flex-wrap: wrap;  /* 在小屏幕上允许换行 */
}

.copy-btn, .tts-btn, .trans-en-btn, .download-tts-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;  /* 确保图标按钮有最小宽度 */
}

/* 确保下载按钮和翻译按钮在同一行上 */
.trans-en-btn + .download-tts-btn {
    margin-left: 2px;
}

/* 为移动设备优化按钮点击区域 */
@media (max-width: 576px) {
    .copy-btn, .tts-btn, .trans-en-btn, .download-tts-btn {
        padding: 4px 8px;  /* 增大移动设备上的点击区域 */
    }
}

.message-time {
    margin-left: auto;  /* Pushes time to the right */
    order: 2; /* Ensures time appears second (right) */
    text-align: right;
}

.copy-btn, .tts-btn {
    background: none;
    border: none;
    color: #6c757d;
    padding: 2px 4px;
    cursor: pointer;
    font-size: 12px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.copy-btn:hover, .tts-btn:hover {
    opacity: 1;
    color: #0d6efd;
}

/* 英语翻译按钮特殊样式 */
.trans-en-btn {
    background: none;
    border: none;
    border-radius: 3px;
    color: #333;
    padding: 2px 6px;
    margin-left: 4px;
    cursor: pointer;
    font-size: 10px;
    font-weight: bold;
    opacity: 0.85;
    transition: all 0.2s;
}

.trans-en-btn:hover {
    opacity: 1;
    color: #0d6efd;
}

.trans-en-btn.active {
    background: #2196f3;
    color: white;
}

.trans-en-btn.loading {
    color: #888;
    cursor: default;
}

/* 下载TTS按钮样式 */
.download-tts-btn {
    background: none;
    border: none;
    border-radius: 3px;
    color: #333;
    padding: 2px 6px;
    margin-left: 4px;
    cursor: pointer;
    font-size: 10px;
    opacity: 0.85;
    transition: all 0.2s;
}

.download-tts-btn:hover {
    opacity: 1;
    color: #0d6efd;
}

.download-tts-btn:disabled {
    color: #888;
    cursor: default;
}

/* 英语翻译结果区域 */
.english-translation {
    margin-top: 8px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 6px;
    border-left: 3px solid #2196f3;
    font-size: 13px;
}

.message.sent .english-translation,
.message-bubble.sent .english-translation {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
}

.eng-trans-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.eng-trans-label {
    font-weight: bold;
    font-size: 11px;
    color: #2196f3;
}

.eng-trans-text {
    font-size: 13px;
    line-height: 1.4;
}

.copy-btn-en {
    background: none;
    border: none;
    color: #6c757d;
    padding: 0 4px;
    cursor: pointer;
    font-size: 11px;
    opacity: 0.7;
}

.copy-btn-en:hover {
    opacity: 1;
    color: #0d6efd;
}

.message-time {
    margin-left: auto;  /* 将时间推到右边 */
}

/* 确保语言选择器中的元素不会翻转 */
.language-selector select,
.language-selector .swap-btn,
.language-selector .flag-icon {
    direction: ltr !important;
}

/* 如果有 RTL 相关的样式，确保它们不会影响语言选择器 */
[data-rtl="true"] .language-selector {
    direction: ltr !important;
}

/* 修改自动语音开关的样式 */
.auto-voice-switch {
    display: flex;
    align-items: center;
    margin-right: 20px;  /* 移除右边距 */
    margin-left: auto; /* 将元素推到右侧 */
    padding-left: 0px; /* 添加左侧内边距 */
}

.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
    margin-left: 8px; /* 改为左边距 */
    margin-right: 0;  /* 移除右边距 */
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #2196F3;
}

input:checked + .slider:before {
    transform: translateX(20px);
}

.switch-label {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
}

/* 确保工具图标在任何设备上都保持圆形 */
.tool-icon {
    width: 50px;
    height: 50px;
    min-width: 50px;
    min-height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    margin-right: 15px;
    font-size: 20px;
    aspect-ratio: 1 / 1;
}

/* 移动设备上确保工具图标不变形 */
@media (max-width: 768px) {
    .tool-icon {
        width: 45px;
        height: 45px;
        min-width: 45px;
        min-height: 45px;
        margin-right: 10px;
        flex-shrink: 0;
    }
}

.tts-btn.playing {
    color: #0d6efd;
    opacity: 1;
}

.tts-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 视频处理页面特定样式 */
.text-content .loading-indicator {
    color: #6c757d;
    opacity: 0.7;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100px;
    font-style: italic;
}

.text-content .loading-indicator i {
    margin-right: 10px;
    color: #4a76a8;
}

.text-content .translation-error {
    color: #dc3545;
    font-style: italic;
    padding: 10px;
    border-left: 3px solid #dc3545;
    background-color: rgba(220, 53, 69, 0.05);
    border-radius: 4px;
}

.text-content .no-text {
    color: #6c757d;
    font-style: italic;
    text-align: center;
    padding: 30px 0;
}

/* 时间戳特殊样式 */
.timestamp {
    display: inline-block;
    min-width: 80px;
    color: #6c757d;
    font-family: monospace;
    background-color: #f8f9fa;
    border-radius: 3px;
    padding: 0 5px;
    margin-right: 5px;
    user-select: all;
    font-size: 0.85em;
}

/* 按钮禁用状态 */
.action-btn:disabled {
    opacity: 0.5;
    pointer-events: none;
    transform: none;
    box-shadow: none;
}

/* 点击状态 */
.action-btn.active {
    background-color: #f0f7ff;
    border-color: #2196f3;
    color: #2196f3;
}

/* 按钮悬停提示 */
[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 100;
    pointer-events: none;
}

/* 翻译中状态 */
.text-section.translating .text-section-header {
    background: linear-gradient(135deg, #f0f7ff 0%, #e4f1ff 100%);
}

.text-section.translating .text-section-title {
    color: #2196f3;
}

.text-section.translating .text-section-title i {
    animation: pulse 1.5s infinite;
}

/* 翻译错误状态 */
.text-section.translation-failed .text-section-header {
    background: linear-gradient(135deg, #fff5f5 0%, #ffe0e0 100%);
}

.text-section.translation-failed .text-section-title {
    color: #dc3545;
}

/* 加载指示器的脉冲动画 */
@keyframes pulse {
    0% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0.6;
    }
}

/* 翻译完成后的短暂高亮效果 */
@keyframes highlight {
    0% {
        background-color: rgba(33, 150, 243, 0.1);
    }
    100% {
        background-color: transparent;
    }
}

.text-content.highlight {
    animation: highlight 1.5s ease-out;
}

/* 时间戳的样式优化 */
.text-content br {
    margin-bottom: 8px;
    display: block;
    content: "";
}

.text-content .timestamp {
    transition: background-color 0.2s;
}

.text-content .timestamp:hover {
    background-color: #e9ecef;
    cursor: pointer;
}

/* 个人资料页面优化样式 */
.profile-body {
    background-color: #f8f9fa;
    color: #333;
}

.profile-container {    
    max-width: 900px;
    margin: 30px auto;
    padding: 0;
}

.profile-card {
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 0 20px rgba(0,0,0,0.08);
    overflow: hidden;
}

.profile-tabs {
    padding: 0 15px;
    border-bottom: none;
    background-color: #f8f9fa;
}

.profile-tabs .nav-link {
    color: #6c757d;
    border: none;
    border-radius: 0;
    padding: 15px 20px;
    transition: all 0.2s ease;
    position: relative;
    font-weight: 500;
}

.profile-tabs .nav-link:hover {
    color: #4a76a8;
    background-color: rgba(74, 118, 168, 0.05);
}

.profile-tabs .nav-link.active {
    color: #4a76a8;
    background-color: #fff;
    border-bottom: 3px solid #4a76a8;
}

.profile-tabs .nav-link.active:after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 3px;
}

.profile-tab-content {
    padding: 30px;
}

.profile-avatar-section {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    background-color: #e9ecef;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 50px;
    color: #6c757d;
    border: 4px solid #f8f9fa;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.profile-form .form-label {
    font-weight: 500;
    color: #495057;
}

.profile-form .input-group-text {
    background-color: #f8f9fa;
    border-color: #ced4da;
    color: #6c757d;
}

.profile-save-btn {
    background-color: #4a76a8;
    border-color: #4a76a8;
    padding: 10px 20px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.profile-save-btn:hover {
    background-color: #395d8a;
    border-color: #395d8a;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.profile-save-btn:active {
    transform: translateY(0);
}

/* Token 卡片样式优化 */
.token-usage-title {
    color: #4a76a8;
    font-weight: 600;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.token-section-title {
    color: #495057;
    font-weight: 500;
    margin: 25px 0 15px;
}

.token-card {
    background-color: #fff;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid #eaeaea;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.token-card:hover {
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

.token-card.total-tokens {
    background: linear-gradient(135deg, #f0f7ff 0%, #e3f2fd 100%);
    border-color: #d0e8fd;
}

.token-card-header {
    font-size: 18px;
    font-weight: 600;
    color: #4a76a8;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.token-title {
    font-size: 14px;
    color: #6c757d;
    margin-bottom: 5px;
}

.token-value {
    font-size: 28px;
    font-weight: 700;
    color: #4a76a8;
    margin-bottom: 10px;
}

.token-card.total-tokens .token-value {
    color: #2c5282;
}

.token-loading {
    padding: 30px;
    background-color: rgba(255,255,255,0.8);
    border-radius: 8px;
}

.token-empty-alert {
    background-color: #f0f7ff;
    border-color: #d0e8fd;
    color: #4a76a8;
    font-weight: 500;
}

.token-usage-cards {
    margin-bottom: 30px;
}

.token-usage-detail {
    background-color: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.token-table-container {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 0 10px rgba(0,0,0,0.05);
}

.token-table {
    margin-bottom: 0;
}

.token-table thead th {
    background-color: #f8f9fa;
    color: #495057;
    font-weight: 600;
    border-top: none;
    padding: 12px 15px;
}

.token-table tbody td {
    padding: 12px 15px;
    vertical-align: middle;
}

.load-more-btn {
    padding: 8px 20px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.load-more-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.service-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 30px;
    font-size: 12px;
    font-weight: 500;
    text-align: center;
}

.service-badge.translation {
    background-color: #e3f2fd;
    color: #1976d2;
}

.service-badge.tts {
    background-color: #e8f5e9;
    color: #388e3c;
}

.service-badge.speech {
    background-color: #fff3e0;
    color: #f57c00;
}

/* Toast 通知样式 */
.profile-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    background-color: #fff;
    color: #333;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1050;
    transform: translateY(-20px);
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 350px;
}

.profile-toast.show {
    transform: translateY(0);
    opacity: 1;
}

.profile-toast.success {
    border-left: 4px solid #4caf50;
}

.profile-toast.error {
    border-left: 4px solid #f44336;
}

.profile-toast.info {
    border-left: 4px solid #2196f3;
}

.toast-content {
    display: flex;
    align-items: center;
}

.toast-content i {
    margin-right: 10px;
    font-size: 20px;
}

.toast-content i.fa-check-circle {
    color: #4caf50;
}

.toast-content i.fa-exclamation-circle {
    color: #f44336;
}

/* 移动设备优化 */
@media (max-width: 768px) {
    .profile-container {
        margin: 0;
        max-width: 100%;
    }
    
    .profile-card {
        border-radius: 0;
        box-shadow: none;
    }
    
    .profile-tab-content {
        padding: 20px 15px;
    }
    
    .token-card {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .token-value {
        font-size: 24px;
    }
    
    .profile-toast {
        left: 20px;
        right: 20px;
        max-width: none;
    }
    
    .token-usage-detail {
        padding: 15px;
    }
    
    .token-table thead th, 
    .token-table tbody td {
        padding: 10px;
    }
}

/* 导航栏按钮样式优化 */
.navbar .nav-link {
    position: relative;
    padding: 8px 16px;
    margin: 0 2px;
    color: rgba(255, 255, 255, 0.85);
    border-radius: 4px;
    transition: all 0.2s ease;
}

.navbar .nav-link:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.navbar .nav-link.active {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.15);
}

.navbar .nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background-color: #ffffff;
    transform: translateX(-50%);
    transition: width 0.2s ease;
}

.navbar .nav-link:hover::after {
    width: 80%;
}

.navbar .nav-link.active::after {
    width: 100%;
}

/* 导航栏按钮组 */
.navbar-nav {
    display: flex;
    align-items: center;
}

/* 导航栏的登出按钮 */
.navbar .btn-outline-light {
    border-width: 1.5px;
    border-radius: 6px;
    padding: 6px 16px;
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    box-shadow: 0 0 0 rgba(255, 255, 255, 0);
}

.navbar .btn-outline-light:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    background-color: #ffffff;
    color: #343a40;
}

.navbar .btn-outline-light:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* 移动端下拉菜单样式优化 */
.dropdown-menu-dark {
    background-color: #2c3136;
    border: none;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    padding: 8px 0;
    margin-top: 8px;
}

.dropdown-menu-dark .dropdown-item {
    color: rgba(255, 255, 255, 0.85);
    padding: 10px 15px;
    border-radius: 4px;
    margin: 2px 5px;
    transition: all 0.2s ease;
}

.dropdown-menu-dark .dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.dropdown-menu-dark .dropdown-item i {
    width: 20px;
    text-align: center;
    margin-right: 8px;
    opacity: 0.8;
}

.dropdown-menu-dark .dropdown-item:hover i {
    opacity: 1;
}

.dropdown-menu-dark .dropdown-divider {
    opacity: 0.2;
    margin: 5px 5px;
}

/* 移动端菜单按钮 */
#mobileMenuButton {
    border-radius: 6px;
    padding: 5px 10px;
    transition: all 0.2s ease;
}

#mobileMenuButton:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

#mobileMenuButton i {
    transition: transform 0.2s ease;
}

#mobileMenuButton[aria-expanded="true"] i {
    transform: rotate(180deg);
}

/* 后退按钮样式 */
.btn-link.text-light {
    position: relative;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
    background-color: transparent;
}

.btn-link.text-light:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateX(-2px);
}

.btn-link.text-light:active {
    transform: translateX(0);
}

.btn-link.text-light i {
    font-size: 16px;
}

/* 移动下拉菜单中的登出按钮 */
.dropdown-menu-dark .dropdown-item[onclick*="logout"],
.dropdown-menu-dark #mobileLogoutButton {
    color: #ff7676;
    font-weight: 500;
}

.dropdown-menu-dark .dropdown-item[onclick*="logout"]:hover,
.dropdown-menu-dark #mobileLogoutButton:hover {
    background-color: rgba(255, 118, 118, 0.15);
}

.dropdown-menu-dark .dropdown-item[onclick*="logout"] i,
.dropdown-menu-dark #mobileLogoutButton i {
    color: #ff7676;
}

/* 移动导航栏中的用户图标效果 */
.dropdown-menu-dark .dropdown-item i.fa-user {
    color: #63cdff;
}

/* 群组图标效果 */
.dropdown-menu-dark .dropdown-item i.fa-users {
    color: #72da7b;
}

/* 工具图标效果 */
.dropdown-menu-dark .dropdown-item i.fa-tools {
    color: #ffc107;
}

/* 桌面导航栏的导航按钮组动画效果 */
@media (min-width: 992px) {
    .navbar-nav .nav-link {
        position: relative;
        padding: 6px 15px;
        margin: 0 3px;
        overflow: hidden;
    }
    
    .navbar-nav .nav-link:before {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 2px;
        background-color: #ffffff;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .navbar-nav .nav-link:hover:before {
        transform: translateX(0);
    }
}

/* Main navigation buttons styling */
.navbar .nav-item .nav-link {
    padding: 8px 15px;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-weight: 500;
    margin: 0 2px;
}

/* User button styling */
.navbar .nav-item .nav-link.user-btn {
    color: #63cdff;
}

.navbar .nav-item .nav-link.user-btn:hover {
    background-color: rgba(99, 205, 255, 0.15);
}

/* Group button styling */
.navbar .nav-item .nav-link.group-btn {
    color: #72da7b;
}

.navbar .nav-item .nav-link.group-btn:hover {
    background-color: rgba(114, 218, 123, 0.15);
}

/* Utils button styling */
.navbar .nav-item .nav-link.utils-btn {
    color: #ffc107;
}

.navbar .nav-item .nav-link.utils-btn:hover {
    background-color: rgba(255, 193, 7, 0.15);
}

/* Logout button styling */
.navbar .nav-item .nav-link.logout-btn,
.navbar .navbar-nav a[onclick*="logout"] {
    color: #ff7676;
}

.navbar .nav-item .nav-link.logout-btn:hover,
.navbar .navbar-nav a[onclick*="logout"]:hover {
    background-color: rgba(255, 118, 118, 0.15);
}

/* Active state for all nav buttons */
.navbar .nav-item .nav-link.active {
    background-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.1);
}

/* Style for the prompt button - base style already applied inline in HTML, adding active state here */
#contextPromptBtn.has-prompt {
    border-color: var(--bs-primary); /* Or use --bs-warning for yellow */
    /* color: var(--bs-primary); Optional: change icon/border color */
    box-shadow: 0 0 5px rgba(var(--bs-primary-rgb), 0.5);
}

#contextPromptBtn.has-prompt i {
    color: var(--bs-warning); /* Make the bulb yellow when active */
}

/* 减小导航栏字体大小 */
.navbar .container-fluid .navbar-brand {
    font-size: 1.15rem;  /* 原始为1.25rem，减小0.1rem */
}

.navbar .container-fluid .nav-link,
.navbar .container-fluid .btn,
.navbar .container-fluid .dropdown-item,
.navbar .container-fluid #currentUserDisplay,
.navbar .container-fluid #currentUserDisplayMobile,
.navbar .container-fluid span.nav-link,
.navbar .container-fluid .btn-outline-light {
    font-size: 0.875rem;  /* 原始约为1rem，减小0.125rem */
}

/* 确保下拉菜单中的图标与文本对齐 */
.navbar .dropdown-item i {
    font-size: 0.875rem;
    width: 1.25em;
    text-align: center;
}

/* 减小导航栏和好友列表相关字体大小 */
.navbar .container-fluid .navbar-brand {
    font-size: 1.15rem;  /* 原始为1.25rem，减小0.1rem */
}

.navbar .container-fluid .nav-link,
.navbar .container-fluid .btn,
.navbar .container-fluid .dropdown-item,
.navbar .container-fluid #currentUserDisplay,
.navbar .container-fluid #currentUserDisplayMobile,
.navbar .container-fluid span.nav-link,
.navbar .container-fluid .btn-outline-light {
    font-size: 0.875rem;  /* 原始约为1rem，减小0.125rem */
}

/* 减小朋友列表中的用户名称字体大小 */
.friend-item {
    font-size: 0.875rem !important;
}

/* 减小输入框placeholder文字大小 */
.add-friend input::placeholder,
.add-friend input {
    font-size: 0.875rem !important;
}

/* 减小侧边栏标题和好友请求相关字体大小 */
.friends-header h5 {
    font-size: 0.95rem !important;
    margin-bottom: 0;
}

/* 调整好友请求入口字体大小 */
.friend-request-entry span {
    font-size: 0.875rem !important;
}

/* 调整好友名称字体大小 */
.friend-info .friend-name {
    font-size: 0.875rem !important;
    font-weight: 500;
    margin-bottom: 2px;
}

/* 为固定页脚添加底部间距 - 所有带beian页脚的页面通用样式 */
html, body {
    margin: 0;
    padding: 0;
}

/* 只为有固定页脚的页面添加底部间距，防止内容被页脚遮挡 */
body {
    padding-bottom: 40px;
}

/* 移动端适配 */
@media (max-width: 768px) {
    body {
        padding-bottom: 45px;
    }
}