/* ===== 基础样式 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #00d4ff;
    --secondary-color: #7a5cff;
    --accent-color: #ff006e;
    --bg-primary: #0a0e27;
    --bg-secondary: #151932;
    --bg-tertiary: #1e2139;
    --text-primary: #ffffff;
    --text-secondary: #a8b2d1;
    --text-tertiary: #64748b;
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow-color: rgba(0, 0, 0, 0.3);
    --gradient-primary: linear-gradient(135deg, #00d4ff, #7a5cff);
    --gradient-secondary: linear-gradient(135deg, #7a5cff, #ff006e);
    --gradient-accent: linear-gradient(135deg, #ff006e, #ffbe0b);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* ===== 动态背景效果 ===== */
.particles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.particle {
    position: absolute;
    background: var(--primary-color);
    border-radius: 50%;
    opacity: 0.3;
    animation: float 20s infinite linear;
}

.particle:nth-child(1) {
    width: 5px;
    height: 5px;
    left: 10%;
    animation-duration: 15s;
    animation-delay: 0s;
}

.particle:nth-child(2) {
    width: 8px;
    height: 8px;
    left: 20%;
    animation-duration: 20s;
    animation-delay: 2s;
}

.particle:nth-child(3) {
    width: 3px;
    height: 3px;
    left: 30%;
    animation-duration: 18s;
    animation-delay: 4s;
}

.particle:nth-child(4) {
    width: 6px;
    height: 6px;
    left: 40%;
    animation-duration: 22s;
    animation-delay: 1s;
}

.particle:nth-child(5) {
    width: 4px;
    height: 4px;
    left: 50%;
    animation-duration: 25s;
    animation-delay: 3s;
}

.particle:nth-child(6) {
    width: 7px;
    height: 7px;
    left: 60%;
    animation-duration: 17s;
    animation-delay: 5s;
}

.particle:nth-child(7) {
    width: 5px;
    height: 5px;
    left: 70%;
    animation-duration: 19s;
    animation-delay: 2s;
}

.particle:nth-child(8) {
    width: 3px;
    height: 3px;
    left: 80%;
    animation-duration: 21s;
    animation-delay: 4s;
}

@keyframes float {
    0% {
        transform: translateY(100vh) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 0.3;
    }
    90% {
        opacity: 0.3;
    }
    100% {
        transform: translateY(-100vh) translateX(100px);
        opacity: 0;
    }
}

.grid-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: 0;
    pointer-events: none;
}

/* ===== 主容器 ===== */
.container {
    width: min(1600px, calc(100vw - 20px));
    margin: 10px auto;
    background: rgba(21, 25, 50, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    overflow: hidden;
    position: relative;
    z-index: 1;
    height: calc(100vh - 20px);
    display: flex;
    flex-direction: column;
}

/* ===== 顶部导航栏 ===== */
.header {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border-bottom: 1px solid var(--border-color);
    padding: 0;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--gradient-primary);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-icon {
    width: 50px;
    height: 50px;
    background: var(--gradient-primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 10px 25px -5px rgba(0, 212, 255, 0.3);
    animation: pulse 2s infinite;
}

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

.logo-text h1 {
    font-size: 1.8rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 5px;
}

.logo-text p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 212, 255, 0.1);
    padding: 8px 15px;
    border-radius: 30px;
    border: 1px solid rgba(0, 212, 255, 0.3);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #00ff88;
    border-radius: 50%;
    animation: blink 2s infinite;
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.status-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

/* ===== 主内容区 ===== */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* ===== 左侧历史面板 ===== */
.history-panel {
    width: 320px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 让历史列表真正占满侧边栏 */
.history-panel .history-list {
    flex: 1;
    min-height: 0;
}

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

.history-header h2 {
    font-size: 1.1rem;
    color: var(--text-primary);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-header h2 i {
    color: var(--primary-color);
}

.btn-new {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
}

.btn-new:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 212, 255, 0.4);
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

/* 兼容历史列表字段命名（JS 当前输出 history-title/history-time） */
.history-title,
.history-item-title {
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-time,
.history-item-time {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.history-item {
    background: var(--bg-tertiary);
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    border: 1px solid transparent;
}

.history-item:hover {
    border-color: var(--primary-color);
    transform: translateX(5px);
    background: rgba(0, 212, 255, 0.1);
}

.history-item.active {
    border-color: var(--primary-color);
    transform: translateX(5px);
    background: rgba(0, 212, 255, 0.15);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.3);
}

.history-item.active .history-title {
    color: var(--primary-color);
}

.history-item-time {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    margin-bottom: 5px;
}

.history-item-message {
    color: var(--text-secondary);
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 4px;
}

.history-item-count {
    color: var(--text-tertiary);
    font-size: 0.8rem;
}

/* ===== 聊天面板 ===== */
.chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    min-width: 0;
    min-height: 0;
}

/* 右侧顶部工具栏（RAG + 模式切换） */
.chat-toolbar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.chat-toolbar .rag-section,
.chat-toolbar .mode-switch {
    padding-left: 22px;
    padding-right: 22px;
}

.chat-toolbar .rag-section {
    border-bottom: 1px solid var(--border-color);
}

.chat-toolbar .mode-switch {
    border-bottom: none;
}

.toolbar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 22px;
}

.toolbar-title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    font-weight: 700;
    letter-spacing: 0.5px;
}

