/* ========================================
   仿豆包AI助手 - 样式表
   ======================================== */

/* CSS Variables */
:root {
    --primary: #4E54C8;
    --primary-hover: #3d42a8;
    --secondary: #8B5CF6;
    --bg-main: #F7F8FA;
    --bg-sidebar: #F0F1F5;
    --bg-card: #FFFFFF;
    --text-primary: #1F2329;
    --text-secondary: #646A73;
    --text-muted: #8F959E;
    --border: #E5E6EB;
    --success: #10B981;
    --error: #EF4444;
    --warning: #F59E0B;
    --user-bubble: #4E54C8;
    --ai-bubble: #F0F1F5;
    --shadow-card: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.1);
    --radius-card: 12px;
    --radius-btn: 8px;
    --radius-input: 12px;
    --radius-bubble: 16px;
    --sidebar-width: 260px;
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    font-family: var(--font-family);
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-main);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* App Container */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ========================================
   Sidebar
   ======================================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: transform 0.3s ease;
    z-index: 100;
}

.sidebar-header {
    padding: 20px 16px 12px;
    border-bottom: 1px solid var(--border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    font-weight: 700;
}

.logo-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.btn-new-chat {
    width: 100%;
    padding: 10px 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-btn);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-new-chat:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-hover);
}

/* Sidebar Navigation */
.sidebar-nav {
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-btn);
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
    font-size: 14px;
}

.nav-item:hover {
    background: rgba(78, 84, 200, 0.06);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(78, 84, 200, 0.1);
    color: var(--primary);
    font-weight: 500;
}

/* Conversation List */
.sidebar-conversations {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    border-top: 1px solid var(--border);
    margin-top: 4px;
}

