/* 群聊页面样式 */
.group-container {
    max-width: 1000px;
    margin: 80px auto 20px;
    padding: 0 20px;
    height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
    position: relative;
}

/* 在线状态栏 */
.online-bar {
    background: rgba(30, 30, 50, 0.9);
    border: 1px solid var(--border-color);
    border-radius: 12px 12px 0 0;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.online-indicator {
    width: 10px;
    height: 10px;
    background: #4ade80;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.online-bar strong {
    color: var(--primary-color);
}

.group-controls {
    margin-left: auto;
}

/* 聊天区域 */
.chat-area {
    flex: 1;
    background: rgba(20, 20, 35, 0.95);
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    overflow: hidden;
}

.messages-container {
    height: 100%;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.loading-messages {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px;
}

/* 消息样式 */
.message {
    display: flex;
    gap: 12px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    flex-shrink: 0;
    cursor: pointer;
    transition: transform 0.2s;
}

.message-avatar:hover {
    transform: scale(1.1);
}

.message-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.message-content {
    flex: 1;
    min-width: 0;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.message-username {
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
}

.message-username:hover {
    color: var(--primary-color);
}

.message-username.admin {
    color: #ff6b6b;
}

.message-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    background: linear-gradient(135deg, #ff6b6b, #9b59b6);
}

.message-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.message-text {
    background: rgba(60, 60, 100, 0.5);
    padding: 10px 14px;
    border-radius: 0 12px 12px 12px;
    word-wrap: break-word;
    line-height: 1.5;
}

.message-image {
    max-width: 300px;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s;
}

.message-image:hover {
    transform: scale(1.02);
}

.message-voice {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(60, 60, 100, 0.5);
    padding: 10px 14px;
    border-radius: 12px;
    cursor: pointer;
}

.message-voice svg {
    width: 24px;
    height: 24px;
}

.message-voice.playing svg {
    color: var(--primary-color);
}

/* 管理员消息操作 */
.message-actions {
    opacity: 0;
    transition: opacity 0.2s;
}

.message:hover .message-actions {
    opacity: 1;
}

.message-actions button {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    font-size: 12px;
}

.message-actions button:hover {
    color: #ff6b6b;
}

/* 禁言提示 */
.mute-notice {
    background: rgba(255, 107, 107, 0.2);
    border: 1px solid rgba(255, 107, 107, 0.5);
    color: #ff6b6b;
    padding: 10px 20px;
    text-align: center;
}

/* 输入区域 */
.input-area {
    background: rgba(30, 30, 50, 0.9);
    border: 1px solid var(--border-color);
    border-radius: 0 0 12px 12px;
    padding: 15px;
}

.input-tools {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.tool-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(60, 60, 100, 0.5);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.tool-btn:hover {
    background: var(--primary-color);
    color: white;
}

.tool-btn.recording {
    background: #ff6b6b;
    color: white;
    animation: recording 1s infinite;
}

@keyframes recording {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.tool-btn svg {
    width: 20px;
    height: 20px;
}

.input-wrapper {
    display: flex;
    gap: 10px;
}

.input-wrapper input {
    flex: 1;
    background: rgba(60, 60, 100, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 14px;
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.send-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

/* 语音频道按钮 */
.voice-channel-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-left: auto;
    margin-right: 10px;
}

.voice-channel-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.voice-channel-btn.active {
    background: linear-gradient(135deg, #22c55e, #16a34a);
}

.voice-channel-btn svg {
    width: 16px;
    height: 16px;
}

.voice-count {
    background: rgba(255, 255, 255, 0.25);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
}

/* 语音频道面板 */
.voice-panel {
    position: absolute;
    top: 60px;
    right: 20px;
    width: 300px;
    background: rgba(30, 30, 50, 0.98);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 100;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.voice-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

.voice-panel-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 16px;
    color: var(--text-primary);
}

.voice-panel-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    transition: color 0.2s;
}

.voice-panel-close:hover {
    color: var(--text-primary);
}

.voice-channel-info {
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
}

.voice-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: rgba(100, 100, 130, 0.3);
    border-radius: 12px;
    font-size: 13px;
    color: var(--text-secondary);
}

.voice-status.connected {
    background: rgba(74, 222, 128, 0.2);
    color: #4ade80;
}

.voice-status.connected::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

/* 语音用户列表 */
.voice-users {
    max-height: 250px;
    overflow-y: auto;
    padding: 10px;
}

.voice-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(60, 60, 100, 0.3);
    border-radius: 8px;
    margin-bottom: 8px;
    transition: background 0.2s;
}

.voice-user:hover {
    background: rgba(60, 60, 100, 0.5);
}

.voice-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    position: relative;
    overflow: hidden;
}

.voice-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.voice-user-avatar.speaking {
    box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.6);
    animation: speaking 0.5s infinite alternate;
}

@keyframes speaking {
    from { box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.4); }
    to { box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.7); }
}

