/* 聊天室样式 - 改进版 */
:root {
    --primary-bg: #0c0614;
    --secondary-bg: #1a0b2e;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --primary-text: #ffffff;
    --secondary-text: #a0a0b9;
    --neon-purple: #9d4edd;
    --neon-purple-light: #c77dff;
    --neon-purple-dark: #7b2cbf;
    --neon-blue: #5a189a;
    --neon-pink: #ff00ff;
    --neon-green: #05ffa1;
    --neon-yellow: #ffff00;
    --neon-orange: #ff9900;
    
    --message-self-bg: rgba(157, 78, 221, 0.25);
    --message-other-bg: rgba(255, 255, 255, 0.08);
    --message-self-border: rgba(157, 78, 221, 0.5);
    --message-other-border: rgba(255, 255, 255, 0.15);
    --chat-input-bg: rgba(255, 255, 255, 0.07);
    --chat-input-border: rgba(255, 255, 255, 0.15);
    --send-button-bg: linear-gradient(135deg, var(--neon-purple), var(--neon-blue));
    --nickname-self-color: var(--neon-purple-light);
    --nickname-other-color: var(--neon-green);
    --timestamp-color: rgba(255, 255, 255, 0.5);
    
    --blur-amount: 10px;
    --border-radius: 12px;
    --box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* 聊天室区域 */
.chat-section {
    padding: 40px 0 80px;
    position: relative;
    z-index: 2;
}

.section-header {
    text-align: center;
    margin-bottom: 30px;
}

.section-title {
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: linear-gradient(to right, var(--neon-purple-light), var(--neon-pink));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 15px rgba(157, 78, 221, 0.5);
}

.section-desc {
    color: var(--secondary-text);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: 70vh;
    min-height: 500px;
    margin-bottom: 30px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(var(--blur-amount));
    -webkit-backdrop-filter: blur(var(--blur-amount));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    position: relative;
}

.chat-container::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, 
        var(--neon-purple) 0%, 
        transparent 20%, 
        transparent 80%, 
        var(--neon-blue) 100%);
    border-radius: calc(var(--border-radius) + 2px);
    z-index: -1;
    opacity: 0.5;
}

/* 聊天室头部 */
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
    border-top-left-radius: var(--border-radius);
    border-top-right-radius: var(--border-radius);
}

.chat-status {
    display: flex;
    align-items: center;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 10px;
}

.status-indicator.online {
    background-color: var(--neon-green);
    box-shadow: 0 0 10px var(--neon-green);
    animation: pulse 2s infinite;
}

.status-text {
    font-size: 1rem;
    color: var(--secondary-text);
    font-weight: 500;
}

.chat-actions {
    display: flex;
    gap: 15px;
}

.chat-action-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--secondary-text);
    font-size: 1rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-action-btn:hover {
    color: var(--primary-text);
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.chat-action-btn:active {
    transform: translateY(0);
}

/* 聊天消息区域 */
.chat-messages {
    flex: 1;
    padding: 25px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
    background: rgba(0, 0, 0, 0.1);
    background-image: 
        radial-gradient(rgba(157, 78, 221, 0.1) 1px, transparent 1px),
        radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 40px 40px;
    background-position: 0 0, 20px 20px;
}

.message-wrapper {
    display: flex;
    flex-direction: column;
    max-width: 75%;
    position: relative;
}

.message-wrapper.self {
    align-self: flex-end;
}

.message-wrapper.other {
    align-self: flex-start;
}

.message-bubble {
    padding: 14px 18px;
    border-radius: 18px;
    position: relative;
    word-break: break-word;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.message-wrapper.self .message-bubble {
    background: var(--message-self-bg);
    border: 1px solid var(--message-self-border);
    border-bottom-right-radius: 4px;
}

.message-wrapper.other .message-bubble {
    background: var(--message-other-bg);
    border: 1px solid var(--message-other-border);
    border-bottom-left-radius: 4px;
}

.message-wrapper:hover .message-bubble {
    transform: translateY(-2px);
}

.message-nickname {
    font-size: 0.9rem;
    font-weight: bold;
    margin-bottom: 6px;
}

.message-wrapper.self .message-nickname {
    color: var(--nickname-self-color);
}

.message-wrapper.other .message-nickname {
    color: var(--nickname-other-color);
}

.message-content {
    font-size: 1rem;
    line-height: 1.5;
    color: var(--primary-text);
}

.message-timestamp {
    font-size: 0.75rem;
    color: var(--timestamp-color);
    margin-top: 6px;
    align-self: flex-end;
}

.message-wrapper.self .message-timestamp {
    text-align: right;
    padding-right: 5px;
}

.message-wrapper.other .message-timestamp {
    padding-left: 5px;
}

/* 聊天输入区域 */
.chat-input-area {
    padding: 20px 25px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
    border-bottom-left-radius: var(--border-radius);
    border-bottom-right-radius: var(--border-radius);
}

.nickname-container {
    margin-bottom: 12px;
    position: relative;
}

.nickname-container::before {
    content: '昵称:';
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary-text);
    font-size: 0.9rem;
}

.chat-nickname {
    width: 100%;
    max-width: 250px;
    background: var(--chat-input-bg);
    border: 1px solid var(--chat-input-border);
    border-radius: 20px;
    padding: 10px 15px 10px 65px;
    color: var(--primary-text);
    font-size: 0.95rem;
    transition: var(--transition);
}

.chat-nickname:focus {
    border-color: var(--neon-purple);
    outline: none;
    box-shadow: 0 0 10px rgba(157, 78, 221, 0.3);
}

.message-container {
    display: flex;
    gap: 15px;
    position: relative;
}

.chat-input {
    flex: 1;
    background: var(--chat-input-bg);
    border: 1px solid var(--chat-input-border);
    border-radius: 22px;
    padding: 15px 20px;
    color: var(--primary-text);
    font-size: 1rem;
    resize: none;
    min-height: 55px;
    max-height: 120px;
    transition: var(--transition);
    line-height: 1.5;
}

.chat-input:focus {
    border-color: var(--neon-purple);
    outline: none;
    box-shadow: 0 0 15px rgba(157, 78, 221, 0.3);
}

.send-button {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background: var(--send-button-bg);
    border: none;
    color: white;
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: var(--transition);
    box-shadow: 0 0 15px rgba(157, 78, 221, 0.4);
    position: relative;
    overflow: hidden;
}

.send-button::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    transform: rotate(45deg);
    animation: shine 3s infinite;
}