.conv-header {
    padding: 8px 12px;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.conv-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.conv-item {
    padding: 10px 12px;
    border-radius: var(--radius-btn);
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.conv-item:hover {
    background: rgba(0,0,0,0.04);
}

.conv-item.active {
    background: rgba(78, 84, 200, 0.08);
}

.conv-item-title {
    flex: 1;
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conv-item-delete {
    opacity: 0;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
    transition: all 0.15s ease;
    font-size: 16px;
    line-height: 1;
}

.conv-item:hover .conv-item-delete {
    opacity: 1;
}

.conv-item-delete:hover {
    color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

/* Sidebar Footer - User Login Area */
.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
}

.user-login-area { display: flex; flex-direction: column; }

.user-not-logged {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 10px;
    background: var(--bg-main);
}

.user-avatar-placeholder {
    width: 36px; height: 36px; border-radius: 50%;
    background: #E5E7EB; display: flex; align-items: center;
    justify-content: center; color: #9CA3AF; flex-shrink: 0;
}

.user-login-hint { display: flex; flex-direction: column; gap: 2px; }
.login-hint-text { font-size: 13px; color: var(--text-secondary); }

.btn-login-link {
    background: none; border: none; color: var(--primary);
    font-size: 13px; font-weight: 500; cursor: pointer; padding: 0; text-align: left;
}
.btn-login-link:hover { text-decoration: underline; }

.user-logged {
    display: flex; align-items: center; gap: 12px;
    padding: 8px 12px; border-radius: 10px; background: var(--bg-main);
}

.user-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #8B5CF6);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 600; font-size: 14px; flex-shrink: 0;
}

.user-info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 500; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.btn-logout { background: none; border: none; color: var(--text-secondary); font-size: 12px; cursor: pointer; padding: 0; text-align: left; }
.btn-logout:hover { color: #EF4444; }

/* Auth Modal */
.auth-modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4); backdrop-filter: blur(4px);
    display: none; align-items: center; justify-content: center; z-index: 1000;
}
.auth-modal-overlay.active { display: flex; }

.auth-modal {
    background: #fff; border-radius: 16px; padding: 32px;
    width: 400px; max-width: 90vw;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    position: relative; animation: modalSlideIn 0.25s ease-out;
}
@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(20px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-modal-close {
    position: absolute; top: 16px; right: 16px;
    background: none; border: none; font-size: 24px;
    color: var(--text-secondary); cursor: pointer;
    width: 32px; height: 32px; display: flex;
    align-items: center; justify-content: center; border-radius: 8px;
}
.auth-modal-close:hover { background: var(--bg-main); }

.auth-modal-header { text-align: center; margin-bottom: 24px; }
.auth-modal-header h2 { font-size: 22px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.auth-modal-header p { font-size: 14px; color: var(--text-secondary); }

.auth-tabs { display: flex; margin-bottom: 24px; border-bottom: 1px solid var(--border-color); }
.auth-tab {
    flex: 1; padding: 10px; background: none; border: none;
    border-bottom: 2px solid transparent; font-size: 14px;
    font-weight: 500; color: var(--text-secondary); cursor: pointer; transition: all 0.2s;
}
.auth-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.auth-form .form-group { margin-bottom: 16px; }
.auth-form label { display: block; font-size: 13px; font-weight: 500; color: var(--text-primary); margin-bottom: 6px; }
.auth-form input {
    width: 100%; padding: 10px 14px; border: 1px solid var(--border-color);
    border-radius: 10px; font-size: 14px; color: var(--text-primary);
    background: var(--bg-main); outline: none; transition: border-color 0.2s; box-sizing: border-box;
}
.auth-form input:focus { border-color: var(--primary); background: #fff; }

.auth-error { font-size: 13px; color: #EF4444; min-height: 20px; margin-bottom: 8px; }
.auth-submit-btn {
    width: 100%; padding: 12px;
    background: linear-gradient(135deg, var(--primary), #8B5CF6);
    color: #fff; border: none; border-radius: 10px;
    font-size: 15px; font-weight: 500; cursor: pointer; transition: opacity 0.2s;
}
.auth-submit-btn:hover { opacity: 0.9; }
.auth-submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ========================================
   Main Content
   ======================================== */
.main-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.mode-panel {
    display: none;
    flex: 1;
    overflow: hidden;
}

.mode-panel.active {
    display: flex;
    flex-direction: column;
}

/* ========================================
   Chat Mode
   ======================================== */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 40px;
}

.welcome-icon {
    width: 80px;
    height: 80px;
    background: rgba(78, 84, 200, 0.08);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

.welcome-screen h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.welcome-screen p {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    max-width: 600px;
}

.quick-btn {
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.quick-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(78, 84, 200, 0.04);
    transform: translateY(-1px);
    box-shadow: var(--shadow-card);
}

.quick-btn-icon {
    font-size: 16px;
    line-height: 1;
}

/* Messages */
.message {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
    font-weight: 600;
}

.message.user .message-avatar {
    background: var(--primary);
    color: white;
}

.message.assistant .message-avatar {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}

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

.message-bubble {
    padding: 12px 16px;
    border-radius: var(--radius-bubble);
    line-height: 1.6;
    font-size: 14px;
    word-wrap: break-word;
}

.message.user .message-bubble {
    background: var(--user-bubble);
    color: white;
    border-top-left-radius: 4px;
}

.message.assistant .message-bubble {
    background: var(--ai-bubble);
    color: var(--text-primary);
    border-top-left-radius: 4px;
}

.message-bubble p {
    margin-bottom: 8px;
}

.message-bubble p:last-child {
    margin-bottom: 0;
}

.message-bubble pre {
    background: #1e1e2e;
    color: #cdd6f4;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
    font-size: 13px;
    line-height: 1.5;
}

.message-bubble code {
    font-family: "JetBrains Mono", "Fira Code", monospace;
    font-size: 13px;
}

.message-bubble :not(pre) > code {
    background: rgba(0,0,0,0.06);
    padding: 2px 6px;
    border-radius: 4px;
}

.message-bubble ul, .message-bubble ol {
    padding-left: 20px;
    margin: 8px 0;
}

.message-bubble li {
    margin-bottom: 4px;
}

.message-time {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    padding-left: 4px;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
    opacity: 0.4;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Chat Input */
.chat-upload-area {
    padding: 12px 24px 0;
    background: var(--bg-main);
}

.chat-upload-file {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #F0F1F5;
    border-radius: 10px;
    font-size: 13px;
    color: var(--text-primary);
}

.chat-upload-file svg {
    flex-shrink: 0;
    color: var(--primary);
}

.chat-upload-size {
    color: var(--text-secondary);
    font-size: 12px;
    margin-left: auto;
}

.chat-upload-remove {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 0 2px;
    transition: color 0.2s;
}

.chat-upload-remove:hover {
    color: #EF4444;
}

.file-attachment-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: rgba(255,255,255,0.2);
    border-radius: 6px;
    font-size: 12px;
    margin-bottom: 6px;
    opacity: 0.9;
}

.file-attachment-tag svg {
    flex-shrink: 0;
}

.chat-input-area {
    padding: 16px 24px 24px;
    background: var(--bg-main);
    border-top: 1px solid var(--border);
}

.input-wrapper {
    max-width: 800px;
    margin: 0 auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-input);
    padding: 12px 16px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(78, 84, 200, 0.1);
}

.input-wrapper textarea {
    width: 100%;
    border: none;
    outline: none;
    resize: none;
    font-size: 14px;
    line-height: 1.5;
    font-family: var(--font-family);
    color: var(--text-primary);
    background: transparent;
    min-height: 24px;
    max-height: 200px;
}

.input-wrapper textarea::placeholder {
    color: var(--text-muted);
}

.input-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}

.input-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    border-radius: var(--radius-btn);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.input-btn:hover {
    background: var(--bg-sidebar);
    color: var(--primary);
}

.input-btn.recording {
    background: #fee2e2;
    color: #dc2626;
    animation: pulse-recording 1.5s infinite;
}

@keyframes pulse-recording {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.send-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-btn);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.send-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ========================================
   Document Mode
   ======================================== */
.content-container {
    flex: 1;
    overflow-y: auto;
    padding: 32px 24px;
}

.panel-header {
    text-align: center;
    margin-bottom: 32px;
}

.panel-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.panel-header p {
    color: var(--text-secondary);
}

.doc-input-section, .analysis-input-section {
    max-width: 700px;
    margin: 0 auto;
}

.doc-type-selector {
    display: flex;
    gap: 8px;
}

.doc-type-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 22px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.25s ease;
}

.doc-type-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(78, 84, 200, 0.04);
}

.doc-type-btn.active {
    background: linear-gradient(135deg, var(--primary) 0%, #8B5CF6 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(78, 84, 200, 0.3);
}

.doc-input-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
    transition: box-shadow 0.3s ease;
}

.doc-input-wrapper:focus-within {
    box-shadow: 0 4px 24px rgba(78, 84, 200, 0.12);
    border-color: rgba(78, 84, 200, 0.3);
}

.doc-input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
}

/* AI生图专属样式 */
.image-input-section {
    background: linear-gradient(135deg, #ffffff 0%, #fafbff 100%);
    border: 1px solid rgba(78, 84, 200, 0.1);
    box-shadow: 0 4px 20px rgba(78, 84, 200, 0.06);
    padding: 20px;
    border-radius: 16px;
}

.image-input-section textarea {
    min-height: 80px;
    font-size: 15px;
    padding: 12px 16px;
    background: rgba(247, 248, 250, 0.6);
    border: 1px solid rgba(229, 230, 235, 0.8);
    border-radius: 10px;
    transition: all 0.2s ease;
}

.image-input-section textarea:focus {
    background: #fff;
    border-color: rgba(78, 84, 200, 0.3);
    box-shadow: 0 0 0 3px rgba(78, 84, 200, 0.08);
}

.image-options-row {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(229, 230, 235, 0.6);
}

.image-options-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.image-options-group label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.image-options-group select {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
    background: white;
    color: var(--text-primary);
    cursor: pointer;
    min-width: 130px;
    transition: all 0.2s ease;
}

.image-options-group select:hover {
    border-color: var(--primary-color);
}

.image-options-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(78, 84, 200, 0.1);
}

.image-options-actions {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    margin-left: auto;
}

.image-clear-btn {
    padding: 10px 20px;
    background: white;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.image-clear-btn:hover {
    background: #f5f5f5;
    color: var(--text-primary);
    border-color: #ccc;
}

.image-generate-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 28px;
    background: linear-gradient(135deg, #4E54C8 0%, #8B5CF6 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(78, 84, 200, 0.3);
    white-space: nowrap;
}

.image-generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(78, 84, 200, 0.4);
}

.image-generate-btn:active {
    transform: translateY(0);
}

.image-generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.doc-input-wrapper textarea, .image-input-section textarea {
    width: 100%;
    border: none;
    outline: none;
    resize: none;
    font-size: 14px;
    line-height: 1.6;
    font-family: var(--font-family);
    color: var(--text-primary);
    background: transparent;
}

.doc-input-wrapper textarea::placeholder, .image-input-section textarea::placeholder {
    color: var(--text-muted);
}

.image-options {
    display: flex;
    gap: 12px;
    margin: 12px 0;
}

.image-options select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-btn);
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--bg-main);
    cursor: pointer;
    outline: none;
}

