/* 简易聊天室 CSS */

/* 全局样式重置和基础设置 */
.zibll-right-chat *, .zibll-right-chat *::before, .zibll-right-chat *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: inherit;
}

/* 悬浮按钮 - 支持Zibll主题的float-btn类 */
.zibll-right-chat-toggle {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 60px;
    height: 60px;
    background: #9c27b0;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(156, 39, 176, 0.3);
    transition: all 0.3s ease;
    z-index: 9998;
    opacity: 1;
}

.zibll-right-chat-toggle:hover {
    background: #8e24aa;
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(156, 39, 176, 0.4);
}

/* 支持Zibll主题的float-btn类的聊天室按钮 */
#zibll-right-chat-toggle.float-btn {
    position: relative;
    width: auto;
    height: auto;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    z-index: 9998;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

/* 日间模式下的悬浮按钮颜色 */
body:not(.dark-theme) #zibll-right-chat-toggle.float-btn {
    color: #333333;
}

/* 夜间模式下的悬浮按钮颜色 */
body.dark-theme #zibll-right-chat-toggle.float-btn {
    color: #ffffff;
}

#zibll-right-chat-toggle.float-btn:hover {
    background: rgba(156, 39, 176, 0.1);
    transform: none;
    box-shadow: none;
}

#zibll-right-chat-toggle.float-btn i {
    font-size: 20px;
    margin-right: 5px;
}

#zibll-right-chat-toggle.float-btn text {
    font-size: 14px;
    font-weight: 500;
}

/* 聊天窗口 - 核心样式 */
.zibll-right-chat {
    position: fixed;
    right: -350px;
    top: 0;
    width: 350px;
    height: 100vh;
    box-shadow: -3px 0 20px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    overflow: hidden;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

/* 日间模式下的聊天窗口样式 */
body:not(.dark-theme) .zibll-right-chat {
    background: #ffffff;
    color: #333333;
    border-left: 1px solid #e0e0e0;
}

/* 夜间模式下的聊天窗口样式 */
body.dark-theme .zibll-right-chat {
    background: #1e1e1e;
    color: #ffffff;
    border-left: 1px solid #333;
}

.zibll-right-chat.active {
    right: 0;
}

/* 聊天窗口头部 */
.zibll-right-chat-header {
    background: #9c27b0;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: none;
    min-height: 60px;
    flex-shrink: 0;
}

.zibll-right-chat-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: white;
}

.zibll-right-chat-close {
    color: white;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s ease;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zibll-right-chat-close:hover {
    opacity: 1;
}

/* 聊天内容区域 - 主要容器 */
.zibll-right-chat-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 60px);
}

/* 日间模式下的聊天内容区域样式 */
body:not(.dark-theme) .zibll-right-chat-content {
    background: #ffffff;
}

/* 夜间模式下的聊天内容区域样式 */
body.dark-theme .zibll-right-chat-content {
    background: #1e1e1e;
}

/* 消息列表 */
.zibll-right-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    min-height: 0;
}

/* 日间模式下的消息列表样式 */
body:not(.dark-theme) .zibll-right-chat-messages {
    background: #ffffff;
    color: #333333;
}

/* 夜间模式下的消息列表样式 */
body.dark-theme .zibll-right-chat-messages {
    background: #1e1e1e;
    color: #ffffff;
}

/* 消息项 */
.zibll-right-chat-message {
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.zibll-right-chat-message.myself {
    flex-direction: row-reverse;
}

/* 用户头像 */
.zibll-right-chat-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

/* 日间模式下的头像边框 */
body:not(.dark-theme) .zibll-right-chat-avatar {
    border: 2px solid #e0e0e0;
    background: #f5f5f5;
}

/* 夜间模式下的头像边框 */
body.dark-theme .zibll-right-chat-avatar {
    border: 2px solid #404040;
    background: #333;
}

.zibll-right-chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* 消息内容 */
.zibll-right-chat-message-content {
    max-width: 220px;
    padding: 12px 16px;
    border-radius: 18px;
    word-break: break-word;
    line-height: 1.5;
    position: relative;
}

/* 日间模式下的他人消息样式 */
body:not(.dark-theme) .zibll-right-chat-message:not(.myself) .zibll-right-chat-message-content {
    background: #f5f5f5;
    color: #333333;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 6px;
}

/* 夜间模式下的他人消息样式 */
body.dark-theme .zibll-right-chat-message:not(.myself) .zibll-right-chat-message-content {
    background: #2c2c2c;
    color: #ffffff;
    border: 1px solid #404040;
    border-bottom-left-radius: 6px;
}

/* 日间模式下的自己消息样式 */
body:not(.dark-theme) .zibll-right-chat-message.myself .zibll-right-chat-message-content {
    background: #9c27b0;
    color: white;
    border-bottom-right-radius: 6px;
}

/* 夜间模式下的自己消息样式 */
body.dark-theme .zibll-right-chat-message.myself .zibll-right-chat-message-content {
    background: #9c27b0;
    color: white;
    border-bottom-right-radius: 6px;
}

/* 消息头部 */
.zibll-right-chat-message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    font-size: 12px;
}

