/* ==================== 基础样式 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #667eea;
    --primary-dark: #764ba2;
    --success-color: #27ae60;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --text-color: #333;
    --text-light: #666;
    --bg-color: #f5f5f5;
    --white: #fff;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.2);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    min-height: 100vh;
    color: var(--text-color);
}

/* ==================== 登录页面 ==================== */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    background: var(--white);
    padding: 40px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
}

.login-box .logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-box .logo-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    color: var(--white);
    margin-bottom: 15px;
}

.login-box h1 {
    font-size: 24px;
    color: var(--text-color);
    margin-bottom: 8px;
}

.login-box .subtitle {
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-color);
    font-size: 14px;
    font-weight: 500;
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: var(--white);
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: #6c757d;
}

.btn-secondary:hover {
    background: #5a6268;
    box-shadow: 0 5px 20px rgba(108, 117, 125, 0.4);
}

.btn-danger {
    background: var(--danger-color);
}

.btn-danger:hover {
    box-shadow: 0 5px 20px rgba(231, 76, 60, 0.4);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
    width: auto;
}

.error-msg {
    color: var(--danger-color);
    text-align: center;
    margin-top: 15px;
    font-size: 14px;
}

.success-msg {
    color: var(--success-color);
    text-align: center;
    margin-top: 15px;
    font-size: 14px;
}

/* ==================== 聊天页面 ==================== */
.chat-container {
    display: none;
    flex-direction: column;
    height: 100vh;
}

.chat-header {
    background: var(--white);
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    z-index: 100;
}

.chat-header .logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header .logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--white);
}

.chat-header h1 {
    font-size: 18px;
    color: var(--text-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info .user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f0f0f0;
    border-radius: 20px;
    font-size: 14px;
}

.user-info .user-badge .role {
    padding: 2px 8px;
    background: var(--primary-color);
    color: var(--white);
    border-radius: 10px;
    font-size: 12px;
}

/* 应用选择器 */
.app-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: #f8f9fa;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.app-selector:hover {
    background: #e9ecef;
}

.app-selector .app-icon {
    font-size: 20px;
}

.app-selector .app-name {
    font-size: 14px;
    font-weight: 500;
}

.app-selector .dropdown-icon {
    font-size: 12px;
    color: var(--text-light);
}

.app-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    z-index: 1000;
    display: none;
    margin-top: 8px;
}

.app-dropdown.show {
    display: block;
}

.app-dropdown-item {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: background 0.2s;
}

.app-dropdown-item:hover {
    background: #f5f5f5;
}

.app-dropdown-item.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: var(--white);
}

.app-dropdown-item .app-icon {
    font-size: 20px;
}

.logout-btn {
    padding: 8px 16px;
    background: transparent;
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.logout-btn:hover {
    background: var(--danger-color);
    color: var(--white);
}

.admin-btn {
    padding: 8px 16px;
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.admin-btn:hover {
    background: var(--primary-color);
    color: var(--white);
}

.chat-main {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* 侧边栏 */
.sidebar {
    width: 280px;
    background: var(--white);
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h3 {
    font-size: 16px;
    color: var(--text-color);
}

.new-chat-btn {
    padding: 8px 12px;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
}

.conversation-list {
    flex: 1;
    overflow-y: auto;
}

.conversation-item {
    padding: 15px 20px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
    position: relative;
}

.conversation-item:hover {
    background: #f5f5f5;
}

.conversation-item.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: var(--white);
}

.conversation-item .title {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 30px;
}

.conversation-item .meta {
    font-size: 12px;
    opacity: 0.7;
    display: flex;
    justify-content: space-between;
}

.conversation-item .delete-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.conversation-item:hover .delete-btn {
    opacity: 1;
}

/* 聊天内容 */
.chat-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-color);
}

.chat-welcome {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
    text-align: center;
}

.chat-welcome .welcome-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: var(--white);
    margin-bottom: 20px;
}

