/* 消息中心样式 - 参考bilibili站内信设计 */

/* 基础布局 */
.message-layout {
    display: flex;
    height: 100vh;
    background: #f4f5f7;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* 左侧边栏 */
.message-aside {
    width: 260px;
    background: #fff;
    border-right: 1px solid #e3e5e7;
    display: flex;
    flex-direction: column;
}

.message-sidebar {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.message-sidebar__title {
    display: flex;
    align-items: center;
    padding: 20px 16px;
    font-size: 18px;
    font-weight: 600;
    color: #18191c;
    border-bottom: 1px solid #e3e5e7;
}

.message-sidebar__icon {
    width: 24px;
    height: 24px;
    margin-right: 8px;
    color: #00a1d6;
}

.message-sidebar__interactions {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
    overflow-y: auto;
}

.message-sidebar__item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    position: relative;
}

.message-sidebar__item:hover {
    background-color: #f8f9fa;
}

.message-sidebar__item.is-active {
    background-color: #e8f4fd;
    color: #00a1d6;
}

.message-sidebar__item-icon {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.message-sidebar__item-icon.dot {
    width: 8px;
    height: 8px;
    background: #00a1d6;
    border-radius: 50%;
}

.message-sidebar__item-icon.reply {
    color: #fb7299;
}

.message-sidebar__item-icon.at {
    color: #00a1d6;
}

.message-sidebar__item-icon.like {
    color: #fb7299;
}

.message-sidebar__item-icon.system {
    color: #999;
}

.message-sidebar__item-name {
    font-size: 14px;
    color: #18191c;
    flex: 1;
}

.message-sidebar__item.is-active .message-sidebar__item-name {
    color: #00a1d6;
    font-weight: 500;
}

.message-sidebar__item-count {
    background: #fb7299;
    color: white;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    margin-left: 8px;
}

/* 主内容区域 */
.message-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
}

.whisper {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* 聊天容器 */
.im-container {
    display: flex;
    height: 100%;
}

.im-sidebar {
    width: 280px;
    background: #f8f9fa;
    border-right: 1px solid #e3e5e7;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
    color: #18191c;
    border-bottom: 1px solid #e3e5e7;
    background: #fff;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
}

.chat-list {
    padding: 8px 0;
}

.session-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    position: relative;
}

.session-item:hover {
    background-color: #f0f2f5;
}

.session-item.active {
    background-color: #e8f4fd;
}

.session-item.unread .session-name {
    font-weight: 600;
}

.session-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 12px;
    background: #e3e5e7;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 14px;
}

.session-info {
    flex: 1;
    min-width: 0;
}

.session-name {
    font-size: 14px;
    color: #18191c;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.session-last-message {
    font-size: 12px;
    color: #999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.session-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.session-time {
    font-size: 11px;
    color: #999;
}

.session-unread {
    background: #fb7299;
    color: white;
    font-size: 11px;
    padding: 2px 5px;
    border-radius: 8px;
    min-width: 16px;
    text-align: center;
}

.session-delete {
    position: absolute;
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
    background: #ff4757;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.session-item:hover .session-delete {
    opacity: 1;
}

.session-delete:hover {
    background: #ff3838;
}

/* 聊天窗口 */
.im-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.chat-window {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.chat-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e3e5e7;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header-info {
    display: flex;
    align-items: center;
}

.chat-header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    margin-right: 12px;
    background: #e3e5e7;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 14px;
}

.chat-header-name {
    font-size: 16px;
    font-weight: 600;
    color: #18191c;
}

.chat-header-status {
    font-size: 12px;
    color: #999;
    margin-top: 2px;
}

.chat-header-actions {
    display: flex;
    gap: 8px;
}