.zibll-right-chat-message:not(.myself) .zibll-right-chat-message-header {
    justify-content: flex-start;
}

.zibll-right-chat-message.myself .zibll-right-chat-message-header {
    justify-content: flex-end;
}

/* 用户名 */
.zibll-right-chat-username {
    font-weight: 600;
    color: #9c27b0;
}

.zibll-right-chat-message.myself .zibll-right-chat-username {
    color: rgba(255, 255, 255, 0.9);
}

/* 消息时间 */
.zibll-right-chat-time {
    opacity: 0.7;
}

/* 日间模式下的消息时间颜色 */
body:not(.dark-theme) .zibll-right-chat-time {
    color: #666666;
}

/* 夜间模式下的消息时间颜色 */
body.dark-theme .zibll-right-chat-time {
    color: #999999;
}

.zibll-right-chat-message.myself .zibll-right-chat-time {
    color: rgba(255, 255, 255, 0.7);
}

/* 消息内容文本 */
.zibll-right-chat-message-text {
    font-size: 14px;
}

/* 输入区域 - 核心样式 */
.zibll-right-chat-input-area {
    padding: 15px;
    border-top: 1px solid;
    flex-shrink: 0;
}

/* 日间模式下的输入区域样式 */
body:not(.dark-theme) .zibll-right-chat-input-area {
    background: #fafafa;
    border-top-color: #e0e0e0;
}

/* 夜间模式下的输入区域样式 */
body.dark-theme .zibll-right-chat-input-area {
    background: #2c2c2c;
    border-top-color: #404040;
}

/* 输入框容器 */
.input-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

/* 输入内容容器 */
.input-content-wrap {
    width: 100%;
}

/* 输入控制按钮 */
.input-control {
    display: flex;
    gap: 10px;
    margin-bottom: 5px;
}

.input-control-btn {
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    outline: none;
    box-shadow: none;
}

/* 日间模式下的输入控制按钮样式 */
body:not(.dark-theme) .input-control-btn {
    background: #e0e0e0;
    color: #333333;
}

body:not(.dark-theme) .input-control-btn:hover {
    background: #d0d0d0;
}

body:not(.dark-theme) .input-control-btn:active {
    background: #c0c0c0;
}

/* 夜间模式下的输入控制按钮样式 */
body.dark-theme .input-control-btn {
    background: #404040;
    color: #ffffff;
}

body.dark-theme .input-control-btn:hover {
    background: #505050;
}

body.dark-theme .input-control-btn:active {
    background: #606060;
}

/* 输入框 - 适配Zibll主题的input-content类 */
.input-content {
    width: 100%;
    padding: 15px;
    border: 1px solid;
    border-radius: 8px;
    resize: none;
    font-size: 14px;
    line-height: 1.5;
    outline: none;
    min-height: 80px;
    max-height: 160px;
    transition: all 0.2s ease;
    font-family: inherit;
}

/* 日间模式下的输入框样式 */
body:not(.dark-theme) .input-content {
    background: #ffffff;
    color: #333333;
    border-color: #e0e0e0;
}

body:not(.dark-theme) .input-content:focus {
    border-color: #9c27b0;
    box-shadow: 0 0 0 2px rgba(156, 39, 176, 0.2);
}

body:not(.dark-theme) .input-content::placeholder {
    color: #999999;
}

/* 夜间模式下的输入框样式 */
body.dark-theme .input-content {
    background: #3a3a3a;
    color: #ffffff;
    border-color: #404040;
}

body.dark-theme .input-content:focus {
    border-color: #9c27b0;
    box-shadow: 0 0 0 2px rgba(156, 39, 176, 0.2);
}

body.dark-theme .input-content::placeholder {
    color: #999999;
}

/* 发送按钮容器 */
.input-submit {
    display: flex;
    justify-content: flex-end;
    margin-top: 5px;
}

/* 发送按钮 - 适配Zibll主题的btn类 */
.btn {
    display: inline-block;
    font-weight: 400;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    user-select: none;
    border: 1px solid transparent;
    padding: 0.375rem 0.75rem;
    font-size: 14px;
    line-height: 1.5;
    border-radius: 0.25rem;
    transition: all 0.15s ease-in-out;
    cursor: pointer;
    outline: none;
    box-shadow: none;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 12px;
    line-height: 1.5;
    border-radius: 0.2rem;
}

.btn-primary {
    color: #fff;
    background-color: #9c27b0;
    border-color: #9c27b0;
}

