* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f7fa;
    min-height: 100vh;
}

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.logo {
    text-align: center;
    margin-bottom: 30px;
}

.logo h1 {
    color: #333;
    margin-bottom: 8px;
}

.logo p {
    color: #666;
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.3s;
}

.btn:hover {
    opacity: 0.9;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.error-message {
    background: #fee2e2;
    color: #dc2626;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.register-link {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: #666;
}

.register-link a {
    color: #667eea;
    text-decoration: none;
}

.chat-body {
    background: #e9ecef;
}

.chat-container {
    display: flex;
    height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.1);
}

.sidebar {
    width: 360px;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e5e7eb;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    background: #e5e7eb;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.nickname {
    font-weight: 600;
    color: #333;
}

.status {
    font-size: 12px;
    color: #666;
}

.status.online {
    color: #10b981;
}

.header-actions {
    display: flex;
    gap: 8px;
}

.icon-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #f3f4f6;
    color: #666;
    text-decoration: none;
    transition: background 0.3s;
}

.icon-btn:hover {
    background: #e5e7eb;
}

.search-box {
    padding: 12px;
}

.search-box input {
    width: 100%;
    padding: 10px 14px;
    border: none;
    border-radius: 8px;
    background: #f3f4f6;
    font-size: 14px;
}

.sidebar-tabs {
    display: flex;
    border-bottom: 1px solid #e5e7eb;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background: white;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.tab-content {
    flex: 1;
    overflow-y: auto;
}

.session-list {
    padding: 8px;
}

.session-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s;
    position: relative;
}

.session-item:hover {
    background: #f9fafb;
}

.session-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    background: #e5e7eb;
}

.session-info {
    flex: 1;
    margin-left: 12px;
    overflow: hidden;
}

.session-name {
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
}

.session-preview {
    font-size: 13px;
    color: #666;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.unread-count {
    background: #ef4444;
    color: white;
    font-size: 12px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 12px;
    min-width: 24px;
    text-align: center;
}

.online-dot {
    position: absolute;
    bottom: 16px;
    left: 44px;
    width: 10px;
    height: 10px;
    background: #10b981;
    border-radius: 50%;
    border: 2px solid white;
}

.friends-section {
    padding: 8px 12px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
}

.count {
    background: #e5e7eb;
    padding: 2px 8px;
    border-radius: 10px;
}

.friends-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.friend-item {
    display: flex;
    align-items: center;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s;
    position: relative;
}

.friend-item:hover {
    background: #f9fafb;
}

.friend-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    background: #e5e7eb;
}

.friend-name {
    flex: 1;
    margin-left: 10px;
    font-size: 14px;
    color: #333;
}

.add-friend-btn {
    padding: 12px;
}

.add-group-btn {
    padding: 12px;
}

.groups-list {
    padding: 0 8px 8px;
}

.group-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s;
}

.group-item:hover {
    background: #f9fafb;
}

.group-avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    object-fit: cover;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.group-info {
    flex: 1;
    margin-left: 12px;
    overflow: hidden;
}

.group-name {
    font-weight: 500;
    color: #333;
    margin-bottom: 2px;
}

.group-desc {
    font-size: 12px;
    color: #999;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 2px;
}

.group-role {
    font-size: 11px;
    color: #667eea;
    background: #eef2ff;
    padding: 1px 6px;
    border-radius: 4px;
    display: inline-block;
}

.empty-groups {
    text-align: center;
    padding: 40px 20px;
    color: #9ca3af;
}

.empty-groups span {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
}

.empty-groups p {
    margin-bottom: 4px;
}

.empty-groups .hint {
    font-size: 12px;
    color: #d1d5db;
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.chat-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

.chat-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.chat-settings-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f0f2f5;
    color: #666;
    text-decoration: none;
    transition: all 0.2s ease;
    margin-left: 12px;
}

.chat-settings-btn:hover {
    background: #e0e2e5;
    color: #333;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header-right {
    display: flex;
    align-items: center;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #9ca3af;
}

.empty-state svg {
    margin-bottom: 16px;
}

.message {
    max-width: 70%;
    margin-bottom: 16px;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
}

.message.sent {
    align-self: flex-end;
    background: #667eea;
    color: white;
    border-bottom-right-radius: 4px;
}

.message.received {
    align-self: flex-start;
    background: #f3f4f6;
    color: #333;
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 4px;
    text-align: right;
}