.voice-user-info {
    flex: 1;
}

.voice-user-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.voice-user-name.admin {
    color: #ff6b6b;
}

.voice-user-status {
    font-size: 12px;
    color: var(--text-secondary);
}

.voice-user-muted {
    color: #ff6b6b;
}

.voice-user-muted svg {
    width: 16px;
    height: 16px;
}

/* 语音控制按钮 */
.voice-controls {
    display: flex;
    gap: 10px;
    padding: 15px;
    border-top: 1px solid var(--border-color);
}

.voice-control-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 15px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.voice-control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.voice-control-btn.danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.voice-control-btn.danger:hover {
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

.voice-control-btn.muted {
    background: rgba(100, 100, 130, 0.5);
}

.voice-control-btn svg {
    width: 18px;
    height: 18px;
}

/* 无用户提示 */
.voice-empty {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-secondary);
}

.voice-empty svg {
    width: 48px;
    height: 48px;
    opacity: 0.5;
    margin-bottom: 10px;
}

/* 用户菜单 */
.user-menu {
    position: fixed;
    top: 70px;
    right: 20px;
    background: rgba(30, 30, 50, 0.98);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    z-index: 1000;
    min-width: 150px;
}

.user-menu a {
    display: block;
    padding: 12px 20px;
    color: var(--text-primary);
    transition: background 0.2s;
}

.user-menu a:hover {
    background: rgba(139, 92, 246, 0.2);
}

/* 用户头像 */
.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    overflow: hidden;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 个人资料模态框 */
.profile-modal {
    max-width: 400px;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: bold;
    overflow: hidden;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-info h2 {
    margin: 0 0 5px;
    font-size: 24px;
}

.profile-badge {
    display: inline-block;
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 4px;
    background: linear-gradient(135deg, #ff6b6b, #9b59b6);
    margin-bottom: 5px;
}

.profile-id {
    color: var(--text-secondary);
    font-size: 14px;
}

.profile-bio {
    margin-bottom: 20px;
}

.profile-bio label {
    display: block;
    color: var(--text-secondary);
    font-size: 12px;
    margin-bottom: 5px;
}

.profile-bio p {
    background: rgba(60, 60, 100, 0.3);
    padding: 12px;
    border-radius: 8px;
    margin: 0;
}

.profile-stats {
    display: flex;
    gap: 30px;
    padding: 15px 0;
    border-top: 1px solid var(--border-color);
    margin-bottom: 15px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.profile-actions {
    display: flex;
    gap: 10px;
}

/* 头像上传 */
.avatar-upload {
    display: flex;
    align-items: center;
    gap: 20px;
}

.avatar-preview {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: bold;
    overflow: hidden;
}

.avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 响应式 */
@media (max-width: 768px) {
    .group-container {
        margin-top: 100px;
        padding: 0 8px;
        height: calc(100vh - 110px);
    }
    
    .group-header {
        padding: 10px 12px;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .group-header h1 {
        font-size: 1.1rem;
        width: 100%;
    }
    
    .online-count {
        font-size: 0.8rem;
    }
    
    .admin-controls {
        width: 100%;
        justify-content: center;
    }
    
    .messages-container {
        padding: 10px;
    }
    
    .message {
        gap: 8px;
    }
    
    .message-avatar {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
    
    .message-username {
        font-size: 0.85rem;
    }
    
    .message-text {
        font-size: 0.9rem;
    }
    
    .message-image {
        max-width: 200px;
    }
    
    .input-area {
        padding: 10px;
        flex-direction: column;
        gap: 8px;
    }
    
    .input-tools {
        width: 100%;
        justify-content: flex-start;
        gap: 8px;
    }
    
    .message-input {
        width: 100%;
    }
    
    .btn-send {
        width: 100%;
        justify-content: center;
    }
    
    /* 模态框 */
    .modal-content {
        width: 95%;
        padding: 15px;
        max-height: 85vh;
    }
    
    .profile-header {
        flex-direction: column;
        text-align: center;
    }
    
    .profile-avatar {
        margin: 0 auto;
    }
    
    .profile-stats {
        justify-content: center;
        gap: 20px;
    }
    
    .profile-actions {
        justify-content: center;
    }
    
    .avatar-upload {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .group-container {
        margin-top: 90px;
        padding: 0 5px;
    }
    
    .group-header {
        padding: 8px 10px;
    }
    
    .group-header h1 {
        font-size: 1rem;
    }
    
    .messages-container {
        padding: 8px;
    }
    
    .message-avatar {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }
    
    .message-text {
        font-size: 0.85rem;
    }
    
    .message-time {
        font-size: 10px;
    }
    
    .message-image {
        max-width: 150px;
    }
    
    .message-voice {
        min-width: 100px;
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .input-tools button {
        padding: 8px;
    }
    
    .user-avatar {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
    
    .user-name {
        display: none;
    }
}