.btn-primary:hover {
    color: #fff;
    background-color: #8e24aa;
    border-color: #852199;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(156, 39, 176, 0.4);
}

.btn-primary:active {
    color: #fff;
    background-color: #852199;
    border-color: #7b1fa2;
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 表情面板样式 */
.zibll-chat-smilies {
    border: 1px solid;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* 日间模式下的表情面板样式 */
body:not(.dark-theme) .zibll-chat-smilies {
    background: #ffffff;
    border-color: #e0e0e0;
}

/* 夜间模式下的表情面板样式 */
body.dark-theme .zibll-chat-smilies {
    background: #3a3a3a;
    border-color: #404040;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.smilies-content {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.smilies-item {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

/* 日间模式下的表情项样式 */
body:not(.dark-theme) .smilies-item {
    background: #f5f5f5;
}

body:not(.dark-theme) .smilies-item:hover {
    background: #e0e0e0;
    border-color: #9c27b0;
    transform: scale(1.1);
}

/* 夜间模式下的表情项样式 */
body.dark-theme .smilies-item {
    background: #404040;
}

body.dark-theme .smilies-item:hover {
    background: #505050;
    border-color: #9c27b0;
    transform: scale(1.1);
}

.smilies-item img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

/* 确保发送按钮的点击事件能够正常触发 */
#zibll-right-chat-send-btn {
    z-index: 100;
    position: relative;
}

/* 未登录提示 */
.zibll-right-chat-login {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 40px 20px;
}

/* 日间模式下的未登录提示样式 */
body:not(.dark-theme) .zibll-right-chat-login {
    background: #ffffff;
    color: #333333;
}

body:not(.dark-theme) .zibll-right-chat-login-icon {
    color: #9c27b0;
}

body:not(.dark-theme) .zibll-right-chat-login p {
    color: #666666;
}

/* 夜间模式下的未登录提示样式 */
body.dark-theme .zibll-right-chat-login {
    background: #1e1e1e;
    color: #ffffff;
}

body.dark-theme .zibll-right-chat-login-icon {
    color: #666666;
}

body.dark-theme .zibll-right-chat-login p {
    color: #999999;
}

.zibll-right-chat-login-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.zibll-right-chat-login p {
    font-size: 16px;
    margin-bottom: 24px;
}

.zibll-right-chat-login-btn {
    background: #9c27b0;
    color: white;
    padding: 12px 32px;
    border-radius: 24px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-block;
    box-shadow: 0 2px 8px rgba(156, 39, 176, 0.3);
}

.zibll-right-chat-login-btn:hover {
    background: #8e24aa;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(156, 39, 176, 0.4);
    color: white;
}

/* 滚动条样式 */
.zibll-right-chat-messages::-webkit-scrollbar {
    width: 6px;
}

/* 日间模式下的滚动条样式 */
body:not(.dark-theme) .zibll-right-chat-messages::-webkit-scrollbar-track {
    background: #f5f5f5;
    border-radius: 3px;
}

body:not(.dark-theme) .zibll-right-chat-messages::-webkit-scrollbar-thumb {
    background: #c0c0c0;
    border-radius: 3px;
    transition: background 0.2s ease;
}

body:not(.dark-theme) .zibll-right-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a0a0a0;
}

/* 夜间模式下的滚动条样式 */
body.dark-theme .zibll-right-chat-messages::-webkit-scrollbar-track {
    background: #2c2c2c;
    border-radius: 3px;
}

body.dark-theme .zibll-right-chat-messages::-webkit-scrollbar-thumb {
    background: #555555;
    border-radius: 3px;
    transition: background 0.2s ease;
}

body.dark-theme .zibll-right-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #777777;
}

/* 加载状态 */
.zibll-right-chat-loading {
    text-align: center;
    padding: 20px;
    font-size: 14px;
}

/* 日间模式下的加载状态颜色 */
body:not(.dark-theme) .zibll-right-chat-loading {
    color: #666666;
}

/* 夜间模式下的加载状态颜色 */
body.dark-theme .zibll-right-chat-loading {
    color: #999999;
}

/* 空消息提示 */
.zibll-right-chat-empty {
    text-align: center;
    padding: 40px 20px;
}

/* 日间模式下的空消息提示颜色 */
body:not(.dark-theme) .zibll-right-chat-empty {
    color: #666666;
}

/* 夜间模式下的空消息提示颜色 */
body.dark-theme .zibll-right-chat-empty {
    color: #999999;
}

.zibll-right-chat-empty p {
    margin: 0;
    font-size: 14px;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .zibll-right-chat {
        width: 100%;
        right: -100%;
    }
    
    .zibll-right-chat-toggle {
        width: 50px;
        height: 50px;
        font-size: 20px;
        right: 15px;
        bottom: 15px;
    }
    
    .zibll-right-chat-message-content {
        max-width: 200px;
    }
}