.chat-input-area {
    padding: 12px 20px;
    border-top: 1px solid #e5e7eb;
    background: white;
}

.input-tools {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.tool-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: #f3f4f6;
    border-radius: 50%;
    color: #666;
    cursor: pointer;
    transition: background 0.3s;
}

.tool-btn:hover {
    background: #e5e7eb;
}

.chat-input-area input[type="text"] {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    font-size: 14px;
    margin-right: 10px;
}

.send-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: #667eea;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    transition: background 0.3s;
}

.send-btn:hover {
    background: #5a6fd6;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
    color: #333;
}

.close-btn {
    border: none;
    background: none;
    font-size: 24px;
    color: #9ca3af;
    cursor: pointer;
}

.modal-body {
    padding: 20px;
}

.modal-body input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 16px;
}

#searchResults {
    max-height: 200px;
    overflow-y: auto;
}

.search-result-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s;
}

.search-result-item:hover {
    background: #f9fafb;
}

.search-result-item img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 12px;
}

.search-result-item .name {
    flex: 1;
    font-weight: 500;
}

.search-result-item button {
    padding: 6px 16px;
    border: none;
    background: #667eea;
    color: white;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
}

.user-center-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.user-center-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.user-center-header .avatar {
    width: 80px;
    height: 80px;
}

.user-center-header h2 {
    font-size: 24px;
    color: #333;
}

.user-center-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
    padding: 20px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

.user-center-tabs a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    padding: 10px;
    text-decoration: none;
    color: #374151;
    font-weight: 500;
    font-size: 12px;
    border-radius: 12px;
    transition: all 0.3s;
    background: #f9fafb;
}

.user-center-tabs a:hover {
    background: #f0f4ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.user-center-tabs a.active {
    background: #667eea;
    color: white;
}

.user-center-content {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.profile-form {
    max-width: 500px;
}

.profile-form .form-group {
    margin-bottom: 20px;
}

.profile-form label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
}

.profile-form input,
.profile-form textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
}

.profile-form textarea {
    resize: vertical;
    min-height: 100px;
}

.success-message {
    background: #dcfce7;
    color: #16a34a;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.friend-requests-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.friend-request-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 8px;
    background: #f9fafb;
}

.friend-request-item img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    margin-right: 12px;
}

.friend-request-item .info {
    flex: 1;
}

.friend-request-item .name {
    font-weight: 500;
    color: #333;
}

.friend-request-item .time {
    font-size: 12px;
    color: #9ca3af;
}

.friend-request-item .actions {
    display: flex;
    gap: 8px;
}

.friend-request-item button {
    padding: 6px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}

.friend-request-item .accept-btn {
    background: #10b981;
    color: white;
}

.friend-request-item .reject-btn {
    background: #ef4444;
    color: white;
}

/* 好友申请（聊天页侧边栏） */
.tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-left: 6px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 999px;
    vertical-align: middle;
}

.friend-request-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.friend-requests-section .friend-request-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-radius: 10px;
    background: #eef2ff;
}

.friend-requests-section .friend-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.friend-requests-section .friend-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background: #e5e7eb;
    margin: 0;
}

.friend-requests-section .friend-info {
    flex: 1;
    margin-left: 10px;
    min-width: 0;
}

.friend-requests-section .friend-name {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
}

.friend-requests-section .friend-status {
    display: block;
    font-size: 12px;
    color: #6b7280;
}

