﻿/**
 * Aura Cognitive OS - 样式表
 * 玻璃拟态 + 深色主题 + 丰富动画
 */

/* ========== CSS Variables ========== */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a25;
    --bg-glass: rgba(255, 255, 255, 0.03);
    --bg-glass-hover: rgba(255, 255, 255, 0.06);
    --border-glass: rgba(255, 255, 255, 0.08);
    
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-tertiary: rgba(255, 255, 255, 0.4);
    
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-tertiary: #a78bfa;
    --accent-gradient: linear-gradient(135deg, #6366f1, #8b5cf6);
    --accent-glow: 0 0 30px rgba(99, 102, 241, 0.4);
    
    --spark-color: #f59e0b;
    --project-color: #10b981;
    --learning-color: #3b82f6;
    --life-color: #ec4899;
    --other-color: #6b7280;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    --shadow-glass: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.3);
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    --transition-bounce: 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ========== Animations Keyframes ========== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes scaleInBounce {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    70% {
        transform: scale(1.05);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(99, 102, 241, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(99, 102, 241, 0.6), 0 0 40px rgba(139, 92, 246, 0.3);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

@keyframes gradientMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

@keyframes skeleton {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes ping {
    75%, 100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* ========== Reset & Base ========== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
}

#app {
    height: 100%;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.5s ease;
}

.hidden { display: none !important; }

/* ========== Header ========== */
.header {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background: var(--bg-glass);
    border-bottom: 1px solid var(--border-glass);
    backdrop-filter: blur(20px);
    animation: fadeInDown 0.4s ease;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-gradient);
    background-size: 200% 200%;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 18px;
    animation: gradientMove 3s ease infinite;
    transition: transform var(--transition-fast);
}

.brand-icon:hover {
    transform: rotate(10deg) scale(1.1);
    box-shadow: var(--accent-glow);
}

.brand-text {
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 2px;
    background: var(--accent-gradient);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-tabs {
    display: flex;
    gap: 4px;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.tab-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.tab-btn:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
    transform: translateY(-2px);
}

.tab-btn.active {
    background: var(--accent-gradient);
    color: white;
    box-shadow: var(--shadow-glow);
    animation: scaleIn 0.3s ease;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background: white;
    border-radius: 2px;
    animation: scaleInBounce 0.4s ease;
}

.tab-icon {
    font-size: 16px;
    transition: transform var(--transition-fast);
}

.tab-btn:hover .tab-icon {
    transform: scale(1.2);
}

.header-status {
    font-size: 13px;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    animation: pulse 2s ease infinite;
}

.status-dot.processing {
    background: var(--accent-primary);
    animation: pulse 0.5s ease infinite;
}

.status-dot.error {
    background: #ef4444;
    animation: shake 0.5s ease;
}

/* ========== Loading Bar ========== */
.loading-bar {
    height: 2px;
    background: var(--accent-gradient);
    background-size: 200% 100%;
    width: 0;
    opacity: 0;
    transition: width 0.3s ease, opacity 0.3s ease;
}

.loading-bar.active {
    opacity: 1;
    animation: gradientMove 1s linear infinite;
}

/* ========== Main Content ========== */
.main {
    flex: 1;
    overflow: hidden;
}

.tab-content {
    display: none;
    height: 100%;
    opacity: 0;
    transform: translateY(10px);
}

.tab-content.active {
    display: block;
    animation: fadeInUp 0.4s ease forwards;
}

/* ========== Flash Module ========== */
.flash-container {
    display: flex;
    height: 100%;
}

.flash-sidebar {
    width: 220px;
    padding: 20px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-glass);
    animation: fadeInLeft 0.4s ease;
}

.sidebar-section {
    margin-bottom: 24px;
    animation: fadeInUp 0.5s ease;
}

.sidebar-section:nth-child(1) { animation-delay: 0.1s; }
.sidebar-section:nth-child(2) { animation-delay: 0.2s; }

.section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.category-filters {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cat-filter {
    padding: 8px 12px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.cat-filter::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
}

.cat-filter:active::after {
    width: 200px;
    height: 200px;
}

.cat-filter:hover {
    background: var(--bg-glass-hover);
    transform: translateX(4px);
}

.cat-filter.active {
    background: var(--accent-gradient);
    border-color: transparent;
    color: white;
    box-shadow: var(--shadow-glow);
}

.stats {
    display: flex;
    gap: 16px;
}

.stat-item {
    text-align: center;
    transition: transform var(--transition-fast);
}

.stat-item:hover {
    transform: scale(1.1);
}

.stat-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: var(--accent-primary);
    animation: fadeInUp 0.5s ease;
}

.stat-label {
    font-size: 12px;
    color: var(--text-tertiary);
}

.flash-main {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.flash-input-area {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    animation: fadeInDown 0.4s ease;
}

.flash-input-area textarea {
    flex: 1;
    padding: 12px 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    resize: none;
    transition: all var(--transition-fast);
}

.flash-input-area textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
    transform: translateY(-2px);
}

.flash-input-area textarea::placeholder {
    color: var(--text-tertiary);
}

.btn-capture {
    padding: 12px 24px;
    background: var(--accent-gradient);
    background-size: 200% 200%;
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.btn-capture::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.btn-capture:hover {
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
    animation: gradientMove 2s ease infinite;
}

.btn-capture:hover::before {
    left: 100%;
}

.btn-capture:active {
    transform: translateY(0) scale(0.98);
}

.flash-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.flash-card {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 16px;
    transition: all var(--transition-normal);
    animation: fadeInUp 0.4s ease backwards;
    position: relative;
    overflow: hidden;
}

.flash-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--accent-gradient);
    transform: scaleY(0);
    transform-origin: top;
    transition: transform var(--transition-normal);
}

.flash-card:hover {
    background: var(--bg-glass-hover);
    border-color: rgba(255, 255, 255, 0.12);
    transform: translateX(4px);
    box-shadow: var(--shadow-glass);
}

.flash-card:hover::before {
    transform: scaleY(1);
}

.flash-card:nth-child(1) { animation-delay: 0.05s; }
.flash-card:nth-child(2) { animation-delay: 0.1s; }
.flash-card:nth-child(3) { animation-delay: 0.15s; }
.flash-card:nth-child(4) { animation-delay: 0.2s; }
.flash-card:nth-child(5) { animation-delay: 0.25s; }

.flash-card.new {
    animation: scaleInBounce 0.5s ease;
}

.flash-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.flash-category {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    transition: all var(--transition-fast);
}

.flash-category:hover {
    transform: scale(1.05);
}

.flash-category.spark { 
    background: rgba(245, 158, 11, 0.15); 
    color: var(--spark-color);
    border: 1px solid rgba(245, 158, 11, 0.3);
}
.flash-category.project { 
    background: rgba(16, 185, 129, 0.15); 
    color: var(--project-color);
    border: 1px solid rgba(16, 185, 129, 0.3);
}
.flash-category.learning { 
    background: rgba(59, 130, 246, 0.15); 
    color: var(--learning-color);
    border: 1px solid rgba(59, 130, 246, 0.3);
}
.flash-category.life { 
    background: rgba(236, 72, 153, 0.15); 
    color: var(--life-color);
    border: 1px solid rgba(236, 72, 153, 0.3);
}
.flash-category.other { 
    background: rgba(107, 114, 128, 0.15); 
    color: var(--other-color);
    border: 1px solid rgba(107, 114, 128, 0.3);
}

.flash-time {
    font-size: 12px;
    color: var(--text-tertiary);
}

.flash-content {
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 10px;
}

.flash-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.tag {
    padding: 4px 10px;
    background: var(--bg-tertiary);
    border-radius: 20px;
    font-size: 12px;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    cursor: pointer;
}

.tag:hover {
    background: var(--accent-primary);
    color: white;
    transform: scale(1.05);
}

.flash-insight {
    padding: 10px;
    background: rgba(99, 102, 241, 0.08);
    border-left: 3px solid var(--accent-primary);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    animation: fadeInLeft 0.3s ease;
}

.flash-actions {
    display: flex;
    gap: 8px;
    opacity: 0;
    transform: translateY(5px);
    transition: all var(--transition-fast);
}

.flash-card:hover .flash-actions {
    opacity: 1;
    transform: translateY(0);
}

.flash-actions button {
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.flash-actions button:hover {
    background: var(--accent-primary);
    color: white;
    transform: translateY(-2px);
}

/* ========== Knowledge Module ========== */
.knowledge-container {
    height: 100%;
    padding: 20px;
    overflow-y: auto;
}

.knowledge-toolbar {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    animation: fadeInDown 0.4s ease;
}

.search-box {
    flex: 1;
    display: flex;
    gap: 8px;
}

.search-box input {
    flex: 1;
    padding: 10px 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    transition: all var(--transition-fast);
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.search-box button {
    padding: 10px 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.search-box button:hover {
    background: var(--accent-primary);
    transform: scale(1.05);
}

.btn-import {
    padding: 10px 20px;
    background: var(--accent-gradient);
    border-radius: var(--radius-md);
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-import:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.knowledge-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.knowledge-card {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 16px;
    transition: all var(--transition-normal);
    animation: fadeInUp 0.4s ease backwards;
}

.knowledge-card:nth-child(1) { animation-delay: 0.05s; }
.knowledge-card:nth-child(2) { animation-delay: 0.1s; }
.knowledge-card:nth-child(3) { animation-delay: 0.15s; }
.knowledge-card:nth-child(4) { animation-delay: 0.2s; }
.knowledge-card:nth-child(5) { animation-delay: 0.25s; }
.knowledge-card:nth-child(6) { animation-delay: 0.3s; }

.knowledge-card:hover {
    background: var(--bg-glass-hover);
    transform: translateY(-4px);
    box-shadow: var(--shadow-glass);
}

.knowledge-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.knowledge-type { 
    font-size: 20px;
    transition: transform var(--transition-fast);
}

.knowledge-card:hover .knowledge-type {
    transform: scale(1.2) rotate(5deg);
}

.knowledge-title {
    font-size: 14px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.knowledge-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-tertiary);
}

.knowledge-actions {
    margin-top: 12px;
    opacity: 0;
    transform: translateY(5px);
    transition: all var(--transition-fast);
}

.knowledge-card:hover .knowledge-actions {
    opacity: 1;
    transform: translateY(0);
}

.knowledge-actions button {
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.knowledge-actions button:hover {
    background: #ef4444;
    color: white;
}

/* ========== Chat Module ========== */
.chat-container {
    display: flex;
    height: 100%;
}

.chat-sidebar {
    width: 240px;
    padding: 16px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-glass);
    animation: fadeInLeft 0.4s ease;
}

.btn-new-chat {
    width: 100%;
    padding: 10px;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 14px;
    cursor: pointer;
    margin-bottom: 16px;
    transition: all var(--transition-fast);
}

.btn-new-chat:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-glow);
}

.conversation-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.conv-item {
    padding: 10px;
    background: var(--bg-glass);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    animation: fadeInRight 0.3s ease backwards;
}

.conv-item:nth-child(1) { animation-delay: 0.05s; }
.conv-item:nth-child(2) { animation-delay: 0.1s; }
.conv-item:nth-child(3) { animation-delay: 0.15s; }

.conv-item:hover {
    background: var(--bg-glass-hover);
    transform: translateX(4px);
}

.conv-title {
    display: block;
    font-size: 13px;
    margin-bottom: 4px;
}

.conv-time {
    font-size: 11px;
    color: var(--text-tertiary);
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.memory-context {
    display: none;
    padding: 12px 16px;
    background: rgba(99, 102, 241, 0.08);
    border-bottom: 1px solid var(--border-glass);
    animation: fadeInDown 0.3s ease;
}

.memory-context.active { display: block; }

.memory-header {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.memory-header::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--accent-primary);
    border-radius: 50%;
    animation: pulse 1s ease infinite;
}

.memory-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.memory-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: var(--bg-glass);
    border-radius: var(--radius-sm);
    font-size: 12px;
    animation: fadeInUp 0.3s ease backwards;
    transition: all var(--transition-fast);
}

.memory-item:nth-child(1) { animation-delay: 0.1s; }
.memory-item:nth-child(2) { animation-delay: 0.15s; }
.memory-item:nth-child(3) { animation-delay: 0.2s; }

.memory-item:hover {
    background: var(--bg-glass-hover);
}

.memory-type { font-size: 14px; }

.memory-content {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-secondary);
}

.memory-score {
    color: var(--accent-primary);
    font-weight: 600;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    animation: fadeInUp 0.3s ease;
    position: relative;
}

.chat-message.user {
    align-self: flex-end;
    background: var(--accent-gradient);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.user::after {
    content: '';
    position: absolute;
    right: -8px;
    bottom: 0;
    width: 0;
    height: 0;
    border-left: 8px solid var(--accent-primary);
    border-bottom: 8px solid transparent;
}

.chat-message.assistant {
    align-self: flex-start;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-bottom-left-radius: 4px;
}

.chat-message.assistant::before {
    content: '';
    position: absolute;
    left: -8px;
    bottom: 0;
    width: 0;
    height: 0;
    border-right: 8px solid var(--border-glass);
    border-bottom: 8px solid transparent;
}

.message-content {
    font-size: 14px;
    line-height: 1.6;
}

.cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background: var(--accent-primary);
    margin-left: 2px;
    animation: blink 0.8s infinite;
}

/* 打字效果 */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--accent-primary);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }
.typing-indicator span:nth-child(3) { animation-delay: 0; }

