/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    height: 100vh;
    overflow: hidden;
}

#app {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 认证容器 */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-box {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.auth-box h1 {
    text-align: center;
    margin-bottom: 2rem;
    color: #333;
    font-size: 1.8rem;
}

.auth-box h1 i {
    color: #667eea;
    margin-right: 0.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #555;
    font-weight: 500;
}

.form-group label i {
    margin-right: 0.5rem;
    color: #667eea;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: #667eea;
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background: #5a6fd8;
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.btn-icon {
    background: none;
    border: none;
    padding: 0.5rem;
    color: #666;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.3s;
}

.btn-icon:hover {
    background: #f0f0f0;
    color: #667eea;
}

.auth-links {
    text-align: center;
    margin-top: 1rem;
}

.auth-links a {
    color: #667eea;
    text-decoration: none;
    font-size: 0.9rem;
}

.auth-links a:hover {
    text-decoration: underline;
}

/* 聊天容器 */
#chat-container {
    display: flex;
    height: 100vh;
}

/* 侧边栏 */
#sidebar {
    width: 320px;
    background: white;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
}

/* 用户信息 */
#user-info {
    padding: 1rem;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-details {
    flex: 1;
}

.username {
    font-weight: 600;
    color: #333;
}

.user-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #666;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-indicator.online {
    background: #4caf50;
}

.status-indicator.offline {
    background: #9e9e9e;
}

.status-indicator.busy {
    background: #f44336;
}

.status-indicator.away {
    background: #ff9800;
}

.user-actions {
    display: flex;
    gap: 0.25rem;
}

/* 导航标签 */
#nav-tabs {
    display: flex;
    border-bottom: 1px solid #e0e0e0;
}

.nav-tab {
    flex: 1;
    padding: 1rem 0.5rem;
    border: none;
    background: none;
    cursor: pointer;
    transition: all 0.3s;
    color: #666;
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.nav-tab.active {
    color: #667eea;
    border-bottom: 2px solid #667eea;
}

.nav-tab:hover {
    background: #f8f8f8;
}

.nav-tab i {
    font-size: 1.1rem;
}

/* 搜索框 */
#search-box {
    padding: 1rem;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    gap: 0.5rem;
}

#search-input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 0.9rem;
}

#search-input:focus {
    outline: none;
    border-color: #667eea;
}

/* 标签内容 */
.tab-content {
    flex: 1;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.tab-content.active {
    display: flex;
}

.section-header {
    padding: 1rem;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-title {
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
}

/* 聊天列表 */
.chat-items {
    flex: 1;
    overflow-y: auto;
}

.chat-item {
    padding: 1rem;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.chat-item:hover {
    background: #f8f8f8;
}

.chat-item.active {
    background: #e8eaf6;
    border-left: 3px solid #667eea;
}

.chat-item-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.chat-item-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-item-info {
    flex: 1;
    min-width: 0;
}

.chat-item-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item-message {
    color: #666;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item-time {
    color: #999;
    font-size: 0.75rem;
}

.chat-item-badge {
    background: #f44336;
    color: white;
    font-size: 0.75rem;
    padding: 0.125rem 0.375rem;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* 好友申请 */
.friend-requests {
    padding: 1rem;
    border-bottom: 1px solid #e0e0e0;
}

.friend-request-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: #fff3e0;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.friend-request-info {
    flex: 1;
}

.friend-request-name {
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
}

.friend-request-message {
    color: #666;
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.friend-request-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-small {
    padding: 0.25rem 0.75rem;
    font-size: 0.85rem;
    border-radius: 15px;
    border: 1px solid #ddd;
    background: white;
    color: #666;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-small:hover {
    border-color: #667eea;
    color: #667eea;
}

.btn-small.btn-accept {
    background: #4caf50;
    color: white;
    border-color: #4caf50;
}

.btn-small.btn-accept:hover {
    background: #45a049;
}

.btn-small.btn-reject {
    background: #f44336;
    color: white;
    border-color: #f44336;
}

.btn-small.btn-reject:hover {
    background: #da190b;
}

/* 通讯录 */
.contacts {
    flex: 1;
    overflow-y: auto;
}

.contact-group {
    margin-bottom: 1rem;
}

.contact-group-title {
    padding: 0.5rem 1rem;
    background: #f5f5f5;
    font-size: 0.85rem;
    color: #666;
    font-weight: 600;
    border-bottom: 1px solid #e0e0e0;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.3s;
}

.contact-item:hover {
    background: #f8f8f8;
}

.contact-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
}

.contact-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.contact-info {
    flex: 1;
}

.contact-name {
    font-weight: 600;
    color: #333;
}

.contact-signature {
    color: #666;
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* 群组列表 */
.group-items {
    flex: 1;
    overflow-y: auto;
}

.group-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.3s;
}

.group-item:hover {
    background: #f8f8f8;
}

.group-avatar {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

.group-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.group-info {
    flex: 1;
    min-width: 0;
}

.group-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.group-desc {
    color: #666;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 发现 */
.discover-content {
    padding: 1rem;
}

.discover-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.3s;
}

.discover-item:hover {
    background: #f8f8f8;
}

.discover-item i {
    font-size: 1.5rem;
    color: #667eea;
}

.discover-item span {
    color: #333;
}

/* 模态框 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    display: none;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 1.5rem;
}

/* 加载提示 */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    margin-top: 1rem;
    color: #666;
}

/* 通知提示 */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    z-index: 3000;
    min-width: 300px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
}

.notification-icon {
    font-size: 1.2rem;
}

.notification.success .notification-icon {
    color: #4caf50;
}

.notification.error .notification-icon {
    color: #f44336;
}

.notification.info .notification-icon {
    color: #2196f3;
}

.notification-text {
    flex: 1;
    color: #333;
}

/* 响应式设计 */
@media (max-width: 768px) {
    #sidebar {
        width: 280px;
    }
    
    .auth-box {
        margin: 1rem;
        padding: 1.5rem;
    }
    
    .modal {
        width: 95%;
    }
}

@media (max-width: 480px) {
    #chat-container {
        flex-direction: column;
    }
    
    #sidebar {
        width: 100%;
        height: 50vh;
    }
    
    .notification {
        right: 10px;
        left: 10px;
        min-width: auto;
    }
}