/* Buttons */
.btn-primary {
    padding: 10px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-btn);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    margin-top: 12px;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-hover);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    padding: 8px 16px;
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-btn);
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Document Result */
.doc-result {
    max-width: 700px;
    margin: 24px auto 0;
    background: var(--bg-card);
    border-radius: var(--radius-card);
    padding: 24px;
    box-shadow: var(--shadow-card);
}

.doc-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.doc-result-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.doc-result-content {
    line-height: 1.8;
    color: var(--text-primary);
}

/* ========================================
   Analysis Mode
   ======================================== */
.analysis-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    background: var(--bg-sidebar);
    padding: 4px;
    border-radius: var(--radius-btn);
    width: fit-content;
}

.analysis-tab {
    padding: 8px 20px;
    border: none;
    background: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.analysis-tab.active {
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.file-upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius-card);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg-card);
}

.file-upload-area:hover {
    border-color: var(--primary);
    background: rgba(78, 84, 200, 0.02);
}

.file-upload-area p {
    margin: 12px 0 4px;
    color: var(--text-primary);
    font-weight: 500;
}

.file-upload-area span {
    font-size: 12px;
    color: var(--text-muted);
}

.uploaded-file {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-btn);
    margin-top: 12px;
}

.uploaded-file span {
    flex: 1;
    font-size: 13px;
}

