/* Join Group Page Styles */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #f5f5f5;
}

.navbar {
    z-index: 1000;
}

/* Chat Area Styles */
.chat-area {
    position: relative;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 56px);
    background-color: #fff;
    overflow: hidden;
}

.chat-area.temp-user {
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1050;
    overflow: hidden;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0px 11px;
    height: 31px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.chat-header .d-flex.justify-content-between {
    width: auto;
}

/* 群名称和人数样式 */
.chat-header h5 {
    display: inline-block;
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 0;
    color: #2c3e50;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 70px; /* 为固定在底部的输入框留出空间 */
    background-color: #fff;
}

.chat-input {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    padding: 15px;
    border-top: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: white;
    z-index: 10;
    box-shadow: 0 -1px 5px rgba(0,0,0,0.05);
}

.chat-input textarea {
    flex: 1;
    font-size: 15px;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 20px;
    resize: none;
    height: 32px;
    max-height: 100px;
}

.chat-input .voice-btn {
    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;
}

.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;
}

/* Message Bubbles */
.message-container {
    display: flex;
    margin-bottom: 1rem;
    position: relative;
}

.message-bubble {
    max-width: 70%;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    position: relative;
}

.message-container.self {
    justify-content: flex-end;
}

.message-container.other {
    justify-content: flex-start;
}

.message-bubble.self {
    background-color: #d1e7ff;
    border-top-right-radius: 0;
}

.message-bubble.other {
    background-color: #f0f0f0;
    border-top-left-radius: 0;
}

.message-sender {
    font-size: 0.8rem;
    font-weight: bold;
    margin-bottom: 0.25rem;
}

.message-content {
    padding: 8px 16px;
    border-radius: 15px;
    background: #e3f2fd;
    font-size: 14px;
    word-break: break-word;
}

.message-bubble.sent .message-content {
    background: #2196f3;
    color: white;
}

.message .original-text {
    font-size: 14px;
}

.message.sent .original-text {
    color: rgba(255, 255, 255, 0.65);
}

.message .translated-text {
    font-size: 13px;
    color: #666;
    margin-top: 4px;
}

.message.sent .translated-text {
    color: white;
}

.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;
    color: #333;
}

.message-bubble.sent .message-content .english-translation {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
}

.message-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
    font-size: 11px;
    color: #888;
    width: 100%;
}

.message-time {
    font-size: 0.7rem;
    color: #777;
    text-align: right;
    margin-left: auto;
    order: 2; /* Ensures time appears second (right) */
}

.message-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    order: 1; /* Ensures actions appear first (left) */
    justify-content: flex-start;
}

.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;
}

.message-bubble.sent .message-time {
    color: rgba(255, 255, 255, 0.7);
}

/* System Messages */
.system-message {
    text-align: center;
    margin: 0.5rem 0;
    font-size: 0.8rem;
    color: #6c757d;
}

.system-message span {
    background-color: #f8f9fa;
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
}

/* Language Selector */
.language-selector {
    display: flex;
    align-items: center;
    padding: 4px 15px;
    background: transparent;
    margin-top: 0;
    margin-left: auto;
    justify-content: flex-end;
    width: auto;
}

.chat-language-selector {
    margin-top: 0.5rem;
    margin-left: auto;
}

.custom-select {
    position: relative;
    display: inline-block;
}

.lang-select {
    padding-right: 30px;
    appearance: none;
    background-color: #fff;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

.flag-icon {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 15px;
    pointer-events: none;
}

/* Group Members Modal Styles */
.group-members-list {
    max-height: 350px;
    overflow-y: auto;
    padding: 0.75rem;
    border-radius: 0.5rem;
    background-color: #f8f9fa;
    box-shadow: inset 0 0 8px rgba(0,0,0,0.05);
}

/* Ensure modal dialogs display on top of everything */
.modal-backdrop {
    z-index: 1050 !important;
}

.modal {
    z-index: 1060 !important;
}

/* Bootstrap's default z-index for modals is 1055 for backdrop and 1056 for the modal,
   but we're increasing it to ensure it's above the language selector and flags */
.modal-dialog {
    z-index: 1060 !important;
}

/* Make sure confirm dialogs and alerts appear on top of modals */
.swal2-container, 
.sweet-alert,
.bootbox,
.popover,
.toast,
.tooltip {
    z-index: 1070 !important;
}

/* Toast notification styles */
.toast-container {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    z-index: 9999 !important; /* Extremely high z-index to ensure notifications are visible */
    max-width: 350px;
}

.toast {
    background-color: rgba(0, 0, 0, 0.85) !important;
    color: white !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    margin-bottom: 10px !important;
    overflow: hidden !important;
    max-width: 350px !important;
}

.toast.bg-danger {
    background-color: rgba(220, 53, 69, 0.95) !important;
}

.toast.bg-success {
    background-color: rgba(70, 130, 180, 0.95) !important;
}

.toast.bg-info {
    background-color: rgba(23, 162, 184, 0.95) !important;
}

.toast.bg-warning {
    background-color: rgba(255, 193, 7, 0.95) !important;
    color: #212529 !important;
}

.toast-body {
    padding: 12px 15px !important;
    font-size: 14px !important;
}

.btn-close-white {
    filter: brightness(0) invert(1);
}

.member-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
    position: relative;
    background-color: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border-left: 3px solid transparent;
}

.member-item:hover {
    background-color: #f0f7ff;
    transform: translateY(-2px);
    box-shadow: 0 3px 5px rgba(0,0,0,0.08);
    border-left-color: #2196f3;
}

.member-item:last-child {
    margin-bottom: 0;
}

.member-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background-color: #2196f3;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 500;
    margin-right: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.member-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    width: calc(100% - 60px);
}

.member-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
    font-size: 15px;
    display: flex;
    align-items: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.member-type {
    font-size: 12px;
    color: #6c757d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Creator badge */
.member-badge {
    font-size: 9px;
    background-color: #ffc107;
    color: #212529;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 6px;
    font-weight: 600;
    flex-shrink: 0;
}

.member-badge.creator {
    background-color: #ffc107;
}

.member-badge.temporary {
    background-color: #6c757d;
    color: white;
}

/* Styles for temporary user's avatar */
.member-avatar.temporary {
    background-color: #6c757d;
}

/* Creator's avatar special style */
.member-avatar.creator {
    background-color: #fd7e14;
}

/* Responsive adjustments */
@media (max-width: 576px) {
    .chat-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 0px 10px;
        height: auto;
    }
    
    .language-selector {
        margin-top: 0.5rem;
        margin-left: 0;
        align-self: center;
    }
    
    .message-bubble {
        max-width: 85%;
    }
}

/* 欢迎消息样式 */
.chat-messages .text-center.py-4 {
    margin-top: 2rem;
}

.chat-messages .text-center.py-4 i {
    color: #adb5bd;
    margin-bottom: 1rem;
    display: block;
}

.chat-messages .text-center.py-4 p {
    margin-bottom: 0.5rem;
}

.chat-messages .text-center.py-4 p.small {
    font-size: 0.875rem;
    opacity: 0.8;
}