/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

/* 登录/注册页面样式 */
.auth-container {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-box {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.auth-box h1 {
    text-align: center;
    color: #667eea;
    margin-bottom: 1rem;
    font-size: 2rem;
}

.auth-box h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: #333;
    font-weight: 600;
}

.auth-box .btn-primary {
    margin-top: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e1e5e9;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.btn-primary {
    width: 100%;
    padding: 0.75rem;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.btn-primary:hover {
    background: #5a6fd8;
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-secondary {
    padding: 0.5rem 1rem;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.btn-secondary:hover {
    background: #5a6268;
}

/* 附件按钮样式 */
.attachment-btn {
    padding: 0.5rem;
    background: #f8f9fa;
    color: #495057;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    cursor: pointer;
    margin-right: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    transition: all 0.3s ease;
}

.attachment-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.attachment-icon {
    font-size: 1.2rem;
    font-weight: bold;
}

.auth-link {
    text-align: center;
    margin-top: 1.5rem;
    color: #666;
}

.auth-link a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.auth-link a:hover {
    text-decoration: underline;
}

/* 主应用页面样式 */
.app-container {
    display: flex;
    height: 100vh;
    background: white;
}

/* 左侧边栏 */
.sidebar {
    width: 300px;
    background: white;
    color: black;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(0, 0, 0, 0);
}

.sidebar-header {
    padding: 1.1rem;
    background: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

.btn-add-friend {
    background: #00e9ef;
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-add-friend:hover {
    background: #00ffc6;
}

.add-icon {
    font-weight: bold;
    line-height: 1;
}

/* 已移除旧的user-info样式，避免与搜索结果中的user-info冲突 */

.chat-list {
    flex: 1;
    overflow-y: auto;
}

/* 侧边栏底部用户信息区域 */
.sidebar-footer {
    background: #ffffff;
    /*border-top: 1px solid #2c3e50;*/
    padding: 1rem;
}

.sidebar-footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.current-user-info {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.current-user-info:hover {
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    padding: 0.25rem;
}

.user-avatar {
    margin-right: 0.75rem;
}

.avatar-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #667eea;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 0.9rem;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: black;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-id {
    font-size: 0.8rem;
    color: #bdc3c7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-actions {
    display: flex;
    align-items: center;
}

.btn-logout {
    padding: 0.5rem 1rem;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.btn-logout:hover {
    background: #c0392b;
}

.chat-item {
    padding: 1rem;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    position: relative;
}

.chat-item:hover {
    background: #6888ff;
}

.chat-item.active {
    background: #667eea;
}

.chat-avatar {
    width: 40px !important;
    height: 40px;
    border-radius: 50%;
    background: #3498db;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.75rem;
    font-weight: bold;
    color: white;
    font-size: 1rem;
    text-transform: uppercase;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

/* 不同用户头像的颜色变体 */
.chat-avatar:nth-child(1) { background: #3498db; }
.chat-avatar:nth-child(2) { background: #e74c3c; }
.chat-avatar:nth-child(3) { background: #f39c12; }
.chat-avatar:nth-child(4) { background: #2ecc71; }
.chat-avatar:nth-child(5) { background: #9b59b6; }
.chat-avatar:nth-child(6) { background: #1abc9c; }
.chat-avatar:nth-child(7) { background: #34495e; }
.chat-avatar:nth-child(8) { background: #e67e22; }

.chat-info {
    flex: 1;
}

.chat-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.chat-preview {
    font-size: 0.85rem;
    color: #bdc3c7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 未读消息徽章样式 */
.unread-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 10;
}

/* 徽章中的用户头像样式 */
.badge-avatar {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #e74c3c;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.6rem;
    font-weight: bold;
    text-transform: uppercase;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* 徽章中的通知数字样式 */
.badge-count {
    background: #e74c3c;
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 0.7rem;
    font-weight: bold;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    min-width: 16px;
    text-align: center;
}

/* 聊天项目样式 */
.chat-item {
    position: relative;
}

/* 聊天区域 */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.chat-header {
    padding: 1.2rem;
    background: white;
    /*border-bottom: 1px solid #e1e5e9;*/
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

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

.chat-title h4 {
    margin: 0;
    color: #2c3e50;
    margin-bottom: 6px;
}

/* 返回按钮样式 */
.back-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    border-radius: 10%;
    color: #495057;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    z-index: 2;
    margin-right: 0.75rem;
    display: none;
    position: absolute;
    left: 1.2rem;
}

.back-button svg {
    width: 28px;
    height: 28px;
    stroke: currentColor;
    fill: none;
}

.back-button:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #212529;
    transform: translateX(-2px);
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: #f8f9fa;
}

.no-chat-selected {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    color: #6c757d;
    font-size: 1.1rem;
}

.message {
    margin-bottom: 1rem;
    display: flex;
}

.message.sent {
    justify-content: flex-end;
}

.message.received {
    justify-content: flex-start;
}

.message-content {
    max-width: 70%;
    padding: 0.75rem 1rem;
    border-radius: 18px;
    position: relative;
}

.message.sent .message-content {
    background: #667eea;
    color: white;
    border-bottom-right-radius: 5px;
}

.message.received .message-content {
    background: white;
    color: #333;
    border-bottom-left-radius: 5px;
}

/* 图片消息样式 */
.message-image {
    max-width: 250px;
    border-radius: 18px;
    overflow: hidden;
    background: white;
}

/* 发送的图片右对齐 */
.message.sent .message-image {
    margin-left: auto;
}

/* 接收的图片左对齐 */
.message.received .message-image {
    margin-right: auto;
}

.message-image img {
    width: 100%;
    height: auto;
    display: flex;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.message-image img:hover {
    transform: scale(1.02);
}

/* 文件消息样式 */
.message-file {
    max-width: 250px;
    padding: 1rem;
    border-radius: 18px;
    background: white;
    border: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.message-file .file-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.message-file .file-info {
    flex: 1;
    min-width: 0;
}

.message-file .file-name {
    font-weight: 500;
    color: #333;
    margin-bottom: 0.25rem;
    word-break: break-all;
}

.message-file .file-download {
    color: #667eea;
    text-decoration: none;
    font-size: 0.9rem;
    border: 1px solid #667eea;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.message-file .file-download:hover {
    background: #667eea;
    color: white;
}

/* 图片模态框样式 */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.image-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    cursor: pointer;
}

.image-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    z-index: 1;
}

.image-modal-content img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.image-modal-close {
    position: absolute;
    top: -15px;
    right: -15px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.image-modal-close:hover {
    background: rgba(0, 0, 0, 0.9);
}

.message-time {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 0.25rem;
}

.message.sent .message-time {
    text-align: right;
}

.message.received .message-time {
    text-align: left;
}

.message.sent .message-content {
    align-self: flex-end;
    text-align: right;
}

.message.received .message-content {
    align-self: flex-start;
    text-align: left;
}

.message.received {
    display: flex;
    flex-direction: column;
}

.message.sent {
    display: flex;
    flex-direction: column;
}

.message-input-container {
    padding: 1rem;
    background: white;
    border-top: 1px solid #e1e5e9;
}

.message-input {
    display: flex;
    gap: 0.5rem;
}

.message-input input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #e1e5e9;
    border-radius: 25px;
    outline: none;
    font-size: 1rem;
}

.message-input input:focus {
    border-color: #667eea;
}

.message-input .btn-primary {
    width: auto;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
}

/* 搜索页面样式 */
.search-page-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
}

.search-header {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    margin-bottom: 2rem;
    position: relative;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    border-radius: 10%;
    color: #495057;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    z-index: 2;
}

.back-btn svg {
    width: 28px;
    height: 28px;
    stroke: currentColor;
    fill: none;
}

.back-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #212529;
    transform: translateX(-2px);
}

.search-header h1 {
    color: #2c3e50;
    margin: 0;
    text-align: center;
    font-size: 1.8rem;
    font-weight: 600;
    grid-column: 2;
}

.search-form-container {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.search-input-group {
    display: flex;
    gap: 1rem;
}

.search-input-group input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #e1e5e9;
    border-radius: 30px;
    font-size: 1rem;
}

.search-input-group .btn-primary {
    width: 16%;
    padding: 0.75rem 1.5rem;
    border-radius: 30px;
}

.search-input-group input:focus {
    outline: none;
    border-color: #667eea;
}

.search-results-container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    min-height: 200px;
    overflow: hidden;
}

.no-results {
    text-align: center;
    padding: 3rem;
    color: #6c757d;
    font-size: 14px;
}

.results-list {
    padding: 0;
}

.user-result {
    padding: 1rem;
    border-bottom: 1px solid #e1e5e9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-result:last-child {
    border-bottom: none;
}

.user-result-info h4 {
    margin: 0 0 0.25rem 0;
    color: #2c3e50;
}

.user-result-info p {
    margin: 0;
    color: #6c757d;
    font-size: 0.9rem;
}

.user-result-actions {
    display: flex;
    gap: 0.5rem;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

.modal.show {
    display: flex;
    justify-content: center;
    align-items: center;
    animation: slideIn 0.3s ease-out;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 420px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transform: translateY(-20px);
    animation: modalSlideIn 0.3s ease-out forwards;
}

/* 登录页弹窗特殊样式 */
.auth-container .modal-content {
    max-width: 380px;
    width: 85%;
}

/* 移动端登录页弹窗优化 */
@media (max-width: 480px) {
    .auth-container .modal-content {
        width: 80%;
        max-width: 350px;
    }
}

/* 用户信息模态框特殊样式 */
.modal-profile {
    z-index: 1001;
}

/* 提示弹窗样式 - 确保显示在最上层 */
#alertModal {
    z-index: 1002;
}

/* 优化提示弹窗样式 */
#alertModal .modal-content {
    width: 80%;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
    border: none;
    max-width: 420px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    overflow: hidden;
    min-height: auto;
}

#alertModal .modal-header {
    height: 45px;
    padding: 1.25rem 1.5rem 0.75rem 1.5rem;
    /* border-bottom: 1px solid rgba(102, 126, 234, 0.1);
    background: rgba(102, 126, 234, 0.03); */
}

#alertModal .modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#alertModal .modal-body {
    padding: 1.25rem 1.5rem 1.5rem;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #374151;
    align-items: center;
}

#alertModal #alertMessage {
    margin: 0;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

#alertModal #alertMessage::before {
    content: '';
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 12px;
    margin-top: 0.125rem;
}

#alertModal .modal-body.success #alertMessage::before {
    background: rgba(40, 167, 69, 0.1);
    color: #28a745;
    content: '✓';
}

#alertModal .modal-body.error #alertMessage::before {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    content: '✗';
}

#alertModal .modal-close {
    transition: all 0.2s ease;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    font-size: 1.25rem;
}

#alertModal .modal-close:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    transform: scale(1.05);
}

/* 优化弹窗动画 */
#alertModal .modal-content {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(-10px) scale(0.98);
}

#alertModal.show .modal-content {
    transform: translateY(0) scale(1);
}

.modal-profile .profile-modal-content {
    max-width: 500px;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    /* 隐藏滚动条但保持滚动功能 */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
    overflow-y: hidden; /* 防止整体滚动 */
}

/* 隐藏Chrome, Safari和Opera的滚动条 */
.modal-profile .profile-modal-content::-webkit-scrollbar,
.profile-form-container::-webkit-scrollbar {
    display: none;
}

/* profile header样式 */
.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 1.5rem 1rem 1.5rem;
    /* border-bottom: 1px solid rgba(0, 0, 0, 0.06); */
    flex-shrink: 0; /* 固定头部，不随内容滚动 */
}

.profile-header h1 {
    margin: 0;
    color: #667eea;
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.profile-header .back-btn {
    color: #9ca3af;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.profile-header .back-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: #6b7280;
}

.profile-header .logout-icon {
    color: #9caeaf;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.profile-header .logout-icon:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: #6b7280;
}

.profile-header .logout-icon-text {
    font-size: 0.8rem;
    font-weight: 500;
    color: #9caeaf;
}

/* profile表单容器 */
.profile-form-container {
    padding: 2rem;
    max-width: 400px;
    margin: 0 auto;
    flex: 1; /* 占据剩余空间 */
    overflow-y: auto; /* 允许内容滚动 */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

/* 修改输入框样式 */
.form-group input {
    width: 100%;
    padding: 0.75rem 1.25rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 25px;
    font-size: 1rem;
    transition: all 0.2s ease;
    background-color: #fafafa;
    box-sizing: border-box;
}

/* profile头像容器样式 */
.profile-avatar-container {
    margin-top: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 25%;
    margin-bottom: 1rem;
}

.profile-avatar-container .avatar-circle {
    width: 80px;
    height: 80px;
    background: #667eea;
    font-size: 2rem;
}

/* profile表单中的保存按钮样式 */
.profile-form-container .btn-primary {
    /* width: 80%; */
    padding: 0.85rem 1.5rem;
    border-radius: 25px;
    margin: 6rem auto 1rem auto;
    display: block;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    background-color: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 密码部分样式 */
.password-section {
    margin-top: 1.5rem;
}

/* 移动端响应式样式 */
@media (max-width: 768px) {
    /* 修改模态框背景，使其看起来像新页面 */
    .modal-profile {
        background: white;
        backdrop-filter: none;
    }
    
    .modal-profile.show {
        align-items: stretch;
    }
    
    .modal-profile .profile-modal-content {
        max-width: 100%;
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
        transform: translateY(0);
        box-shadow: none;
        border: none;
        display: flex;
        flex-direction: column;
        /* 保持隐藏滚动条的功能 */
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE and Edge */
    }
    
    /* 确保移动端也隐藏滚动条 */
    .modal-profile .profile-modal-content::-webkit-scrollbar {
        display: none;
    }
    
    .profile-header {
        padding: 1.25rem 1.25rem 0.75rem 1.25rem;
        border-bottom: none;
        flex-shrink: 0; /* 固定头部，不随内容滚动 */
    }
    
    /* 使表单容器可滚动 */
    .profile-form-container {
        padding: 2rem 1.5rem;
        max-width: 100%;
        flex: 1; /* 占据剩余空间 */
        display: flex;
        flex-direction: column;
        align-items: center;
        overflow-y: auto; /* 允许内容滚动 */
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE and Edge */
    }
    
    /* 确保表单在移动端宽度合适 */
    .profile-form-container form {
        width: 100%;
        max-width: 400px;
    }
    
    .profile-header h1 {
        font-size: 1.125rem;
    }
    
    /* 调整移动端按钮宽度 */
    .profile-form-container .btn-primary {
        width: 100%;
    }
}

@media (max-height: 915px) {
    .profile-form-container {
        padding: 0.85rem 1.5rem 2rem 1.5rem;
    }
    .profile-form-container .password-section {
        margin-top: 1rem;
    }
    .profile-form-container .btn-primary {
        margin-top: 2rem;
    }
    .profile-form-container .profile-avatar-container {
        margin-top: 0.5rem;
        height: 20%;
    }
    .profile-form-container .form-group {
        margin-bottom: 1rem;
    }
}

.modal-header {
    /* padding: 1.2rem 1.2rem 1rem 1.2rem; */
    height: 45px;
    /* border-bottom: 1px solid rgba(0, 0, 0, 0.06); */
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #94a3b8;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    color: #64748b;
    background: rgba(148, 163, 184, 0.1);
    transform: scale(1.05);
}

.modal-body {
    padding: 1.5rem;
    color: #475569;
    line-height: 1.6;
    font-size: 0.95rem;
}

/* 动画定义 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 通知样式 */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 12px;
    color: white;
    font-weight: 500;
    z-index: 1001;
    max-width: 350px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: notificationSlideIn 0.3s ease-out;
}

.notification.success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.notification.error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.notification-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    margin-left: 10px;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.notification-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

@keyframes notificationSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.search-container {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.search-container input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #e1e5e9;
    border-radius: 5px;
}

.search-container button {
    padding: 0.5rem 1rem;
}

.search-results {
    max-height: 300px;
    overflow-y: auto;
}

.search-result-item {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background-color 0.2s;
}

.search-result-item:hover {
    background-color: #f5f5f5;
}

.search-result-item:last-child {
    border-bottom: none;
}

.user-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background-color: #667eea;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    font-size: 18px;
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-weight: 500;
    font-size: 15px;
    margin-bottom: 2px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    font-size: 13px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-actions {
    display: flex;
    align-items: center;
}

.btn-add {
    background-color: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-add:hover {
    background-color: #5a6fd8;
}

.friend-status {
    color: #666;
    font-size: 12px;
    padding: 6px 12px;
    background-color: #f0f0f0;
    border-radius: 4px;
}

.search-result-info p {
    margin: 0;
    color: #6c757d;
    font-size: 0.85rem;
}

.friend-request-item {
    padding: 1rem;
    border-bottom: 1px solid #e1e5e9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.friend-request-item:last-child {
    border-bottom: none;
}

.friend-request-info h5 {
    margin: 0 0 0.25rem 0;
    color: #2c3e50;
}

.friend-request-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-accept {
    background: #28a745;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.85rem;
}

.btn-accept:hover {
    background: #218838;
}

.btn-reject {
    background: #dc3545;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.85rem;
}

.btn-reject:hover {
    background: #c82333;
}

/* 通知样式 */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 400px;
}

.notification.error {
    background: #dc3545;
}

.notification.warning {
    background: #ffc107;
    color: #333;
}

.notification.info {
    background: #17a2b8;
}

.notification-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification.warning .notification-close {
    color: #333;
}

/* 响应式设计 */
@media (max-width: 768px) {

    .auth-box {
        width: 80%;
    }
    
    .chat-item {
        margin-left: 1rem;
        padding: 1rem;
        border: none;
        cursor: pointer;
        transition: background-color 0.3s ease;
        display: flex;
        align-items: center;
        position: relative;
    }

    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: 100vh;
    }
    
    .chat-area {
        display: none;
    }
    
    .search-input-group {
        display: flex;
        gap: 1rem;
    }
    
    .search-input-group input {
        flex: 1;
        font-size: 12px;
        height: 38px;
        width: 75%;
        padding: 0.75rem;
        border: 1px solid #e1e5e9;
        border-radius: 30px;
        font-size: 1rem;
    }

    .search-input-group .btn-primary {
        font-size: 12px;
        padding: 0.75rem 1.25rem;
        border-radius: 30px;
        min-width: 80px;
        height: auto;
        line-height: normal;
        width: auto;
        white-space: nowrap;
    }
    
    .modal-content {
        width: 95%;
        margin: 1rem;
    }
    
    /* 移动端聊天页面样式 */
    .mobile-chat-page .chat-area {
        display: flex;
        flex-direction: column;
        height: 100vh;
        width: 100%;
    }
    
    .mobile-chat-page .sidebar {
        display: none;
    }

        
    /* 移动端消息输入框优化 */
    .mobile-chat-page .message-input-container {
        padding: 0.5rem;
    }
    
    .mobile-chat-page .message-input {
        height: auto;
        min-height: 38px;
        align-items: center;
    }
    
    .mobile-chat-page .message-input input {
        padding: 0.5rem 1rem;
        height: 38px;
        font-size: 0.9rem;
    }
    
    .mobile-chat-page .message-input .btn-primary {
        padding: 0.5rem 1rem;
        height: 38px;
        font-size: 0.9rem;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .mobile-chat-page .attachment-btn {
        height: 32px;
        width: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* 移动端返回按钮显示 */
    .mobile-chat-page .back-button {
        display: block;
    }
    
    /* 移动端聊天标题样式调整 */
    .mobile-chat-page .chat-title {
        display: flex;
        align-items: center;
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 隐藏滚动条但保持功能 */
.chat-list::-webkit-scrollbar,
.messages-container::-webkit-scrollbar,
.search-results::-webkit-scrollbar {
    width: 6px;
}

.chat-list::-webkit-scrollbar-track,
.messages-container::-webkit-scrollbar-track,
.search-results::-webkit-scrollbar-track {
    background: transparent;
}

.chat-list::-webkit-scrollbar-thumb,
.messages-container::-webkit-scrollbar-thumb,
.search-results::-webkit-scrollbar-thumb {
    background: #bdc3c7;
    border-radius: 3px;
}

.chat-list::-webkit-scrollbar-thumb:hover,
.messages-container::-webkit-scrollbar-thumb:hover,
.search-results::-webkit-scrollbar-thumb:hover {
    background: #95a5a6;
}