.btn-remove-file {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    padding: 0 4px;
}

.btn-remove-file:hover {
    color: var(--error);
}

.analysis-question {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.analysis-question input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-input);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

.analysis-question input:focus {
    border-color: var(--primary);
}

.analysis-question .btn-primary {
    margin-top: 0;
    white-space: nowrap;
}

.analysis-tab-content textarea {
    width: 100%;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    resize: none;
    font-size: 14px;
    line-height: 1.6;
    font-family: var(--font-family);
    outline: none;
    transition: border-color 0.2s ease;
}

.analysis-tab-content textarea:focus {
    border-color: var(--primary);
}

.analysis-result {
    max-width: 700px;
    margin: 24px auto 0;
    background: var(--bg-card);
    border-radius: var(--radius-card);
    padding: 24px;
    box-shadow: var(--shadow-card);
}

/* ========================================
   Image Mode
   ======================================== */
.image-result {
    max-width: 800px;
    margin: 24px auto 0;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.image-grid img {
    width: 100%;
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.image-grid img:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-hover);
}

/* ========================================
   Loading
   ======================================== */
.loading-indicator {
    text-align: center;
    padding: 40px;
    max-width: 700px;
    margin: 0 auto;
}

.loading-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
}

.loading-dots span {
    width: 10px;
    height: 10px;
    background: var(--primary);
    border-radius: 50%;
    animation: loadingBounce 1.4s infinite ease-in-out;
}

.loading-dots span:nth-child(2) { animation-delay: 0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0.32s; }

@keyframes loadingBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

.loading-indicator p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ========================================
   Modal
   ======================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-card);
    width: 90%;
    max-width: 480px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px 24px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-btn);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

.form-group input:focus {
    border-color: var(--primary);
}

.form-group small {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-muted);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px 20px;
    border-top: 1px solid var(--border);
}

.modal-footer .btn-secondary {
    margin: 0;
}

/* ========================================
   Markdown Body
   ======================================== */
.markdown-body h1, .markdown-body h2, .markdown-body h3 {
    margin: 16px 0 8px;
    font-weight: 600;
}

.markdown-body h1 { font-size: 20px; }
.markdown-body h2 { font-size: 18px; }
.markdown-body h3 { font-size: 16px; }

.markdown-body p {
    margin-bottom: 8px;
    line-height: 1.7;
}

.markdown-body ul, .markdown-body ol {
    padding-left: 20px;
    margin-bottom: 8px;
}

.markdown-body pre {
    background: #1e1e2e;
    color: #cdd6f4;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 12px 0;
}

.markdown-body code {
    font-family: "JetBrains Mono", "Fira Code", monospace;
    font-size: 13px;
}

.markdown-body :not(pre) > code {
    background: rgba(0,0,0,0.06);
    padding: 2px 6px;
    border-radius: 4px;
}

.markdown-body blockquote {
    border-left: 3px solid var(--primary);
    padding-left: 16px;
    margin: 12px 0;
    color: var(--text-secondary);
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
}

.markdown-body th, .markdown-body td {
    border: 1px solid var(--border);
    padding: 8px 12px;
    text-align: left;
}

.markdown-body th {
    background: var(--bg-sidebar);
    font-weight: 600;
}