.chat-welcome h2 {
    font-size: 24px;
    margin-bottom: 10px;
}

.chat-welcome p {
    color: var(--text-light);
    margin-bottom: 30px;
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.quick-action {
    padding: 12px 20px;
    background: var(--white);
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.quick-action:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.message {
    margin-bottom: 20px;
    display: flex;
    gap: 12px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.message.assistant .message-avatar {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: var(--white);
}

.message.user .message-avatar {
    background: #3498db;
    color: var(--white);
}

.message-content {
    max-width: 70%;
    padding: 15px 20px;
    border-radius: 16px;
    line-height: 1.6;
    font-size: 15px;
}

.message.assistant .message-content {
    background: var(--white);
    box-shadow: var(--shadow);
}

.message.user .message-content {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: var(--white);
}

.message-content pre {
    background: #f5f5f5;
    padding: 10px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 10px 0;
}

.message-content code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}

/* Markdown 样式 */
.message-content h1, .message-content h2, .message-content h3 {
    margin: 16px 0 8px 0;
    font-weight: bold;
}

.message-content h1 { font-size: 1.5em; }
.message-content h2 { font-size: 1.3em; }
.message-content h3 { font-size: 1.1em; }

.message-content ul, .message-content ol {
    margin: 10px 0;
    padding-left: 20px;
}

.message-content li {
    margin: 5px 0;
}

.message-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 16px;
    margin: 10px 0;
    color: var(--text-light);
}

.message-content table {
    border-collapse: collapse;
    margin: 10px 0;
}

.message-content th, .message-content td {
    border: 1px solid #e0e0e0;
    padding: 8px 12px;
}

.message-content th {
    background: #f5f5f5;
}

.message-content a {
    color: var(--primary-color);
    text-decoration: none;
}

.message-content a:hover {
    text-decoration: underline;
}

.message-content img {
    max-width: 100%;
    border-radius: 8px;
    margin: 10px 0;
}

/* 消息中的文件附件 */
.message-files-group {
    margin-bottom: 8px;
}

.message-file {
    margin: 4px 0;
}

.message-file.image-file {
    display: inline-block;
    max-width: 300px;
    cursor: pointer;
}

.message-file.image-file img {
    max-width: 100%;
    max-height: 240px;
    border-radius: 8px;
    object-fit: cover;
    transition: opacity 0.2s;
}

.message-file.image-file:hover img {
    opacity: 0.85;
}

.message-file.image-file.no-url {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f5f5f5;
    border-radius: 8px;
}

.message.user .message-file.image-file.no-url {
    background: rgba(255, 255, 255, 0.2);
}

/* 图片全屏预览 */
.image-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    cursor: pointer;
}

.image-preview-img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
}

.message-file.doc-file {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: #f5f5f5;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    max-width: 260px;
    overflow: hidden;
}

.message.user .message-file.doc-file {
    background: rgba(255, 255, 255, 0.2);
}

.message-file.doc-file:hover {
    background: #e8e8e8;
}

.message.user .message-file.doc-file:hover {
    background: rgba(255, 255, 255, 0.3);
}

.message-file.doc-file.no-url {
    cursor: default;
}

.message-file .file-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.message-file .file-name {
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 文件上传区域 */
.input-area {
    padding: 20px;
    background: var(--white);
    border-top: 1px solid #e0e0e0;
}

.input-wrapper {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.input-wrapper textarea {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 15px;
    resize: none;
    outline: none;
    font-family: inherit;
    max-height: 150px;
    line-height: 1.5;
}

.input-wrapper textarea:focus {
    border-color: var(--primary-color);
}

.input-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.upload-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f5f5f5;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    color: #666;
}

.upload-btn:hover {
    background: #e0e0e0;
    color: var(--primary-color);
}

.upload-btn svg {
    width: 20px;
    height: 20px;
}

.send-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: var(--white);
    border: none;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.3s;
    flex-shrink: 0;
}