.toolbar-title i {
    color: var(--primary-color);
}

.toolbar-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.toolbar-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    padding: 8px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
}

.toolbar-toggle input[type="checkbox"] {
    display: none;
}

/* toolbar-toggle 也需要支持选中态（流式开关用的是 toolbar-toggle） */
.toolbar-toggle input:checked + .toggle-slider {
    background: var(--gradient-primary);
    border: none;
}

.toolbar-toggle input:checked + .toggle-slider::before {
    transform: translateX(26px);
    background: white;
}

.btn-icon {
    padding: 10px 12px;
    border-radius: 12px;
    width: auto;
    min-width: 44px;
    justify-content: center;
}

/* ===== RAG 功能区 ===== */
.rag-section {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 20px;
    position: relative;
    flex-shrink: 0;
}

.rag-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-primary);
}

.rag-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.rag-header h3 {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.rag-header h3 i {
    color: var(--primary-color);
}

.rag-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.rag-toggle input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 50px;
    height: 24px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    transition: background 0.3s;
    border: 1px solid var(--border-color);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--text-tertiary);
    top: 1px;
    left: 2px;
    transition: transform 0.3s, background 0.3s;
}

.rag-toggle input:checked + .toggle-slider {
    background: var(--gradient-primary);
    border: none;
}

.rag-toggle input:checked + .toggle-slider::before {
    transform: translateX(26px);
    background: white;
}

#ragModeText {
    font-weight: 500;
    color: var(--text-secondary);
}

.rag-controls {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 15px;
    margin-top: 10px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    border-radius: 12px;
}

.file-upload-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-upload {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--gradient-primary);
    color: white !important;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer !important;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
    text-decoration: none;
}

.btn-upload:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 212, 255, 0.4);
}

.upload-status {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.upload-status.success {
    color: #00ff88;
    font-weight: 500;
}

.upload-status.error {
    color: var(--accent-color);
    font-weight: 500;
}

.rag-stats {
    display: flex;
    gap: 15px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.rag-stats span {
    display: flex;
    align-items: center;
    gap: 5px;
    background: var(--bg-secondary);
    padding: 8px 12px;
    border-radius: 8px;
    font-weight: 500;
    border: 1px solid var(--border-color);
}

.rag-stats i {
    color: var(--primary-color);
}

/* ===== 模式切换 ===== */
.mode-switch {
    padding: 15px 30px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    flex-shrink: 0;
    gap: 15px;
}

.switch-label {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
    cursor: pointer;
}

.switch-label input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-tertiary);
    border-radius: 30px;
    transition: 0.3s;
    border: 1px solid var(--border-color);
}

.switch-slider:before {
    content: "";
    position: absolute;
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background: var(--text-tertiary);
    border-radius: 50%;
    transition: 0.3s;
}

.switch-label input:checked + .switch-slider {
    background: var(--gradient-primary);
    border: none;
}