.friend-request-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.friend-request-actions button {
    padding: 5px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.friend-request-actions .accept-btn {
    background: #10b981;
    color: #fff;
}
.friend-request-actions .accept-btn:hover {
    background: #059669;
}

.friend-request-actions .reject-btn {
    background: #f3f4f6;
    color: #6b7280;
}
.friend-request-actions .reject-btn:hover {
    background: #e5e7eb;
    color: #374151;
}

.admin-container {
    display: flex;
    min-height: 100vh;
    background: #f5f7fa;
}

.admin-sidebar {
    width: 240px;
    background: #1f2937;
    padding: 20px;
}

.admin-sidebar h2 {
    color: white;
    font-size: 18px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #374151;
}

.admin-sidebar ul {
    list-style: none;
}

.admin-sidebar li {
    margin-bottom: 8px;
}

.admin-sidebar a {
    display: block;
    padding: 10px 15px;
    color: #9ca3af;
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.3s;
}

.admin-sidebar a:hover,
.admin-sidebar a.active {
    background: #374151;
    color: white;
}

.admin-main {
    flex: 1;
    padding: 20px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.admin-header h1 {
    color: #333;
}

.admin-header a {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    text-decoration: none;
    border-radius: 8px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 12px;
    overflow: hidden;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.data-table th {
    background: #f9fafb;
    font-weight: 600;
    color: #333;
}

.data-table tr:hover {
    background: #f9fafb;
}

.data-table .status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.online {
    background: #dcfce7;
    color: #16a34a;
}

.status-badge.offline {
    background: #fef2f2;
    color: #dc2626;
}

.data-table .action-btns {
    display: flex;
    gap: 8px;
}

.data-table .action-btns a {
    padding: 6px 12px;
    text-decoration: none;
    border-radius: 6px;
    font-size: 13px;
}

.data-table .action-btns .edit-btn {
    background: #e5e7eb;
    color: #333;
}

.data-table .action-btns .delete-btn {
    background: #fee2e2;
    color: #dc2626;
}

.settings-form {
    max-width: 600px;
}

.settings-form .form-group {
    margin-bottom: 20px;
}

.settings-form label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
}

.settings-form input,
.settings-form textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
}

.settings-form textarea {
    resize: vertical;
    min-height: 100px;
}

/* 聊天扩展样式 */
.session-avatar-wrap,
.friend-avatar-wrap {
    position: relative;
}

.friend-info {
    margin-left: 10px;
    flex: 1;
}

.friend-status {
    font-size: 12px;
    color: #10b981;
}

.friend-status.offline {
    color: #9ca3af;
}

.chat-input-area {
    position: relative;
}

.input-wrapper {
    display: flex;
    align-items: center;
}

.input-wrapper input[type="text"] {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    font-size: 14px;
    margin-right: 10px;
}

.emoji-picker,
.gift-picker {
    position: absolute;
    bottom: 100%;
    left: 20px;
    right: 20px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 10px;
    z-index: 100;
    overflow: hidden;
}

.emoji-picker-header,
.gift-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    font-weight: 500;
}

.emoji-close-btn {
    background: none;
    border: none;
    font-size: 18px;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.2s;
}

.emoji-close-btn:hover {
    background: #e5e7eb;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    padding: 12px;
    max-height: 200px;
    overflow-y: auto;
}

.emoji-item {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.emoji-item:hover {
    background: #f3f4f6;
}

.emoji-icon {
    font-size: 24px;
}

.gift-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding: 16px;
    max-height: 280px;
    overflow-y: auto;
}

.gift-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    background: #f9fafb;
}

.gift-item:hover {
    background: #eef2ff;
    transform: translateY(-2px);
}

.gift-icon {
    font-size: 36px;
    margin-bottom: 8px;
}

.gift-name {
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 4px;
}

.gift-price {
    font-size: 12px;
    color: #667eea;
    font-weight: 600;
}

.message-image {
    max-width: 250px;
    border-radius: 8px;
    cursor: pointer;
}

