/* index.css - 软糯古风香甜可爱紫色主题 */
:root {
    --primary-purple: #9c27b0;
    --light-purple: #e1bee7;
    --soft-purple: #f3e5f5;
    --deep-purple: #6a1b9a;
    --pastel-lavender: #d1c4e9;
    --cream: #faf8ff;
    --text-primary: #4a148c;
    --text-secondary: #7b1fa2;
    --shadow-soft: 0 4px 20px rgba(156, 39, 176, 0.15);
    --shadow-glow: 0 0 30px rgba(186, 104, 200, 0.3);
    --radius-soft: 20px;
    --radius-round: 24px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Serif SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #f3e5f5 0%, #e8d5e8 50%, #f0e6f6 100%);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* 古风背景装饰 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(186, 104, 200, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(225, 190, 231, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(209, 196, 233, 0.2) 0%, transparent 40%);
    pointer-events: none;
    z-index: 0;
}

.app-container {
    display: flex;
    height: 100vh;
    position: relative;
    z-index: 1;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(20px);
}

/* 侧边栏 - 软糯质感 */
.sidebar {
    width: 300px;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(20px);
    border-right: 2px solid rgba(225, 190, 231, 0.5);
    display: flex;
    flex-direction: column;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-soft);
}

.sidebar-header {
    padding: 24px;
    border-bottom: 2px solid rgba(225, 190, 231, 0.3);
}

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

.logo-icon {
    font-size: 32px;
    animation: float 3s ease-in-out infinite;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-5px); }
}

.logo-text {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--deep-purple) 0%, var(--primary-purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 2px;
}

.new-chat-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #ba68c8 0%, var(--primary-purple) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-round);
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(156, 39, 176, 0.3);
    transition: all 0.3s ease;
}

.new-chat-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(156, 39, 176, 0.4);
}

.new-chat-btn span {
    font-size: 20px;
}

/* 历史列表 */
.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.history-item {
    padding: 14px 16px;
    margin-bottom: 8px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(225, 190, 231, 0.3);
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-item::before {
    content: '💬';
    font-size: 14px;
}

.history-item:hover, .history-item.active {
    background: rgba(225, 190, 231, 0.4);
    transform: translateX(4px);
    border-color: var(--light-purple);
}

/* 侧边栏底部控制区 */
.sidebar-footer {
    padding: 20px;
    border-top: 2px solid rgba(225, 190, 231, 0.3);
    background: rgba(243, 229, 245, 0.4);
}

.model-selector, .thinking-toggle {
    margin-bottom: 16px;
}

.model-selector label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 600;
}

.model-selector select {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--light-purple);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    outline: none;
    transition: all 0.3s;
}

.model-selector select:focus {
    border-color: var(--primary-purple);
}

.thinking-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 26px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

input:checked + .slider {
    background-color: var(--primary-purple);
}

input:checked + .slider:before {
    transform: translateX(24px);
}

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

.admin-link {
    width: 100%;
    padding: 10px;
    background: transparent;
    border: 2px solid var(--light-purple);
    border-radius: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    transition: all 0.3s;
    margin-top: 10px;
}

.admin-link:hover {
    background: var(--light-purple);
    color: white;
}

/* 主内容区 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.menu-toggle {
    display: none;
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 100;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid var(--light-purple);
    border-radius: 12px;
    width: 44px;
    height: 44px;
    font-size: 20px;
    cursor: pointer;
    color: var(--primary-purple);
}

.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 40px;
    scroll-behavior: smooth;
}

/* 欢迎界面 */
.welcome-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    animation: fadeIn 0.8s ease;
}

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

.welcome-content {
    text-align: center;
    max-width: 600px;
}

.welcome-icon {
    font-size: 80px;
    margin-bottom: 24px;
    animation: float 4s ease-in-out infinite;
    filter: drop-shadow(0 4px 8px rgba(156, 39, 176, 0.2));
}

.welcome-content h1 {
    font-size: 42px;
    margin-bottom: 12px;
    background: linear-gradient(135deg, var(--deep-purple) 0%, #e1bee7 50%, var(--primary-purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 4px;
}

.subtitle {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 32px;
    opacity: 0.8;
}

.feature-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-bottom: 40px;
}

.tag {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.6);
    border: 2px solid rgba(225, 190, 231, 0.5);
    border-radius: 20px;
    font-size: 14px;
    color: var(--text-secondary);
    backdrop-filter: blur(10px);
    transition: all 0.3s;
}

.tag:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-soft);
    background: rgba(255, 255, 255, 0.9);
}

.quick-starts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-top: 30px;
}

.quick-card {
    padding: 20px;
    background: rgba(255, 255, 255, 0.7);
    border: 2px solid rgba(225, 190, 231, 0.4);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    color: var(--text-primary);
    backdrop-filter: blur(10px);
}

.quick-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-glow);
    background: rgba(255, 255, 255, 0.95);
    border-color: var(--light-purple);
}

.quick-card span {
    display: block;
    font-size: 28px;
    margin-bottom: 8px;
}

/* 消息列表 */
.messages-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.message {
    display: flex;
    gap: 16px;
    animation: messageSlide 0.4s ease;
}