.chat-input-area {
    display: flex;
    gap: 12px;
    padding: 16px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-glass);
    animation: fadeInUp 0.4s ease;
}

.chat-input-area textarea {
    flex: 1;
    padding: 12px 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    resize: none;
    transition: all var(--transition-fast);
}

.chat-input-area textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.btn-send {
    padding: 12px 24px;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-send:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-glow);
}

.btn-send:active {
    transform: scale(0.98);
}

/* ========== Graph Module ========== */
.graph-container {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.graph-placeholder {
    text-align: center;
    color: var(--text-tertiary);
    animation: fadeIn 0.5s ease;
}

.placeholder-icon {
    font-size: 64px;
    display: block;
    margin-bottom: 16px;
    animation: float 3s ease-in-out infinite;
}

.graph-placeholder h3 {
    font-size: 20px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.graph-placeholder .hint {
    font-size: 13px;
    margin-top: 8px;
}

/* ========== Quick Capture Bar ========== */
.quick-capture {
    padding: 12px 24px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-glass);
    animation: fadeInUp 0.4s ease;
}

.quick-capture input {
    width: 100%;
    padding: 10px 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    transition: all var(--transition-fast);
}

.quick-capture input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* ========== Skeleton Loading ========== */
.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-glass-hover) 50%, var(--bg-tertiary) 75%);
    background-size: 200px 100%;
    animation: skeleton 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