.message-file {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.message.received .message-file {
    background: #f9fafb;
}

.message-file:hover {
    background: rgba(255, 255, 255, 0.3);
}

.message.received .message-file:hover {
    background: #f3f4f6;
}

.file-icon {
    font-size: 24px;
}

.file-info {
    flex: 1;
}

.file-name {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 2px;
    word-break: break-all;
}

.file-size {
    font-size: 12px;
    opacity: 0.7;
}

.download-icon {
    font-size: 16px;
}

.message-emoji {
    font-size: 48px;
    line-height: 1;
}

.message-gift {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 30px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-radius: 12px;
    text-align: center;
}

.gift-animation {
    font-size: 64px;
    margin-bottom: 8px;
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.gift-text {
    font-size: 16px;
    font-weight: 600;
    color: #92400e;
    margin-bottom: 4px;
}

.gift-sender {
    font-size: 12px;
    color: #b45309;
}

.recalled-message {
    font-size: 12px;
    font-style: italic;
    opacity: 0.6;
}

.recall-btn {
    display: inline-block;
    margin-left: 8px;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.2s;
    cursor: pointer;
}

.message.sent:hover .recall-btn {
    opacity: 0.7;
}

.recall-btn:hover {
    opacity: 1 !important;
}

.message-content {
    position: relative;
}

/* AI 回复建议框 */
.ai-suggest-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 14px;
    margin: 8px 0;
    animation: aiSuggestIn 0.25s ease;
}

@keyframes aiSuggestIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.ai-suggest-header {
    font-size: 13px;
    font-weight: 600;
    color: #6366f1;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-suggest-tip {
    font-size: 11px;
    font-weight: 400;
    color: #9ca3af;
}

.ai-suggest-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ai-suggest-item {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 7px 14px;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
    max-width: 100%;
}

.ai-suggest-item:hover {
    background: #6366f1;
    border-color: #6366f1;
    color: #ffffff;
    transform: translateY(-1px);
}

.ai-suggest-loading {
    font-size: 13px;
    color: #9ca3af;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-suggest-loading::before {
    content: '';
    width: 12px;
    height: 12px;
    border: 2px solid #e2e8f0;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: aiSpin 0.8s linear infinite;
}

@keyframes aiSpin {
    to { transform: rotate(360deg); }
}

/* 双向翻译按钮与结果 */
.translate-btn {
    display: inline-block;
    margin-left: 8px;
    font-size: 11px;
    color: #6366f1;
    cursor: pointer;
    user-select: none;
    padding: 1px 7px;
    border: 1px solid #c7d2fe;
    border-radius: 10px;
    vertical-align: middle;
    transition: all 0.2s;
}

.translate-btn:hover {
    background: #6366f1;
    border-color: #6366f1;
    color: #ffffff;
}

.translate-result {
    margin-top: 6px;
    font-size: 13px;
    color: #374151;
    background: #f0f4ff;
    border-left: 3px solid #6366f1;
    padding: 8px 10px;
    border-radius: 6px;
    word-break: break-word;
    line-height: 1.6;
    animation: aiSuggestIn 0.2s ease;
}

.translate-label {
    color: #6366f1;
    font-weight: 600;
    margin-right: 4px;
}

.translate-loading {
    color: #9ca3af;
    font-size: 12px;
}

.translate-error {
    color: #ef4444;
    font-size: 12px;
}

/* 翻译语言切换栏 */
.translate-lang-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.translate-lang-btn {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 3px 10px;
    font-size: 12px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s;
}

.translate-lang-btn:hover {
    border-color: #6366f1;
    color: #6366f1;
}

.translate-lang-btn.active {
    background: #6366f1;
    border-color: #6366f1;
    color: #ffffff;
}

.translate-body {
    word-break: break-word;
    line-height: 1.6;
}

/* ========== AI 托管聊天 ========== */
.host-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 12px;
    padding: 6px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    background: #f9fafb;
    color: #6b7280;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.host-toggle-btn:hover {
    border-color: #6366f1;
    color: #6366f1;
}
.host-toggle-btn.on {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 12px rgba(99,102,241,0.3);
}

.chat-info-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 12px;
    padding: 6px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    background: #f9fafb;
    color: #6b7280;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}
.chat-info-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
}

.host-modal-content {
    max-width: 520px;
    width: 92vw;
    max-height: 90vh;
    overflow-y: auto;
}
.host-modal-body {
    padding: 20px 24px 24px;
}
.host-tip {
    background: #eef2ff;
    color: #4338ca;
    font-size: 13px;
    line-height: 1.6;
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 18px;
}

.host-switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}
.host-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}
.host-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.host-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #e5e7eb;
    border-radius: 999px;
    transition: 0.25s;
}
.host-slider::before {
    content: '';
    position: absolute;
    height: 20px; width: 20px;
    left: 3px; bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.25s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.host-switch input:checked + .host-slider {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
}
.host-switch input:checked + .host-slider::before {
    transform: translateX(22px);
}

.host-label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}
.host-label-tip {
    font-size: 12px;
    font-weight: 400;
    color: #9ca3af;
}

.host-presets {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 18px;
}

.host-preset-group {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}
.host-preset-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 14px;
    background: #f8f9fc;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}