.send-btn:hover:not(:disabled) {
    transform: scale(1.05);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 文件预览 */
.file-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
}

.file-preview-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f5f5f5;
    border-radius: 8px;
    font-size: 13px;
}

.file-preview-item img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
}

.file-preview-item .remove-btn {
    cursor: pointer;
    color: var(--danger-color);
    font-size: 16px;
}

/* 加载动画 */
.typing {
    display: flex;
    gap: 5px;
    padding: 15px 20px;
}

.typing span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing span:nth-child(1) { animation-delay: -0.32s; }
.typing span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* ==================== 管理面板 ==================== */
.admin-container {
    display: none;
    padding: 20px;
    background: var(--bg-color);
    min-height: 100vh;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.admin-header h1 {
    font-size: 24px;
    color: var(--text-color);
}

.admin-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.admin-tab {
    padding: 10px 20px;
    background: var(--white);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.admin-tab.active {
    background: var(--primary-color);
    color: var(--white);
}

.admin-section {
    background: var(--white);
    padding: 24px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.admin-section h2 {
    margin-bottom: 20px;
    color: var(--text-color);
    font-size: 18px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

/* 表格 */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.data-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: var(--text-color);
}

.data-table tr:hover {
    background: #f8f9fa;
}

.status-active {
    color: var(--success-color);
    font-weight: 500;
}

.status-inactive {
    color: var(--danger-color);
    font-weight: 500;
}

.action-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    margin-right: 5px;
    margin-bottom: 5px;
    transition: all 0.3s;
}

.action-btn.edit {
    background: #3498db;
    color: var(--white);
}

.action-btn.delete {
    background: var(--danger-color);
    color: var(--white);
}

.action-btn.success {
    background: var(--success-color);
    color: var(--white);
}

.action-btn:hover {
    opacity: 0.8;
}

/* 标签样式 */
.tag {
    display: inline-block;
    padding: 4px 10px;
    background: #e9ecef;
    border-radius: 12px;
    font-size: 12px;
    margin: 2px;
    cursor: pointer;
}

.tag.primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: var(--white);
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--white);
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    text-align: center;
}

.stat-card .stat-value {
    font-size: 32px;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.stat-card .stat-label {
    color: var(--text-light);
    font-size: 14px;
}

/* ==================== 模态框 ==================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--white);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: auto;
    transform: scale(0.9);
    transition: transform 0.3s;
}

.modal-overlay.show .modal {
    transform: scale(1);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 18px;
    color: var(--text-color);
}

.modal-header .close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-light);
    transition: color 0.3s;
}

.modal-header .close-btn:hover {
    color: var(--danger-color);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.modal-lg {
    max-width: 800px;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #f8f9fa;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.checkbox-item:hover {
    background: #e9ecef;
}

.checkbox-item.checked {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: var(--white);
}

.checkbox-item input {
    display: none;
}

/* 图标选择器 */
.icon-picker {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 8px;
    margin-top: 10px;
}

.icon-picker-item {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.icon-picker-item:hover {
    border-color: var(--primary-color);
    background: #f5f5f5;
}

.icon-picker-item.selected {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
}

/* ==================== Toast 提示 ==================== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    min-width: 280px;
    max-width: 400px;
    padding: 14px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toastIn 0.3s ease;
    font-size: 14px;
}

.toast.toast-out {
    animation: toastOut 0.3s ease forwards;
}

.toast-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
}

.toast.info {
    background: #e8f4fd;
    color: #1976d2;
    border-left: 4px solid #1976d2;
}

.toast.success {
    background: #e8f5e9;
    color: #2e7d32;
    border-left: 4px solid #2e7d32;
}

.toast.warning {
    background: #fff3e0;
    color: #e65100;
    border-left: 4px solid #e65100;
}

.toast.error {
    background: #ffebee;
    color: #c62828;
    border-left: 4px solid #c62828;
}

@keyframes toastIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* ==================== 侧边栏切换按钮 ==================== */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    color: var(--text-color);
    border-radius: 6px;
}

.sidebar-toggle:hover {
    background: #f0f0f0;
}

/* 侧边栏遮罩层 */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 200;
}