.chat-header-actions button {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.chat-header-actions button:hover {
    background: #f0f2f5;
    color: #00a1d6;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
}

.message-item {
    display: flex;
    margin-bottom: 20px;
    animation: messageSlideIn 0.3s ease;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-item.sent {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    margin: 0 12px;
    background: #e3e5e7;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 14px;
    flex-shrink: 0;
}

.message-content {
    max-width: 60%;
    display: flex;
    flex-direction: column;
}

.message-info {
    display: flex;
    align-items: center;
    margin-bottom: 4px;
    font-size: 12px;
    color: #999;
}

.message-item.sent .message-info {
    flex-direction: row-reverse;
}

.message-sender {
    font-weight: 500;
    color: #666;
}

.message-time {
    margin-left: 8px;
}

.message-item.sent .message-time {
    margin-left: 0;
    margin-right: 8px;
}

.message-bubble {
    background: #fff;
    padding: 10px 14px;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    word-wrap: break-word;
    line-height: 1.4;
}

.message-item.sent .message-bubble {
    background: #00a1d6;
    color: white;
}

.message-status {
    display: flex;
    align-items: center;
    margin-top: 4px;
    font-size: 12px;
    color: #999;
}

.message-item.sent .message-status {
    flex-direction: row-reverse;
}

.status-icon {
    margin-left: 4px;
}

.message-item.sent .status-icon {
    margin-left: 0;
    margin-right: 4px;
}

/* 输入区域 */
.chat-input-container {
    padding: 16px 20px;
    border-top: 1px solid #e3e5e7;
    background: #fff;
}

.chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.chat-input {
    flex: 1;
    min-height: 40px;
    max-height: 120px;
    padding: 10px 14px;
    border: 1px solid #e3e5e7;
    border-radius: 20px;
    outline: none;
    resize: none;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    transition: border-color 0.2s ease;
}

.chat-input:focus {
    border-color: #00a1d6;
}

.chat-input-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.char-count {
    font-size: 12px;
    color: #999;
}

.char-count.warning {
    color: #fb7299;
}

.send-btn {
    background: #00a1d6;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 8px 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.send-btn:hover:not(:disabled) {
    background: #0085b3;
    transform: translateY(-1px);
}

.send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.send-icon {
    width: 16px;
    height: 16px;
}

/* 空状态 */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
    text-align: center;
}

.empty-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-text {
    font-size: 16px;
    margin-bottom: 8px;
}

.empty-subtext {
    font-size: 14px;
    color: #bbb;
}

/* 加载状态 */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #999;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e3e5e7;
    border-top: 2px solid #00a1d6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .message-aside {
        width: 200px;
    }
    
    .im-sidebar {
        width: 240px;
    }
    
    .message-content {
        max-width: 80%;
    }
    
    .chat-input-wrapper {
        flex-direction: column;
        align-items: stretch;
    }
    
    .chat-input-actions {
        justify-content: space-between;
        margin-top: 8px;
    }
}

@media (max-width: 576px) {
    .message-layout {
        flex-direction: column;
    }
    
    .message-aside {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid #e3e5e7;
    }
    
    .message-sidebar__interactions {
        display: flex;
        overflow-x: auto;
        padding: 8px 0;
    }
    
    .message-sidebar__item {
        flex-shrink: 0;
        white-space: nowrap;
    }
    
    .im-container {
        flex-direction: column;
    }
    
    .im-sidebar {
        width: 100%;
        height: 200px;
        border-right: none;
        border-bottom: 1px solid #e3e5e7;
    }
    
    .message-content {
        max-width: 90%;
    }
}

/* 滚动条样式 */
.message-sidebar__interactions::-webkit-scrollbar,
.sidebar-content::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.message-sidebar__interactions::-webkit-scrollbar-track,
.sidebar-content::-webkit-scrollbar-track,
.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.message-sidebar__interactions::-webkit-scrollbar-thumb,
.sidebar-content::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}

.message-sidebar__interactions::-webkit-scrollbar-thumb:hover,
.sidebar-content::-webkit-scrollbar-thumb:hover,
.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #ccc;
}

/* 动画效果 */
.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.slide-up {
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* 消息类型样式 */
.system-message {
    text-align: center;
    margin: 16px 0;
}

.system-message .message-bubble {
    background: #f0f2f5;
    color: #666;
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 16px;
    display: inline-block;
}

/* 高亮效果 */
.highlight {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    padding: 2px 4px;
}

/* 打字状态 */
.typing-indicator {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    color: #999;
    font-size: 12px;
    font-style: italic;
}

.typing-dots {
    display: flex;
    gap: 2px;
    margin-left: 4px;
}

.typing-dot {
    width: 4px;
    height: 4px;
    background: #999;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}