.skeleton-card {
    height: 120px;
    margin-bottom: 12px;
}

.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
}

.skeleton-text.short { width: 60%; }

/* ========== Toast Notifications ========== */
.toast {
    position: fixed;
    bottom: 80px;
    right: 24px;
    padding: 12px 20px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-glass);
    animation: slideInUp 0.3s ease, fadeIn 0.3s ease;
    z-index: 1000;
}

.toast.success {
    border-left: 3px solid #10b981;
}

.toast.error {
    border-left: 3px solid #ef4444;
}

.toast.info {
    border-left: 3px solid var(--accent-primary);
}

/* ========== Scrollbar ========== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-glass);
    border-radius: 3px;
    transition: background var(--transition-fast);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .header-tabs .tab-label { display: none; }
    .flash-sidebar { display: none; }
    .chat-sidebar { display: none; }
    
    .knowledge-list {
        grid-template-columns: 1fr;
    }
}

/* ========== Print Styles ========== */
@media print {
    .header, .quick-capture, .flash-sidebar, .chat-sidebar {
        display: none !important;
    }
}
/* ========== 绉诲姩绔€傞厤鏍峰紡 ========== */

/* 绉诲姩绔伄缃?*/
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 99;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.mobile-overlay.active {
    display: block;
    opacity: 1;
}

