:root {
  --border-radius: 15px;
  --blur-amount: 10px;
  --primary-color: #4cd8b8;
  --primary-bg-color: rgba(76, 216, 184, 0.8);
  --secondary-bg-color: rgba(255, 255, 255, 0.8);
  --card-bg-color: rgba(255, 255, 255, 0.4);
  --text-color: #000;
  --text-light-color: #fff;
  --text-hover-color: #f8f9fa;
  --success-color: #28a745;
  --danger-color: #dc3545;
  --secondary-color: #6c757d;
  --received-message-bg: #ffffff;
  --sent-message-bg: #4cd8b8;
  --received-message-border: #e0e0e0;
  --sent-message-border: #4cd8b8;
  /* 滚动条颜色变量 */
  --scrollbar-thumb: #4cd8b8;
  --scrollbar-track: rgba(255, 255, 255, 0.3);
  --scrollbar-thumb-hover: #3ab09e;
}

/* 用户自定义主题色 - 通过JavaScript动态设置CSS变量来实现 */
[data-theme-color] {
  --primary-color: var(--user-theme-color, #4cd8b8);
  --primary-bg-color: var(--user-primary-bg-color, rgba(76, 216, 184, 0.8));
  --sent-message-bg: var(--user-theme-color, #4cd8b8);
  --sent-message-border: var(--user-theme-color, #4cd8b8);
  --scrollbar-thumb: var(--user-theme-color, #4cd8b8);
  --scrollbar-thumb-hover: var(--user-scrollbar-thumb-hover, #3ab09e);
}

/* 自定义滚动条样式 */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
  border-radius: 6px;
}

::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 6px;
  transition: background 0.3s ease;
  border: 2px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
  border: 2px solid transparent;
  background-clip: content-box;
}

/* Firefox滚动条样式 */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

* {
    border: none !important;
}

body {
    min-height: 100vh;
    background: url('/wp.jpg') no-repeat center center fixed;
    background-size: cover;
    padding-top: 56px;
}

.form-control {
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 20px;
}

.btn-login, .btn-register {
    background: var(--primary-color);
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-weight: bold;
}

.global-message {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1050;
    width: 300px;
    display: none;
}

/* 模态框遮罩 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    display: none;
}

/* 上传进度模态框遮罩 - 提高z-index使其显示在个人资料模态框之上 */
#uploadProgressModal .modal-overlay {
    z-index: 10050;
}

/* 模态框 */
.custom-modal {
    background: var(--secondary-bg-color);
    backdrop-filter: blur(var(--blur-amount));
    -webkit-backdrop-filter: blur(var(--blur-amount));
    border-radius: var(--border-radius);
    padding: 20px;
    min-width: 300px;
    max-width: 500px;
    position: relative;
}

/* Bootstrap模态框添加模糊效果 */
.modal-content {
    background: var(--secondary-bg-color);
    backdrop-filter: blur(var(--blur-amount));
    -webkit-backdrop-filter: blur(var(--blur-amount));
}

/* Bootstrap上传进度模态框特殊处理 - 提高z-index */
.modal#uploadProgressModal {
    z-index: 10060;
}

/* 模态框头部 */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.modal-title {
    font-size: 18px;
    font-weight: bold;
    margin: 0;
}

/* 模态框内容 */
.modal-body {
    margin-bottom: 20px;
    line-height: 1.5;
}

/* 模态框按钮容器 */
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* 按钮样式 */
.btn {
    background-color: var(--primary-color);
    transition: filter 0.2s ease;
}
.btn:hover {
    background-color: var(--primary-color);
    filter: brightness(0.9);
    transition: filter 0.2s ease;
}

.btn-modal {
    padding: 8px 16px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
}

.btn-modal-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-modal-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-modal-danger {
    background-color: var(--danger-color);
    color: white;
}

/* 用户状态样式 */
.status-active {
    background-color: var(--success-color); /* 绿色 */
    color: white;
}

.status-banned {
    background-color: var(--danger-color); /* 红色 */
    color: white;
}

/* 聊天界面样式 */
.chat-container { 
    height: calc(100vh - 140px); 
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(var(--blur-amount));
    -webkit-backdrop-filter: blur(var(--blur-amount));
    border-radius: var(--border-radius);
    margin-top: 0;
}
.chat-container-rapper {
    height: 100%;
}

.room-list { 
    height: calc(100vh - 210px); /* 减少高度以腾出空间给用户信息栏 */
    overflow-y: auto; 
    background: var(--card-bg-color);
    backdrop-filter: blur(var(--blur-amount));
    -webkit-backdrop-filter: blur(var(--blur-amount));
    border: none;
    border-radius: var(--border-radius);
    margin-top: -10px; /* 向上移动10像素 */
    display: flex;
    flex-direction: column;
}

/* 聊天室列表自定义滚动条 */
.room-list::-webkit-scrollbar {
  width: 8px;
}

.room-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.room-list::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 4px;
}