.sidebar-overlay.show {
    display: block;
}

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
    .sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        height: 100%;
        z-index: 300;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: none;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
    }

    .chat-header h1 {
        font-size: 16px;
    }

    .user-info .user-badge {
        display: none;
    }

    .user-info .app-name {
        max-width: 80px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .message-content {
        max-width: 85%;
    }

    .message-file.image-file {
        max-width: 200px;
    }

    .admin-container {
        padding: 10px;
    }

    .modal {
        width: 95%;
        margin: 10px;
    }

    .icon-picker {
        grid-template-columns: repeat(6, 1fr);
    }

    .input-wrapper textarea {
        font-size: 14px;
        padding: 12px 16px;
    }

    .chat-header {
        padding: 10px 16px;
    }
}

@media (max-width: 480px) {
    .user-info .app-selector {
        max-width: 120px;
    }

    .admin-btn {
        display: none !important;
    }

    .quick-actions {
        flex-wrap: wrap;
    }

    .quick-action {
        font-size: 12px;
        padding: 8px 12px;
    }
}

/* ==================== 工具类 ==================== */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.ml-10 { margin-left: 10px; }
.mr-10 { margin-right: 10px; }

.flex { display: flex; }
.flex-between { justify-content: space-between; }
.flex-center { justify-content: center; }
.items-center { align-items: center; }
.gap-10 { gap: 10px; }

.relative { position: relative; }

/* API Key 掩码样式 */
.api-key-display {
    font-family: monospace;
    background: #f5f5f5;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    color: #666;
}

/* 会话管理表格 */
.conversation-detail {
    max-height: 400px;
    overflow-y: auto;
}

.conversation-message {
    padding: 12px;
    margin: 8px 0;
    border-radius: 8px;
}

.conversation-message.user {
    background: #e3f2fd;
    margin-left: 20px;
}

.conversation-message.assistant {
    background: #f5f5f5;
    margin-right: 20px;
}

.conversation-message .role {
    font-weight: bold;
    margin-bottom: 4px;
    font-size: 12px;
    color: var(--text-light);
}

.conversation-message .time {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
}

/* 已删除会话行样式 */
.deleted-row {
    background-color: #fff5f5 !important;
    opacity: 0.8;
}

.deleted-row:hover {
    background-color: #ffe6e6 !important;
}

.deleted-row td {
    color: #999;
}

/* ==================== 配额管理样式 ==================== */

.quota-card {
    background: var(--white);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.quota-card h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
}

.quota-info {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.quota-detail {
    display: flex;
    align-items: center;
    gap: 8px;
}

.quota-detail .label {
    color: #666;
    font-size: 14px;
}

.quota-detail .value {
    font-weight: 600;
}

.quota-section {
    margin-top: 24px;
}

.quota-section h3 {
    margin-bottom: 8px;
}

.quota-section .hint {
    color: #888;
    font-size: 13px;
    margin-bottom: 12px;
}

/* 统计筛选 */
.stats-filters {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stats-filters input[type="date"] {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.stats-section {
    margin-top: 24px;
    background: var(--white);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.stats-section h3 {
    margin: 0 0 16px 0;
}

/* 进度条样式 */
.progress-bar-container {
    width: 100px;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
    margin-right: 8px;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-bar-fill.green { background: #4CAF50; }
.progress-bar-fill.yellow { background: #FF9800; }
.progress-bar-fill.red { background: #f44336; }

/* 分页样式 */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
}

.pagination-btns {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pagination-btns .btn {
    min-width: 70px;
}