/* ========================================
   Mobile
   ======================================== */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 200;
    width: 40px;
    height: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-btn);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-card);
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .mobile-menu-btn {
        display: flex;
    }

    .chat-messages {
        padding: 16px;
    }

    .chat-input-area {
        padding: 12px 16px 16px;
    }

    .content-container {
        padding: 24px 16px;
    }

    .quick-actions {
        flex-direction: column;
    }

    .analysis-question {
        flex-direction: column;
    }

    .image-grid {
        grid-template-columns: 1fr;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.12);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.2);
}


/* ===== 后台管理入口 ===== */
.btn-admin {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
    margin-bottom: 8px;
}

.btn-admin:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.btn-admin-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(198, 40, 40, 0.1);
    color: #c62828;
    text-decoration: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-admin-link:hover {
    background: rgba(198, 40, 40, 0.2);
}

/* ===== 溯源面板 ===== */
.trace-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px;
}

/* 溯源页面 - Hero 区域 */
.trace-hero-section {
    background: linear-gradient(135deg, #4E54C8 0%, #8B5CF6 100%);
    border-radius: 16px;
    padding: 40px 32px;
    color: white;
    text-align: center;
    margin-bottom: 24px;
}
.trace-hero-content h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    color: white;
}
.trace-hero-content p {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 24px;
}
.trace-hero-badge {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(255,255,255,0.2);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 12px;
}
.trace-search-row {
    display: flex;
    gap: 12px;
    max-width: 600px;
    margin: 0 auto;
}
.trace-search-input-wrap {
    flex: 1;
    position: relative;
}
.trace-search-input-wrap .trace-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #9CA3AF;
}
.trace-search-input-wrap input {
    width: 100%;
    padding: 12px 14px 12px 42px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    background: rgba(255,255,255,0.95);
    color: #1F2329;
    box-sizing: border-box;
}
.trace-search-input-wrap input::placeholder {
    color: #9CA3AF;
}
.trace-search-row .btn-primary {
    padding: 12px 24px;
    border-radius: 10px;
    background: white;
    color: #4E54C8;
    border: none;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: transform 0.2s, box-shadow 0.2s;
}
.trace-search-row .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.trace-search-tips {
    margin-top: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}
.trace-search-tips span {
    font-size: 12px;
    opacity: 0.8;
}
.trace-sample-code {
    padding: 4px 10px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 6px;
    font-size: 12px;
    color: white;
    cursor: pointer;
    transition: background 0.2s;
}
.trace-sample-code:hover {
    background: rgba(255,255,255,0.25);
}

@media (max-width: 768px) {
    .trace-hero-section {
        padding: 24px 16px;
    }
    .trace-hero-content h2 {
        font-size: 20px;
    }
    .trace-search-row {
        flex-direction: column;
    }
}
.trace-hero-inline {
    text-align: center;
    padding: 32px 24px;
    background: linear-gradient(135deg, #4E54C8 0%, #8B5CF6 100%);
    border-radius: 16px;
    color: white;
    margin-bottom: 24px;
}
.trace-hero-inline h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}
.trace-hero-inline p {
    font-size: 14px;
    opacity: 0.85;
    margin-bottom: 20px;
}
.trace-search-row {
    display: flex;
    gap: 8px;
    max-width: 500px;
    margin: 0 auto;
}
.trace-search-row input {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    background: white;
    color: #1F2329;
    outline: none;
}
.trace-search-row .btn-primary {
    padding: 12px 24px;
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    border-radius: 10px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}
.trace-search-row .btn-primary:hover {
    background: rgba(255,255,255,0.3);
}
.trace-result {
    background: white;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.trace-result h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
}
.trace-result .trace-code-badge {
    display: inline-block;
    background: #EEF2FF;
    color: #4E54C8;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 16px;
}
.trace-info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}
.trace-info-item {
    padding: 10px 14px;
    background: #F7F8FA;
    border-radius: 8px;
}
.trace-info-item .label {
    font-size: 11px;
    color: #646A73;
    margin-bottom: 2px;
}
.trace-info-item .value {
    font-size: 13px;
    font-weight: 500;
    color: #1F2329;
}
.trace-timeline {
    position: relative;
    padding-left: 24px;
}
.trace-timeline::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: linear-gradient(to bottom, #4E54C8, #8B5CF6);
    border-radius: 1px;
}
.trace-timeline-item {
    position: relative;
    padding-bottom: 16px;
}
.trace-timeline-item:last-child { padding-bottom: 0; }
.trace-timeline-item::before {
    content: '';
    position: absolute;
    left: -21px;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: white;
    border: 2px solid #4E54C8;
}
.trace-timeline-item .event-time {
    font-size: 11px;
    color: #646A73;
}
.trace-timeline-item .event-title {
    font-size: 13px;
    font-weight: 500;
    color: #1F2329;
}
.trace-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}
.trace-col {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.trace-col h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #1F2329;
}
.trace-form .trace-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.trace-form .form-group {
    margin-bottom: 12px;
}
.trace-form label {
    display: block;
    font-size: 12px;
    color: #646A73;
    margin-bottom: 4px;
    font-weight: 500;
}
.trace-form input,
.trace-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #E5E6EB;
    border-radius: 8px;
    font-size: 13px;
    color: #1F2329;
    background: #F7F8FA;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}