.host-preset-group-header:hover {
    background: #eef0f6;
}
.host-preset-group-title {
    font-size: 14px;
    font-weight: 700;
    color: #1f2937;
    flex: 1;
}
.host-preset-group-count {
    font-size: 12px;
    font-weight: 600;
    color: #6366f1;
    background: #eef2ff;
    border-radius: 10px;
    padding: 2px 9px;
}
.host-preset-group-arrow {
    font-size: 14px;
    color: #9ca3af;
    transition: transform 0.25s;
}
.host-preset-group.open .host-preset-group-arrow {
    transform: rotate(180deg);
}
.host-preset-group-body {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 0 12px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.28s ease;
}
.host-preset-group.open .host-preset-group-body {
    max-height: 900px;
    padding-top: 12px;
    padding-bottom: 12px;
}

.host-preset {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    column-gap: 10px;
    align-items: center;
    padding: 10px 12px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
    text-align: left;
}
.host-preset:hover {
    border-color: #6366f1;
}
.host-preset.active {
    border-color: #6366f1;
    background: #eef2ff;
}
.host-preset-icon {
    grid-row: 1 / 3;
    font-size: 22px;
}
.host-preset-name {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
}
.host-preset-desc {
    font-size: 12px;
    color: #9ca3af;
    line-height: 1.4;
}

.host-modal-body textarea {
    width: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    color: #1f2937;
    resize: vertical;
    font-family: inherit;
    line-height: 1.6;
    margin-bottom: 18px;
    transition: all 0.2s;
}
.host-modal-body textarea:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

.host-save-btn {
    width: 100%;
    padding: 13px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s;
    font-family: inherit;
    box-shadow: 0 4px 14px rgba(99,102,241,0.35);
}
.host-save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(99,102,241,0.45);
}

@media (max-width: 480px) {
    .host-preset-group-body {
        grid-template-columns: 1fr;
    }
}

/* 空状态美化 */
.empty-state-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.empty-state-title {
    font-size: 18px;
    color: #6b7280;
    margin-bottom: 8px;
}

.empty-state-desc {
    font-size: 14px;
    color: #9ca3af;
}

.chat-title-icon {
    margin-right: 8px;
}

/* 图片预览模态框 */
.image-preview-modal {
    max-width: 90vw;
    width: auto !important;
}

/* 用户中心头部美化 */
.user-center-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 16px;
    margin-bottom: 24px;
}

.user-center-header h2 {
    color: white;
    font-size: 24px;
    margin-bottom: 8px;
}

.user-center-header p {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 4px;
}

.user-center-header .avatar {
    border: 3px solid rgba(255, 255, 255, 0.3);
}

/* 消息滚动条美化 */
.chat-messages::-webkit-scrollbar,
.emoji-grid::-webkit-scrollbar,
.gift-grid::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track,
.emoji-grid::-webkit-scrollbar-track,
.gift-grid::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb,
.emoji-grid::-webkit-scrollbar-thumb,
.gift-grid::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover,
.emoji-grid::-webkit-scrollbar-thumb:hover,
.gift-grid::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* ========== 移动端返回按钮（聊天页） ========== */
.mobile-back-btn {
    display: none;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    border: none;
    background: #f3f4f6;
    border-radius: 50%;
    color: #374151;
    cursor: pointer;
    margin-right: 12px;
}

.mobile-menu-btn {
    display: none;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    border: none;
    background: #f3f4f6;
    border-radius: 50%;
    color: #374151;
    cursor: pointer;
}

/* ========== 响应式：平板 ========== */
@media (max-width: 1024px) {
    .sidebar {
        width: 300px;
    }

    .admin-sidebar {
        width: 200px;
    }

    .admin-main {
        margin-left: 200px;
    }
}