.switch-label input:checked + .switch-slider:before {
    transform: translateX(30px);
    background: white;
}

.mode-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

#modeText {
    font-weight: bold;
    color: var(--text-primary);
    font-size: 1rem;
}

.mode-hint {
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

.btn-reset {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    background: var(--gradient-secondary);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(122, 92, 255, 0.3);
}

.btn-reset:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(122, 92, 255, 0.4);
}

/* ===== 聊天消息区 ===== */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    background: var(--bg-primary);
    position: relative;
    min-height: 0;
}

.welcome-message {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.welcome-icon {
    font-size: 3rem;
    margin-bottom: 20px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: pulse 2s infinite;
}

.welcome-message h2 {
    font-size: 2rem;
    margin-bottom: 20px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

.welcome-features {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 30px 0;
}

.feature-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    min-width: 120px;
    transition: all 0.3s;
}

.feature-item:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
    background: rgba(0, 212, 255, 0.1);
}

.feature-item i {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.feature-item span {
    font-size: 0.9rem;
    font-weight: 500;
}

.welcome-tip {
    margin-top: 20px;
    font-size: 1rem;
    color: var(--text-tertiary);
}

.message {
    margin-bottom: 20px;
    animation: fadeIn 0.3s;
}

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

.message-user {
    display: flex;
    justify-content: flex-end;
}

.message-ai {
    display: flex;
    justify-content: flex-start;
}

.message-content {
    max-width: 70%;
    padding: 15px 20px;
    border-radius: 15px;
    line-height: 1.6;
}

.message-user .message-content {
    background: var(--gradient-primary);
    color: white;
    border-bottom-right-radius: 5px;
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.message-ai .message-content {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-bottom-left-radius: 5px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
}

.message-label {
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.message-user .message-label {
    color: rgba(255, 255, 255, 0.9);
}

.message-ai .message-label {
    color: var(--primary-color);
}

.message-text {
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* ===== 输入区域 ===== */
.chat-input-container {
    padding: 20px 30px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 15px;
    flex-shrink: 0;
}

.input-wrapper {
    flex: 1;
    position: relative;
    background: var(--bg-tertiary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    transition: all 0.3s;
}

.input-wrapper:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.2);
}

#messageInput {
    width: 100%;
    padding: 15px 50px 15px 20px;
    background: transparent;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    resize: none;
    color: var(--text-primary);
    outline: none;
}

#messageInput::placeholder {
    color: var(--text-tertiary);
}

.input-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.doc-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(0, 212, 255, 0.12);
    border: 1px solid rgba(0, 212, 255, 0.25);
    color: var(--text-secondary);
    font-size: 0.85rem;
    white-space: nowrap;
}

.doc-badge i {
    color: var(--primary-color);
}

.chat-input-container .upload-status {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-action {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.btn-action:hover {
    background: rgba(0, 212, 255, 0.1);
    color: var(--primary-color);
}

.btn-send {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
}

.btn-send:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 212, 255, 0.4);
}

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

/* ===== 加载动画 ===== */
.loading {
    display: inline-block;
}