.trace-form input:focus,
.trace-form textarea:focus {
    border-color: #4E54C8;
    background: white;
}
.trace-form textarea {
    height: 60px;
    resize: vertical;
}
.trace-records {
    max-height: 400px;
    overflow-y: auto;
}
.trace-record-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-radius: 10px;
    background: #F7F8FA;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
}
.trace-record-item:hover {
    background: #EEF2FF;
    transform: translateX(4px);
}
.trace-record-item .record-name {
    font-size: 13px;
    font-weight: 500;
    color: #1F2329;
}
.trace-record-item .record-meta {
    font-size: 11px;
    color: #646A73;
    margin-top: 2px;
}
.trace-record-item .record-code {
    font-size: 11px;
    color: #4E54C8;
    background: white;
    padding: 3px 8px;
    border-radius: 5px;
    font-weight: 500;
    white-space: nowrap;
}
/* 溯源页面 - 数据统计区 */
.trace-stats-section {
    margin-top: 32px;
}
.trace-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}
.trace-stat-card {
    background: white;
    border: 1px solid #E5E6EB;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: transform 0.2s, box-shadow 0.2s;
}
.trace-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}
.trace-stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.trace-stat-info {
    display: flex;
    flex-direction: column;
}
.trace-stat-value {
    font-size: 22px;
    font-weight: 700;
    color: #1F2329;
    line-height: 1.2;
}
.trace-stat-label {
    font-size: 12px;
    color: #646A73;
    margin-top: 2px;
}

/* 溯源页面 - 流程介绍 */
.trace-process-section {
    margin-top: 40px;
}
.trace-section-title {
    font-size: 18px;
    font-weight: 600;
    color: #1F2329;
    margin-bottom: 20px;
    text-align: center;
}
.trace-process-steps {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 0;
    flex-wrap: wrap;
}
.trace-process-step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: white;
    border: 1px solid #E5E6EB;
    border-radius: 12px;
    flex: 1;
    min-width: 180px;
    max-width: 220px;
}
.trace-step-num {
    font-size: 24px;
    font-weight: 800;
    color: #4E54C8;
    opacity: 0.3;
    line-height: 1;
    flex-shrink: 0;
}
.trace-step-content h4 {
    font-size: 14px;
    font-weight: 600;
    color: #1F2329;
    margin-bottom: 6px;
}
.trace-step-content p {
    font-size: 12px;
    color: #646A73;
    line-height: 1.5;
}
.trace-process-connector {
    width: 24px;
    height: 2px;
    background: linear-gradient(90deg, #4E54C8, #8B5CF6);
    margin-top: 28px;
    flex-shrink: 0;
    opacity: 0.4;
}

/* 溯源页面 - 功能特色 */
.trace-features-section {
    margin-top: 40px;
}
.trace-intro-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}
.trace-intro-card {
    background: white;
    border: 1px solid #E5E6EB;
    border-radius: 12px;
    padding: 24px 20px;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}
.trace-intro-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(78, 84, 200, 0.1);
}
.trace-intro-icon {
    font-size: 28px;
    color: #4E54C8;
    margin-bottom: 12px;
}
.trace-intro-card h4 {
    font-size: 15px;
    font-weight: 600;
    color: #1F2329;
    margin-bottom: 8px;
}
.trace-intro-card p {
    font-size: 13px;
    color: #646A73;
    line-height: 1.5;
}