.room-list::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

.room-list .list-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
    width: 100%;
}

.chat-messages { 
    height: calc(100vh - 180px); 
    overflow-y: auto;
    padding: 15px;
}

/* 聊天消息区域自定义滚动条 */
.chat-messages::-webkit-scrollbar {
  width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

/* 调整聊天室名称位置，向右向下移动一点 */
#currentRoomName {
    margin-left: 10px;
    margin-top: 5px;
}

/* 调整成员按钮和设置按钮位置，向右向下移动一点 */
#membersBtn, #settingsBtn {
    margin-right: 5px;
    margin-top: 5px;
    background-color: var(--primary-color);
    border: none; /* 去掉边框 */
    color: white;
}

#membersBtn:hover, #settingsBtn:hover {
    filter: brightness(0.9);
}

/* 消息气泡样式 */
.message {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
}

.message-left {
    align-items: flex-start;
}

.message-right {
    align-items: flex-end;
}

.message-bubble-container {
    display: flex;
    max-width: 70%;
}

.message-left .message-bubble-container {
    flex-direction: row;
}

.message-right .message-bubble-container {
    flex-direction: row-reverse;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    align-self: flex-start; /* 修改此处，使头像始终在顶部 */
    margin: 0 10px;
}

.message-content {
    display: flex;
    flex-direction: column;
    flex: 1; /* 添加此属性使消息内容占据可用空间 */
    min-width: 0; /* 允许消息内容收缩以适应容器 */
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    margin: 5px 0;
    position: relative;
    word-wrap: break-word; /* 保持现有的换行设置 */
    word-break: break-word; /* 添加单词换行以处理长单词或URL */
    max-width: 100%;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

/* 接收到的消息气泡样式 */
.message-left .message-bubble {
    background-color: rgba(255, 255, 255, 0.6);
    color: #000;
    border: 1px solid var(--received-message-border);
    border-top-left-radius: 5px;
}

/* 发送的消息气泡样式 */
.message-right .message-bubble {
    background-color: rgba(76, 216, 184, 0.6);
    color: white;
    border: 1px solid var(--sent-message-border);
    border-top-right-radius: 5px;
}

.message-image, .message-video, .message-file {
    max-width: 200px;
    border-radius: 10px;
}

.message-file {
    padding: 10px;
    background-color: #e9ecef;
    border-radius: 10px;
}

.message-time {
    font-size: 0.7em;
    color: #999;
    text-align: center;
    margin: 5px 0;
    align-self: center;
}

.message-sender {
    font-size: 0.8em;
    font-weight: bold;
    margin-bottom: 3px;
}

.message-left .message-sender {
    color: var(--primary-color);
    align-self: flex-start;
}

.message-right .message-sender {
    color: var(--primary-color);
    align-self: flex-end;
}

/* 图片查看模态框样式 */
#imageModal .modal-content {
    background-color: rgba(0, 0, 0, 0.9);
    border: none;
    backdrop-filter: none;
}

#imageModal .modal-header {
    border: none;
    position: absolute;
    right: 1rem;
    z-index: 1050;
    padding: 1rem 1rem 0 0;
}

#imageModal .btn-close {
    filter: invert(1);
}

#fullScreenImage {
    transition: transform 0.2s ease;
    user-select: none;
}

/* 输入区域 */
.input-area { 
    height: 40px; 
}