@keyframes messageSlide {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

.message.user {
    flex-direction: row-reverse;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid var(--light-purple);
    box-shadow: var(--shadow-soft);
}

.message.user .avatar {
    background: linear-gradient(135deg, var(--primary-purple) 0%, #ba68c8 100%);
    border-color: var(--primary-purple);
}

.message-content {
    flex: 1;
    max-width: calc(100% - 60px);
}

.message-header {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    opacity: 0.7;
    font-weight: 600;
}

.message-body {
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.85);
    border-radius: var(--radius-soft);
    border: 2px solid rgba(225, 190, 231, 0.3);
    line-height: 1.8;
    font-size: 15px;
    color: var(--text-primary);
    box-shadow: var(--shadow-soft);
    position: relative;
}

.message.user .message-body {
    background: linear-gradient(135deg, rgba(225, 190, 231, 0.4) 0%, rgba(243, 229, 245, 0.6) 100%);
    border-color: rgba(186, 104, 200, 0.3);
    border-bottom-right-radius: 4px;
}

.message.assistant .message-body {
    border-bottom-left-radius: 4px;
}

/* 思考过程 */
.thinking-process {
    margin-bottom: 12px;
    background: rgba(255, 243, 224, 0.6);
    border: 2px dashed rgba(255, 183, 77, 0.3);
    border-radius: 16px;
    overflow: hidden;
}

.thinking-header {
    padding: 10px 16px;
    background: rgba(255, 183, 77, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #e65100;
    font-weight: 600;
    transition: all 0.3s;
}

.thinking-header:hover {
    background: rgba(255, 183, 77, 0.25);
}

.thinking-icon {
    animation: pulse 2s infinite;
}

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

.thinking-arrow {
    margin-left: auto;
    transition: transform 0.3s;
}

.thinking-process.collapsed .thinking-arrow {
    transform: rotate(-90deg);
}

.thinking-content {
    padding: 16px;
    font-size: 13px;
    color: #bf360c;
    line-height: 1.6;
    white-space: pre-wrap;
    max-height: 300px;
    overflow-y: auto;
    transition: all 0.3s;
}

.thinking-process.collapsed .thinking-content {
    display: none;
}

/* 多媒体内容 */
.message-media {
    margin-top: 12px;
    max-width: 300px;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid var(--light-purple);
    box-shadow: var(--shadow-soft);
}

.message-media img, .message-media video {
    width: 100%;
    display: block;
}

/* 输入区域 */
.input-area {
    padding: 20px 40px 30px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(20px);
    border-top: 2px solid rgba(225, 190, 231, 0.4);
}

.input-wrapper {
    max-width: 800px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.9);
    border-radius: var(--radius-round);
    border: 2px solid rgba(225, 190, 231, 0.5);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    transition: all 0.3s;
}

.input-wrapper:focus-within {
    box-shadow: var(--shadow-glow);
    border-color: var(--primary-purple);
    transform: translateY(-2px);
}

.input-toolbar {
    display: flex;
    gap: 10px;
    padding: 12px 20px 0;
    border-bottom: 1px solid rgba(225, 190, 231, 0.3);
}

.tool-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    border-radius: 8px;
    transition: all 0.3s;
    opacity: 0.7;
}

.tool-btn:hover {
    background: rgba(225, 190, 231, 0.3);
    opacity: 1;
    transform: scale(1.1);
}

.upload-preview {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(243, 229, 245, 0.5);
    position: relative;
}

.upload-preview img, .upload-preview video {
    max-height: 60px;
    border-radius: 8px;
    border: 2px solid var(--light-purple);
}

.remove-file {
    background: rgba(244, 67, 54, 0.1);
    border: none;
    color: #f44336;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    transition: all 0.3s;
}

.remove-file:hover {
    background: rgba(244, 67, 54, 0.2);
    transform: scale(1.1);
}

.input-box {
    display: flex;
    align-items: flex-end;
    padding: 16px 20px;
    gap: 12px;
}

textarea {
    flex: 1;
    border: none;
    resize: none;
    background: transparent;
    font-family: inherit;
    font-size: 15px;
    color: var(--text-primary);
    line-height: 1.6;
    max-height: 200px;
    outline: none;
}

textarea::placeholder {
    color: rgba(123, 31, 162, 0.4);
}

.send-btn {
    background: linear-gradient(135deg, var(--primary-purple) 0%, #ba68c8 100%);
    color: white;
    border: none;
    border-radius: 16px;
    padding: 10px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(156, 39, 176, 0.3);
}

.send-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(156, 39, 176, 0.4);
}

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

.input-footer {
    text-align: center;
    margin-top: 12px;
    color: var(--text-secondary);
    opacity: 0.6;
    font-size: 12px;
}

/* 代码块样式 */
pre {
    background: rgba(48, 25, 52, 0.05);
    border: 1px solid rgba(156, 39, 176, 0.2);
    border-radius: 12px;
    padding: 16px;
    overflow-x: auto;
    margin: 12px 0;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
}

code {
    font-family: 'Consolas', 'Monaco', monospace;
    background: rgba(156, 39, 176, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    color: var(--deep-purple);
}

/* 响应式 */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -300px;
        height: 100vh;
        z-index: 99;
        width: 280px;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .chat-container {
        padding: 80px 20px 20px;
    }
    
    .input-area {
        padding: 15px 20px 25px;
    }
    
    .welcome-content h1 {
        font-size: 28px;
    }
    
    .quick-starts {
        grid-template-columns: 1fr;
    }
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(243, 229, 245, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(156, 39, 176, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(156, 39, 176, 0.5);
}

/* 加载动画 */
.typing-indicator {
    display: flex;
    gap: 6px;
    padding: 8px 0;
}

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

.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; }

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