/* 姹夊牎鑿滃崟鎸夐挳 */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}

.mobile-menu-btn:hover {
    background: var(--bg-glass-hover);
}

.mobile-menu-btn span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all var(--transition-fast);
}

.mobile-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* 渚ц竟鏍忓ご閮紙绉诲姩绔級 */
.sidebar-header {
    display: none;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border-glass);
    margin-bottom: 8px;
}

.sidebar-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.sidebar-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-glass);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.sidebar-close:hover {
    background: var(--accent-primary);
    color: white;
}

/* 绉诲姩绔粺璁℃潯 */
.mobile-stats-bar {
    display: none;
    justify-content: center;
    gap: 24px;
    padding: 12px 16px;
    background: var(--bg-glass);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
}

.mobile-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.mobile-stat span:first-child {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent-primary);
}

.mobile-stat span:last-child {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* 绉诲姩绔璇濆巻鍙叉寜閽?*/
.mobile-history-btn {
    display: none;
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 8px 12px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    z-index: 10;
    transition: all var(--transition-fast);
}

.mobile-history-btn:hover {
    background: var(--accent-primary);
    color: white;
}

/* ========== 绉诲姩绔搷搴斿紡 ========== */
@media (max-width: 768px) {
    /* 鏄剧ず姹夊牎鑿滃崟 */
    .mobile-menu-btn {
        display: flex;
    }
    
    /* 渚ц竟鏍忓ご閮?*/
    .sidebar-header {
        display: flex;
    }
    
    /* 闅愯棌妗岄潰绔姸鎬佹爮 */
    .header-status {
        display: none;
    }
    
    /* Tab 鏍囩闅愯棌鏂囧瓧 */
    .header-tabs .tab-label {
        display: none;
    }
    
    .tab-btn {
        padding: 8px 12px;
    }
    
    .tab-icon {
        font-size: 18px;
    }
    
    /* 闂康渚ц竟鏍?- 鎶藉眽寮?*/
    .flash-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 280px;
        max-width: 85vw;
        padding: 0;
        padding-bottom: 20px;
        background: var(--bg-secondary);
        z-index: 100;
        transform: translateX(-100%);
        transition: transform var(--transition-normal);
        overflow-y: auto;
    }
    
    .flash-sidebar.open {
        transform: translateX(0);
    }
    
    .flash-sidebar .sidebar-section {
        padding: 0 16px;
    }
    
    /* 绉诲姩绔粺璁℃潯 */
    .mobile-stats-bar {
        display: flex;
    }
    
    /* 瀵硅瘽渚ц竟鏍?- 鎶藉眽寮?*/
    .chat-sidebar {
        position: fixed;
        right: 0;
        top: 0;
        bottom: 0;
        width: 280px;
        max-width: 85vw;
        padding: 0;
        padding-bottom: 20px;
        background: var(--bg-secondary);
        z-index: 100;
        transform: translateX(100%);
        transition: transform var(--transition-normal);
        overflow-y: auto;
    }
    
    .chat-sidebar.open {
        transform: translateX(0);
    }
    
    .chat-sidebar .btn-new-chat {
        margin: 16px;
        width: calc(100% - 32px);
    }
    
    .chat-sidebar .conversation-list {
        padding: 0 16px;
    }
    
    /* 绉诲姩绔璇濆巻鍙叉寜閽?*/
    .mobile-history-btn {
        display: block;
    }
    
    /* 杈撳叆鍖哄煙浼樺寲 */
    .flash-input-area,
    .chat-input-area {
        flex-direction: column;
        gap: 8px;
    }
    
    .flash-input-area textarea,
    .chat-input-area textarea {
        width: 100%;
        min-height: 60px;
    }
    
    .btn-capture,
    .btn-send {
        width: 100%;
        padding: 14px;
    }
    
    /* 搴曢儴蹇嵎鏍忎紭鍖?*/
    .quick-capture {
        padding: 8px 12px;
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }
    
    .quick-capture input {
        padding: 12px 14px;
        font-size: 16px; /* 闃叉 iOS 缂╂斁 */
    }
    
    /* 鐭ヨ瘑搴撳伐鍏锋爮 */
    .knowledge-toolbar {
        flex-direction: column;
        gap: 10px;
    }
    
    .search-box {
        width: 100%;
    }
    
    .btn-import {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
    
    /* 鍗＄墖浼樺寲 */
    .flash-card {
        padding: 14px;
    }
    
    .flash-content {
        font-size: 14px;
    }
    
    .knowledge-card {
        padding: 14px;
    }
    
    /* 瀵硅瘽娑堟伅浼樺寲 */
    .chat-message {
        max-width: 90%;
        padding: 10px 14px;
    }
    
    .chat-main {
        position: relative;
    }
    
    /* 鍥捐氨鍗犱綅 */
    .graph-placeholder {
        padding: 20px;
    }
    
    .placeholder-icon {
        font-size: 48px;
    }
    
    /* Toast 浣嶇疆 */
    .toast {
        bottom: 100px;
        left: 16px;
        right: 16px;
        text-align: center;
    }
}

/* ========== 灏忓睆鎵嬫満浼樺寲 ========== */
@media (max-width: 480px) {
    .header {
        padding: 0 12px;
    }
    
    .brand-text {
        display: none;
    }
    
    .flash-main,
    .knowledge-container {
        padding: 12px;
    }
    
    .flash-card,
    .knowledge-card {
        padding: 12px;
        border-radius: var(--radius-md);
    }
    
    .flash-header {
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .flash-actions {
        opacity: 1;
        transform: none;
        margin-top: 10px;
    }
    
    .knowledge-actions {
        opacity: 1;
        transform: none;
    }
}

/* ========== 瑙︽懜浼樺寲 ========== */
@media (hover: none) and (pointer: coarse) {
    /* 澧炲ぇ瑙︽懜鍖哄煙 */
    .tab-btn,
    .cat-filter,
    .btn-capture,
    .btn-send,
    .btn-import,
    .btn-new-chat {
        min-height: 44px;
    }
    
    /* 绉婚櫎 hover 鏁堟灉 */
    .flash-card:hover,
    .knowledge-card:hover,
    .conv-item:hover {
        transform: none;
    }
    
    .flash-card:active,
    .knowledge-card:active {
        transform: scale(0.98);
        background: var(--bg-glass-hover);
    }
    
    /* 濮嬬粓鏄剧ず鎿嶄綔鎸夐挳 */
    .flash-actions,
    .knowledge-actions {
        opacity: 1;
        transform: none;
    }
}

/* ========== 妯睆浼樺寲 ========== */
@media (max-width: 768px) and (orientation: landscape) {
    .header {
        height: 50px;
    }
    
    .flash-input-area textarea,
    .chat-input-area textarea {
        min-height: 40px;
    }
    
    .quick-capture {
        padding: 6px 12px;
    }
}