/* 修复发送按钮和输入框不在同一直线的问题 */
.input-group > .btn, .input-group > .form-control, .input-group > .dropdown-toggle {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 确保按钮高度与输入框完全一致 */
.input-group > .btn, .input-group > .dropdown-toggle {
    padding: .375rem .75rem;
}

/* 为输入组中的按钮添加正确的圆角 */
.input-group > .btn:first-child {
    border-top-left-radius: 0.25rem !important;
    border-bottom-left-radius: 0.25rem !important;
}

.input-group > .btn:last-child {
    border-top-right-radius: 0.25rem !important;
    border-bottom-right-radius: 0.25rem !important;
}

/* 可复用的滚动条样式类 */
.custom-scrollbar::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 5px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 5px;
  transition: background 0.3s ease;
  border: 2px solid transparent;
  background-clip: content-box;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
  border: 2px solid transparent;
  background-clip: content-box;
}

/* Firefox */
.custom-scrollbar {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

/* 聊天室列表 */
.room-list .card-header {
    background-color: transparent !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    color: #000;
}

.room-list .card {
    background: var(--card-bg-color);
    backdrop-filter: blur(var(--blur-amount));
    -webkit-backdrop-filter: blur(var(--blur-amount));
    border: none;
    border-radius: 15px;
    transition: transform 0.3s ease;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
}

.room-list .card:hover {
    transform: translateY(-5px);
}

.room-list .card .card-body {
    flex: 1;
    overflow-y: auto;
}

/* 移除聊天室列表头部的蓝色背景，改为透明背景，文字颜色改为黑色 */
.room-list .card-header.bg-primary {
    background-color: transparent !important;
    border: none;
    color: var(--text-color);
}

.create-room-card {
    background: var(--card-bg-color);
    backdrop-filter: blur(var(--blur-amount));
    -webkit-backdrop-filter: blur(var(--blur-amount));
    border: none;
    border-radius: 15px;
}

.create-room-card .card-header {
    border-radius: var(--border-radius) var(--border-radius) 0 0 !important;
}

/* 聊天室列表项样式 */
#roomList .list-group-item {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border-radius: 10px !important;
    margin: 5px auto;
    border: none;
    transition: all 0.3s ease;
    width: fit-content;
    min-width: 85%;
    max-width: 95%;
    display: block;
    padding: 12px 15px;
    text-align: left;
    cursor: pointer;
}

#roomList .list-group-item:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

#roomList .list-group-item.active {
    background: var(--primary-color);
    color: var(--text-light-color);
}

#roomList .list-group-item.active .text-muted {
    color: var(--text-light-color);
    opacity: 0.7;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .room-list { 
        height: 100px; 
        margin-top: 0; /* 在小屏幕上也与用户信息卡片对齐 */
    }
    
    .custom-scrollbar::-webkit-scrollbar {
      width: 6px;
      height: 6px;
    }
    
    .custom-scrollbar::-webkit-scrollbar-thumb {
      border-radius: 3px;
      border: 1px solid transparent;
      background-clip: content-box;
    }
    
    .chat-container { 
        height: calc(100vh - 180px); 
        margin-top: 0; /* 在小屏幕上也与用户信息卡片对齐 */
    }
    .chat-messages { height: calc(100vh - 260px); }
    
    .profile-container {
        padding: 10px 5px; /* 在小屏幕上减小padding */
    }
    
    .login-container,
    .register-container {
        margin: 0 10px; /* 在小屏幕上添加边距 */
    }
    
    .message-bubble-container {
        max-width: 85%;
    }

    .message-bubble {
        padding: 8px 12px;
    }
}

.login-container {
    max-width: 500px;
    width: 100%;
    background: var(--card-bg-color);
    backdrop-filter: blur(var(--blur-amount));
    border-radius: var(--border-radius);
    overflow: hidden;
    margin: 0 auto;
}

.login-header {
    background: var(--primary-color);
    color: white;
    padding: 30px 20px 20px;
    text-align: center;
    border-bottom: 1px solid #eee;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.login-body {
    padding: 30px;
}

.input-group .form-control,
.input-group .input-group-text {
    height: calc(1.5em + 0.75rem + 2px);
    display: flex;
    align-items: center;
}