/* 溯源页面 - 底部信息 */
.trace-footer-section {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid #E5E6EB;
}
.trace-footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 32px;
    margin-bottom: 24px;
}
.trace-footer-col h4 {
    font-size: 14px;
    font-weight: 600;
    color: #1F2329;
    margin-bottom: 12px;
}
.trace-footer-col p {
    font-size: 13px;
    color: #646A73;
    line-height: 1.6;
}
.trace-footer-col ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.trace-footer-col ul li {
    font-size: 13px;
    color: #646A73;
    line-height: 1.8;
}
.trace-footer-col ul li a {
    color: #646A73;
    text-decoration: none;
    transition: color 0.2s;
}
.trace-footer-col ul li a:hover {
    color: #4E54C8;
}
.trace-footer-bottom {
    padding-top: 16px;
    border-top: 1px solid #E5E6EB;
    text-align: center;
}
.trace-footer-bottom p {
    font-size: 12px;
    color: #9CA3AF;
    margin: 0;
}
.trace-footer-bottom a {
    color: #4E54C8;
    text-decoration: none;
}

@media (max-width: 768px) {
    .trace-body { grid-template-columns: 1fr; }
    .trace-info-grid { grid-template-columns: 1fr; }
    .trace-form .trace-form-row { grid-template-columns: 1fr; }
    .trace-intro-grid { grid-template-columns: 1fr 1fr; }
    .trace-stats-grid { grid-template-columns: 1fr 1fr; }
    .trace-process-steps { flex-direction: column; align-items: stretch; }
    .trace-process-step { max-width: 100%; }
    .trace-process-connector { width: 2px; height: 20px; margin: 0 auto; }
    .trace-footer-grid { grid-template-columns: 1fr; gap: 24px; }
}

/* ===== AI 作品展示区 ===== */
.image-gallery-section {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--border-color);
}

.gallery-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 24px;
}

.gallery-tab {
    padding: 6px 16px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.gallery-tab:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.gallery-tab.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.gallery-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 4/3;
    background: var(--bg-secondary);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.gallery-item:hover img {
    transform: scale(1.08);
}

.gallery-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0.1) 50%, transparent 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 16px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

.gallery-tag {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(255,255,255,0.9);
    color: var(--primary-color);
    font-size: 12px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 20px;
}

.gallery-overlay h4 {
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.gallery-overlay p {
    color: rgba(255,255,255,0.85);
    font-size: 13px;
}

/* 图片详情弹窗 */
.gallery-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
}

.gallery-modal-content {
    position: relative;
    background: #fff;
    border-radius: 16px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.gallery-modal-content img {
    width: 100%;
    max-height: 500px;
    object-fit: contain;
    background: #f5f5f5;
}

.gallery-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.5);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background 0.2s;
}

.gallery-modal-close:hover {
    background: rgba(0,0,0,0.7);
}

.gallery-modal-info {
    padding: 20px 24px;
}

.gallery-modal-info h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.gallery-modal-info p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.6;
}

/* ===== 文章库展示区 - 高端杂志风格 ===== */
.article-library-section {
    margin-top: 56px;
    padding-top: 40px;
    border-top: none;
    position: relative;
}

.article-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 32px;
}

.article-tab {
    padding: 8px 20px;
    border-radius: 24px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
}

.article-tab:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-1px);
}

.article-tab.active {
    background: linear-gradient(135deg, var(--primary-color), #8B5CF6);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(78, 84, 200, 0.25);
}

.article-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.article-card {
    background: #fff;
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 16px;
    padding: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.article-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), #8B5CF6, #EC4899);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.article-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(78, 84, 200, 0.12);
    border-color: transparent;
}

.article-card:hover::before {
    opacity: 1;
}

.article-card-top {
    padding: 24px 24px 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.article-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    background: linear-gradient(135deg, rgba(78,84,200,0.08), rgba(139,92,246,0.12));
}

.article-card-meta {
    text-align: right;
}

.article-card-cat {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 2px;
}

.article-card-words {
    font-size: 11px;
    color: var(--text-secondary);
    opacity: 0.7;
}

.article-card-body {
    padding: 0 24px;
    flex: 1;
    cursor: pointer;
}