.send-button:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 5px 20px rgba(157, 78, 221, 0.6);
}

.send-button:active {
    transform: scale(0.95);
}

/* 聊天室说明 */
.chat-info {
    padding: 30px;
    margin-top: 40px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(var(--blur-amount));
    -webkit-backdrop-filter: blur(var(--blur-amount));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    position: relative;
    overflow: hidden;
}

.chat-info::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(to right, var(--neon-purple), var(--neon-blue), var(--neon-pink));
}

.info-title {
    font-size: 1.4rem;
    margin-bottom: 20px;
    color: var(--primary-text);
    position: relative;
    display: inline-block;
}

.info-title::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 40px;
    height: 3px;
    background: var(--neon-purple);
    border-radius: 3px;
}

.info-content p {
    margin-bottom: 12px;
    color: var(--secondary-text);
    font-size: 1rem;
    line-height: 1.6;
    position: relative;
    padding-left: 20px;
}

.info-content p::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10px;
    width: 8px;
    height: 8px;
    background: var(--neon-purple);
    border-radius: 50%;
}

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

.chat-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
    background-clip: padding-box;
}

/* 消息动画 */
@keyframes message-appear {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-wrapper {
    animation: message-appear 0.3s ease-out;
}

/* 脉冲动画 */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(5, 255, 161, 0.7);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(5, 255, 161, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(5, 255, 161, 0);
    }
}

/* 发送按钮闪光效果 */
@keyframes shine {
    0% {
        left: -100%;
        top: -100%;
    }
    20%, 100% {
        left: 100%;
        top: 100%;
    }
}

/* 系统消息样式 */
.message-wrapper.system {
    align-self: center;
    max-width: 90%;
}

.message-wrapper.system .message-bubble {
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 8px 15px;
}

.message-wrapper.system .message-content {
    color: var(--secondary-text);
    font-size: 0.9rem;
    text-align: center;
}

/* 未读消息指示器 */
.new-messages-indicator {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: var(--neon-purple);
    color: white;
    border-radius: 20px;
    padding: 8px 15px;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(157, 78, 221, 0.5);
    display: none;
    align-items: center;
    gap: 8px;
    z-index: 10;
    animation: bounce 1s infinite alternate;
}

.new-messages-indicator.visible {
    display: flex;
}

.new-messages-indicator i {
    font-size: 0.8rem;
}

@keyframes bounce {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(-5px);
    }
}

/* 响应式设计 */
@media (max-width: 992px) {
    .section-title {
        font-size: 2.2rem;
    }
    
    .section-desc {
        font-size: 1rem;
    }
}

@media (max-width: 768px) {
    .chat-container {
        height: 75vh;
    }
    
    .message-wrapper {
        max-width: 85%;
    }
    
    .chat-header {
        padding: 15px 20px;
    }
    
    .chat-input-area {
        padding: 15px 20px;
    }
    
    .section-title {
        font-size: 2rem;
    }
}

@media (max-width: 576px) {
    .chat-messages {
        padding: 20px 15px;
    }
    
    .message-bubble {
        padding: 12px 15px;
    }
    
    .send-button {
        width: 50px;
        height: 50px;
    }
    
    .chat-nickname {
        max-width: 100%;
    }
    
    .section-title {
        font-size: 1.8rem;
    }
    
    .section-desc {
        font-size: 0.9rem;
    }
    
    .message-wrapper {
        max-width: 90%;
    }
}

/* 暗色主题增强 */
@media (prefers-color-scheme: dark) {
    .chat-container {
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    }
    
    .message-wrapper.self .message-bubble {
        box-shadow: 0 3px 10px rgba(157, 78, 221, 0.2);
    }
    
    .message-wrapper.other .message-bubble {
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
    }
}

/* 打字指示器 */
.typing-indicator {
    display: flex;
    align-items: center;
    margin-top: 5px;
    margin-bottom: 10px;
    padding-left: 15px;
    color: var(--secondary-text);
    font-size: 0.9rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.typing-indicator.visible {
    opacity: 1;
}

.typing-dots {
    display: flex;
    margin-left: 8px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--secondary-text);
    margin-right: 3px;
}

.typing-dot:nth-child(1) {
    animation: typingDot 1.4s infinite;
    animation-delay: 0s;
}

.typing-dot:nth-child(2) {
    animation: typingDot 1.4s infinite;
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation: typingDot 1.4s infinite;
    animation-delay: 0.4s;
}

@keyframes typingDot {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-5px);
    }
}