.register-link {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.register-container {
    max-width: 600px;
    width: 100%;
    background: var(--card-bg-color);
    backdrop-filter: blur(var(--blur-amount));
    border-radius: var(--border-radius);
    overflow: hidden;
    margin: 0 auto;
}

.register-header {
    background: var(--primary-color);
    color: white;
    padding: 30px 20px 20px;
    text-align: center;
    border-bottom: 1px solid #eee;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.register-body {
    padding: 30px;
}

/* 修复输入框和图标高度不一致的问题 */

.login-link {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    font-size: 0.9rem;
}

/* 个人资料页样式 - 仅在profile.html中使用 */

.profile-container {
    width: 100%;
    min-height: calc(100vh - 56px); /* 减去导航栏高度 */
    padding: 20px 15px; /* 添加左右padding */
    margin: 0; /* 移除默认margin */
    box-sizing: border-box; /* 确保padding包含在宽度内 */
}

.profile-card {
    background: var(--card-bg-color);
    backdrop-filter: blur(var(--blur-amount));
    -webkit-backdrop-filter: blur(var(--blur-amount));
    border: none;
    border-radius: 15px;
    height: 100%; /* 使卡片填满容器 */
}

.profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
}

/* 移除个人中心卡片头部的蓝色背景，改为透明背景，文字颜色改为黑色 */
.profile-card .card-header.bg-primary {
    background-color: transparent !important;
    border: none;
    color: var(--text-color);
}

/* 头像上传区域 */
.avatar-upload {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.avatar-upload img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #fff;
}

.change-avatar {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: var(--primary-color);
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.3s;
}

.change-avatar:hover {
    transform: scale(1.1);
    background: #0b5ed7;
}

/* 表单样式 */
.form-label {
    font-weight: 500;
    color: #333;
}

.form-control {
    background: var(--card-bg-color);
    border: 1px solid #ced4da;
    border-radius: 8px;
    padding: 10px 15px;
}

.form-control:focus {
    background: var(--card-bg-color);
    border-color: #86b7fe;
}

.card-header {
    border-radius: var(--border-radius) var(--border-radius) 0 0 !important;
}

/* 修复卡片背景不透明问题 */
.card {
    background: var(--card-bg-color);
    backdrop-filter: blur(var(--blur-amount));
    -webkit-backdrop-filter: blur(var(--blur-amount));
    border: none;
    border-radius: 15px;
}

/* 修复卡片头部消失问题 */
.card .card-header.bg-primary {
    background-color: transparent !important;
    border: none;
    color: var(--text-color);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .profile-container {
        padding: 10px 5px; /* 在小屏幕上减小padding */
    }
    
    .login-container,
    .register-container {
        margin: 0 10px; /* 在小屏幕上添加边距 */
    }
}

/* 自定义样式 */

.auth-section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    width: 100%;
    margin: 0;
    padding: 0;
}

.auth-section > .container-fluid {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 0;
    margin: 0;
}

.auth-section .row {
    flex: 1;
    width: 100%;
    margin: 0;
    justify-content: center;
    align-items: center;
}

.login-container,
.register-container {
    margin: auto;
}

.user-info-bar {
    background: var(--card-bg-color);
    backdrop-filter: blur(var(--blur-amount));
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    padding: 10px 15px;
    margin-bottom: 20px;
    height: 80px;
    margin-top: 0; /* 确保顶部没有额外边距 */
}

.user-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    cursor: pointer;
    border: 2px solid #fff;
}

.user-details {
    margin-left: 15px;
    flex-grow: 1;
}

.user-nickname {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 0;
}

.user-username {
    font-size: 0.9rem;
    color: #666;
}

.profile-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--card-bg-color);
    backdrop-filter: blur(var(--blur-amount));
    -webkit-backdrop-filter: blur(var(--blur-amount));
    border-radius: var(--border-radius);
    z-index: 10000;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    display: none;
}

.profile-popup-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.profile-popup-body {
    padding: 20px;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: none;
}

.switch-form {
    text-align: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

/* 自定义确认框和消息框样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    display: none;
}

.custom-modal {
    background: var(--secondary-bg-color);
    backdrop-filter: blur(var(--blur-amount));
    -webkit-backdrop-filter: blur(var(--blur-amount));
    border-radius: var(--border-radius);
    padding: 20px;
    min-width: 300px;
    max-width: 500px;
    position: relative;
}