/* ========== 响应式：手机端 ========== */
@media (max-width: 768px) {
    /* ===== 登录页 ===== */
    .login-box {
        padding: 24px 20px;
        margin: 16px;
        max-width: 100%;
    }

    .logo h1 {
        font-size: 22px;
    }

    /* ===== 聊天页面 ===== */
    .chat-container {
        flex-direction: column;
        height: 100vh;
    }

    .sidebar {
        width: 100%;
        height: 100%;
        position: fixed;
        top: 0;
        left: 0;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        background: white;
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .chat-main {
        width: 100%;
        height: 100vh;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .mobile-back-btn {
        display: flex;
    }

    .sidebar-header {
        padding: 12px;
    }

    .avatar {
        width: 40px;
        height: 40px;
    }

    .user-details .nickname {
        font-size: 14px;
    }

    .status {
        font-size: 11px;
    }

    .header-actions {
        gap: 6px;
    }

    .icon-btn {
        width: 36px;
        height: 36px;
    }

    .search-box {
        padding: 8px 12px;
    }

    .session-item {
        padding: 10px;
    }

    .session-avatar {
        width: 40px;
        height: 40px;
    }

    .session-info {
        margin-left: 10px;
    }

    .session-name {
        font-size: 14px;
    }

    .session-preview {
        font-size: 12px;
    }

    .chat-header {
        padding: 12px 16px;
    }

    .chat-title {
        font-size: 15px;
    }

    .chat-messages {
        padding: 12px;
    }

    .message {
        max-width: 85%;
        padding: 8px 12px;
        font-size: 14px;
    }

    .message-image {
        max-width: 180px;
    }

    .chat-input-area {
        padding: 10px 12px;
    }

    .input-tools {
        gap: 6px;
        margin-bottom: 8px;
    }

    .tool-btn {
        width: 34px;
        height: 34px;
    }

    .input-wrapper input[type="text"] {
        padding: 10px 14px;
        font-size: 14px;
        margin-right: 8px;
    }

    .send-btn {
        width: 40px;
        height: 40px;
    }

    .emoji-picker,
    .gift-picker {
        left: 12px;
        right: 12px;
    }

    .emoji-grid {
        grid-template-columns: repeat(6, 1fr);
    }

    .gift-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .modal-content {
        max-width: calc(100% - 24px);
        margin: 12px;
    }

    /* ===== 用户中心 ===== */
    .user-center-container {
        padding: 12px;
    }

    .user-center-header {
        flex-direction: column;
        text-align: center;
        gap: 12px;
        padding: 20px;
    }

    .user-center-header .avatar {
        width: 64px;
        height: 64px;
    }

    .user-center-header h2 {
        font-size: 20px;
    }

    .user-center-tabs {
        gap: 8px;
        padding: 12px;
    }

    .user-center-tabs a {
        width: 64px;
        height: 64px;
        font-size: 11px;
    }

    .user-center-content {
        padding: 16px;
    }

    .profile-form {
        max-width: 100%;
    }

    .friend-request-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .friend-request-item .actions {
        width: 100%;
        justify-content: flex-end;
    }

    /* ===== 后台管理 ===== */
    .admin-sidebar {
        width: 240px;
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .admin-sidebar.show {
        transform: translateX(0);
    }

    .admin-main {
        margin-left: 0;
        padding: 16px;
    }

    .admin-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .data-table {
        font-size: 13px;
    }

    .data-table th,
    .data-table td {
        padding: 8px 10px;
    }

    .data-table .action-btns {
        flex-direction: column;
        gap: 4px;
    }

    .settings-form {
        max-width: 100%;
    }

    /* ===== 后台管理页面（admin-page） ===== */
    .admin-page {
        flex-direction: column;
    }

    .admin-page .admin-sidebar {
        width: 240px;
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .admin-page .admin-sidebar.show {
        transform: translateX(0);
    }

    .admin-page .admin-main {
        margin-left: 0;
        padding: 16px;
    }

    /* ===== 通用 ===== */
    .btn {
        padding: 10px 20px;
        font-size: 14px;
    }
}

/* ========== 响应式：小手机 ========== */
@media (max-width: 480px) {
    .login-box {
        padding: 20px 16px;
    }

    .user-center-tabs a {
        width: 60px;
        height: 60px;
        font-size: 10px;
    }

    .user-center-tabs {
        gap: 6px;
        padding: 10px;
    }

    .message {
        max-width: 90%;
        font-size: 13px;
    }

    .emoji-grid {
        grid-template-columns: repeat(5, 1fr);
    }

    .gift-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .chat-title {
        font-size: 14px;
    }

    .data-table {
        font-size: 12px;
    }

    .data-table th,
    .data-table td {
        padding: 6px 8px;
    }
}

/* ========== 后台管理菜单切换按钮 ========== */
.admin-menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border: none;
    background: white;
    border-radius: 10px;
    color: #374151;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    font-size: 18px;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 101;
}

@media (max-width: 768px) {
    .admin-menu-toggle {
        display: flex;
    }

    .admin-page .page-header,
    .admin-container .admin-header {
        margin-top: 56px;
    }
}

/* ========== 遮罩层 ========== */
.overlay-mask {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    z-index: 99;
}

.overlay-mask.show {
    display: block;
}