.article-card-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-card-summary {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 20px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-card-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(0,0,0,0.04);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.article-btn-read {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 16px;
    border-radius: 8px;
    border: 1px solid rgba(78, 84, 200, 0.2);
    background: rgba(78, 84, 200, 0.06);
    color: var(--primary-color);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
}

.article-btn-read:hover {
    background: rgba(78, 84, 200, 0.12);
    border-color: rgba(78, 84, 200, 0.35);
}

.article-btn-download {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 16px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, var(--primary-color), #8B5CF6);
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
}

.article-btn-download:hover {
    box-shadow: 0 4px 12px rgba(78, 84, 200, 0.35);
    transform: translateY(-1px);
}

/* 文章阅读弹窗 */
.article-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.article-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.article-modal-content {
    position: relative;
    width: 90%;
    max-width: 720px;
    max-height: 85vh;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.article-modal-header {
    padding: 20px 28px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.article-modal-cat {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    color: #fff;
    font-size: 12px;
    font-weight: 500;
}

.article-modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    font-size: 20px;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.article-modal-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #333;
}

.article-modal-title {
    padding: 16px 28px 0;
    font-size: 22px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.4;
}

.article-modal-meta {
    padding: 12px 28px;
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: #888;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.article-modal-body {
    padding: 24px 28px;
    overflow-y: auto;
    flex: 1;
    font-size: 15px;
    line-height: 1.8;
    color: #333;
}

.article-modal-body .article-summary-text {
    font-size: 15px;
    color: #666;
    font-style: italic;
    padding: 16px 20px;
    background: rgba(78, 84, 200, 0.04);
    border-radius: 12px;
    margin-bottom: 24px;
    border-left: 3px solid var(--primary-color);
}

.article-modal-body h3 {
    font-size: 17px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 24px 0 12px;
    padding-left: 12px;
    border-left: 3px solid var(--primary-color);
}

.article-modal-body p {
    margin-bottom: 16px;
    text-indent: 2em;
}

.article-modal-footer {
    padding: 16px 28px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    justify-content: flex-end;
}

.article-modal-download {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, var(--primary-color), #8B5CF6);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
}

.article-modal-download:hover {
    box-shadow: 0 6px 16px rgba(78, 84, 200, 0.4);
    transform: translateY(-1px);
}

@media (max-width: 768px) {
    .article-modal-content {
        width: 95%;
        max-height: 90vh;
        border-radius: 16px;
    }
    .article-modal-title {
        font-size: 18px;
        padding: 12px 20px 0;
    }
    .article-modal-body {
        padding: 16px 20px;
        font-size: 14px;
    }
    .article-modal-header {
        padding: 16px 20px 0;
    }
    .article-modal-meta {
        padding: 10px 20px;
    }
    .article-modal-footer {
        padding: 12px 20px;
    }
}
    color: var(--text-secondary);
    opacity: 0.6;
    font-weight: 500;
}

@media (max-width: 768px) {
    .gallery-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .gallery-overlay { opacity: 1; }
    .gallery-tabs { gap: 6px; }
    .gallery-tab { padding: 4px 12px; font-size: 12px; }
    .article-grid { grid-template-columns: 1fr; gap: 16px; }
    .article-tabs { gap: 6px; }
    .article-tab { padding: 6px 14px; font-size: 12px; }
}

/* 侧边栏底部 - 用户登录区 */
.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
}

.user-login-area {
    display: flex;
    flex-direction: column;
}

.user-not-logged {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 10px;
    background: var(--bg-main);
}

.user-avatar-placeholder {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #E5E7EB;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9CA3AF;
    flex-shrink: 0;
}

.user-login-hint {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.login-hint-text {
    font-size: 13px;
    color: var(--text-secondary);
}

.btn-login-link {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    text-align: left;
}

.btn-login-link:hover {
    text-decoration: underline;
}

.user-logged {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 10px;
    background: var(--bg-main);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #8B5CF6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-logout {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    padding: 0;
    text-align: left;
}

.btn-logout:hover {
    color: #EF4444;
}

/* 登录/注册弹窗 */
.auth-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.auth-modal-overlay.active {
    display: flex;
}

.auth-modal {
    background: #fff;
    border-radius: 16px;
    padding: 32px;
    width: 400px;
    max-width: 90vw;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    position: relative;
    animation: modalSlideIn 0.25s ease-out;
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(20px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.auth-modal-close:hover {
    background: var(--bg-main);
}

.auth-modal-header {
    text-align: center;
    margin-bottom: 24px;
}

.auth-modal-header h2 {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.auth-modal-header p {
    font-size: 14px;
    color: var(--text-secondary);
}

.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.auth-tab {
    flex: 1;
    padding: 10px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.auth-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.auth-form .form-group {
    margin-bottom: 16px;
}

.auth-form label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.auth-form input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-main);
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.auth-form input:focus {
    border-color: var(--primary);
    background: #fff;
}

.auth-error {
    font-size: 13px;
    color: #EF4444;
    min-height: 20px;
    margin-bottom: 8px;
}

.auth-submit-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--primary), #8B5CF6);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
}

.auth-submit-btn:hover {
    opacity: 0.9;
}

.auth-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}