.loading::after {
    content: '...';
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* ===== 打字机光标动画 ===== */
.typing-cursor {
    display: inline-block;
    animation: blink 1s infinite;
    color: var(--primary-color);
    font-weight: bold;
}

@keyframes blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

/* ===== 滚动条样式 ===== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* ===== 响应式设计 ===== */
@media (max-width: 1200px) {
    .container {
        max-width: 95%;
        margin: 10px auto;
        height: calc(100vh - 20px);
    }
    
    .header-content {
        padding: 15px 20px;
    }
    
    .logo-text h1 {
        font-size: 1.5rem;
    }
}

@media (max-width: 992px) {
    .welcome-features {
        gap: 20px;
    }
    
    .feature-item {
        min-width: 100px;
        padding: 12px;
    }
    
    .rag-controls {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
}

/* ===== RAG 相关文档样式 ===== */
.relevant-docs {
    margin-top: 15px;
    padding: 15px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.docs-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.doc-item {
    padding: 10px;
    margin-bottom: 8px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.doc-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.doc-score {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

/* ===== 历史记录项样式 ===== */
.history-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.history-time {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.no-history {
    text-align: center;
    padding: 20px;
    color: var(--text-tertiary);
    font-size: 0.9rem;
}

/* ===== 移动设备优化 ===== */
.mobile .particles-container,
.mobile .grid-bg {
    display: none;
}

/* ===== 波纹效果样式 ===== */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: scale(0);
    animation: ripple-animation 0.6s ease-out;
    pointer-events: none;
}

@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* ===== 滚动动画 ===== */
.scroll-animate {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.scroll-animate.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== 加载状态样式 ===== */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== 工具提示样式 ===== */
.tooltip {
    position: relative;
}

.tooltip::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 1000;
}

.tooltip:hover::before {
    opacity: 1;
}

/* ===== 响应式设计 ===== */
@media (max-width: 1200px) {
    .container {
        max-width: 95%;
        margin: 10px auto;
        height: calc(100vh - 20px);
    }
    
    .header-content {
        padding: 15px 20px;
    }
    
    .logo-text h1 {
        font-size: 1.5rem;
    }
}

@media (max-width: 992px) {
    .welcome-features {
        gap: 20px;
    }
    
    .feature-item {
        min-width: 100px;
        padding: 12px;
    }
    
    .rag-controls {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
}

@media (max-width: 768px) {
    body {
        font-size: 14px;
    }
    
    .container {
        margin: 0;
        border-radius: 0;
        height: 100vh;
        max-width: 100%;
    }
    
    .main-content {
        flex-direction: column;
    }
    
    .history-panel {
        width: 100%;
        max-height: 200px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .history-header {
        padding: 15px;
    }
    
    .history-header h2 {
        font-size: 1rem;
    }
    
    .btn-new {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    
    .message-content {
        max-width: 85%;
        padding: 12px 15px;
    }
    
    .welcome-features {
        flex-direction: column;
        gap: 15px;
        margin: 20px 0;
    }
    
    .feature-item {
        flex-direction: row;
        justify-content: flex-start;
        gap: 15px;
        min-width: auto;
        width: 100%;
    }
    
    .header-content {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        padding: 15px;
    }
    
    .logo-section {
        flex-direction: column;
        gap: 10px;
    }
    
    .logo-icon {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .logo-text h1 {
        font-size: 1.3rem;
    }
    
    .mode-switch {
        flex-direction: column;
        align-items: center;
        gap: 10px;
        padding: 15px;
    }
    
    .btn-reset {
        margin-left: 0;
        margin-top: 10px;
        width: 100%;
        justify-content: center;
    }
    
    .rag-section {
        padding: 15px;
    }
    
    .rag-controls {
        padding: 12px;
    }
    
    .chat-input-container {
        padding: 15px;
        flex-direction: column;
        gap: 10px;
    }
    
    .btn-send {
        width: 100%;
        justify-content: center;
        padding: 12px 20px;
    }
    
    .input-wrapper {
        width: 100%;
    }
    
    .chat-messages {
        padding: 20px 15px;
    }
    
    .welcome-message {
        padding: 40px 15px;
    }
    
    .welcome-message h2 {
        font-size: 1.5rem;
    }
    
    .particles-container {
        display: none;
    }
    
    .grid-bg {
        display: none;
    }
}

@media (max-width: 480px) {
    .header-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .status-indicator {
        font-size: 0.8rem;
        padding: 6px 12px;
    }
    
    .rag-stats {
        flex-direction: column;
        gap: 8px;
    }
    
    .rag-stats span {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    
    .file-upload-area {
        flex-direction: column;
        gap: 8px;
    }
    
    .btn-upload {
        width: 100%;
        justify-content: center;
    }
    
    .upload-status {
        font-size: 0.8rem;
        text-align: center;
    }
    
    .history-item {
        padding: 12px;
    }
    
    .history-item-message {
        font-size: 0.85rem;
    }
    
    .message-text {
        font-size: 0.9rem;
    }
    
    .welcome-icon {
        font-size: 2.5rem;
    }
    
    .feature-item i {
        font-size: 1.2rem;
    }
    
    .feature-item span {
        font-size: 0.85rem;
    }
}