@import url("https://fontsapi.zeoseven.com/83/main/result.css");


:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --secondary: #10b981;
    --bg-light: #f8fafc;
    --bg-card: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius: 12px;
    --transition: all 0.3s ease;
}

[data-theme="dark"] {
    --primary: #818cf8;
    --primary-light: #a5b4fc;
    --primary-dark: #6366f1;
    --secondary: #34d399;
    --bg-light: #0f172a;
    --bg-card: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-light: #64748b;
    --border: #334155;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Chill Round Gothic','Segoe UI', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg-light);
    color: var(--text-primary);
    transition: var(--transition);
    height: 100vh;
    overflow: hidden;
}

#particles-js {
    position: fixed;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.4;
}

.app-container {
    display: flex;
    height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    gap: 20px;
}

/* 侧边栏样式 */
.sidebar {
    width: 320px;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.logo i {
    font-size: 24px;
}

.action-buttons {
    display: flex;
    gap: 10px;
}

.btn {
    padding: 10px 16px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.btn-primary {
    background: var(--primary);
    color: white;
    flex: 1;
}

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

.btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-light);
    color: var(--primary);
}

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

.conversation-item {
    position: relative;
    padding: 14px;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.conversation-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.delete-conversation-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 5px;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
}

.conversation-item:hover .delete-conversation-btn {
    opacity: 1;
}

.delete-conversation-btn:hover {
    color: #dc3545;
}

.conversation-item:hover {
    background: var(--bg-light);
}

.conversation-item.active {
    background: var(--primary);
    color: white;
}

.conversation-title {
    font-weight: 600;
    font-size: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.conversation-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-light);
}

.conversation-item.active .conversation-meta {
    color: rgba(255, 255, 255, 0.8);
}

/* 主聊天区域 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

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

.chat-title {
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.chat-controls {
    display: flex;
    gap: 10px;
}

.chat-window {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.message {
    display: flex;
    gap: 12px;
    max-width: 85%;
    animation: fadeIn 0.4s forwards;
}

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

.message-ai {
    align-self: flex-start;
}

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

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

.avatar-ai {
    background: var(--secondary);
    color: white;
}

.message-content {
    padding: 14px 18px;
    border-radius: 18px;
    box-shadow: var(--shadow);
    position: relative;
}

.message-user .message-content {
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 6px;
}

.message-ai .message-content {
    background: var(--bg-light);
    color: var(--text-primary);
    border-bottom-left-radius: 6px;
}

.message-text {
    line-height: 1.5;
    white-space: pre-wrap;
}

.message-meta {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 11px;
    opacity: 0.7;
}

.message-actions {
    position: absolute;
    top: 8px;
    right: 12px;
    display: none;
    gap: 6px;
}

.message-content:hover .message-actions {
    display: flex;
}

.action-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: inherit;
    font-size: 12px;
    transition: var(--transition);
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.message-ai .action-btn {
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-primary);
}

.message-ai .action-btn:hover {
    background: rgba(0, 0, 0, 0.15);
}

.input-area {
    padding: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.input-wrapper {
    flex: 1;
    position: relative;
}

#messageInput {
    width: 100%;
    min-height: 50px;
    max-height: 150px;
    padding: 14px 50px 14px 16px;
    border: 1px solid var(--border);
    border-radius: 24px;
    resize: none;
    font-size: 15px;
    background: var(--bg-light);
    color: var(--text-primary);
    transition: var(--transition);
    line-height: 1.5;
}

#messageInput:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.input-actions {
    position: absolute;
    right: 12px;
    bottom: 12px;
    display: flex;
    gap: 8px;
}

.input-action {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 16px;
    transition: var(--transition);
}

.input-action:hover {
    color: var(--primary);
}

#sendButton {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: var(--transition);
}

#sendButton:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

#sendButton:disabled {
    background: var(--text-light);
    cursor: not-allowed;
    transform: none;
}

.thinking-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    background: var(--bg-light);
    border-radius: 18px;
    border-bottom-left-radius: 6px;
    font-size: 14px;
    color: var(--text-secondary);
}

.dots {
    display: flex;
    gap: 4px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-light);
    animation: pulse 1.5s infinite ease-in-out;
}

.dot:nth-child(2) {
    animation-delay: 0.2s;
}

.dot:nth-child(3) {
    animation-delay: 0.4s;
}

/* 表格样式 */
.chat-table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.chat-table th {
    background: var(--primary);
    color: white;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
}

.chat-table td {
    padding: 10px 12px;
    border: 1px solid var(--border);
    text-align: left;
}

.chat-table tr:nth-child(even) {
    background: var(--bg-light);
}

/* Markdown 内容样式 */
.markdown-content h1, .markdown-content h2, .markdown-content h3 {
    margin-top: 16px;
    margin-bottom: 8px;
    color: var(--primary);
}

.markdown-content p {
    margin-bottom: 12px;
}

.markdown-content ul, .markdown-content ol {
    margin-left: 20px;
    margin-bottom: 12px;
}

.markdown-content li {
    margin-bottom: 4px;
}

.markdown-content code {
    background: var(--bg-light);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}

.markdown-content pre {
    background: var(--bg-light);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 12px 0;
}

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

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

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

/* ==================== 移动端适配 ==================== */

/* 移动端侧边栏折叠功能 */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 50%;
    left: 0px;
    z-index: 1000;
    background: var(--primary);
    color: white;
    border: none;
    transform: translateY(-50%);
    width: 44px;
    height: 80px;
    border-radius: 0 12px 12px 0; /* 左侧直角，右侧圆角 */
    font-size: 18px;
    cursor: pointer;
    box-shadow: var(--shadow);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
}

.sidebar-overlay.active {
    display: block;
}

/* 平板设备 (768px - 1024px) */
@media (max-width: 1024px) {
    .app-container {
        padding: 15px;
        gap: 15px;
    }

    .sidebar {
        width: 280px;
    }

    .message {
        max-width: 90%;
    }
}

/* 手机设备 (768px 以下) */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
        padding: 10px;
        gap: 10px;
        height: 100dvh;
    }

    .sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 85%;
        height: 100%;
        max-height: 100%;
        z-index: 999;
        transition: left 0.3s ease;
        border-radius: 0;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }

    .sidebar.active {
        left: 0;
    }

    .main-content {
        width: 100%;
        height: 100%;
        border-radius: var(--radius);
    }

    .sidebar-header {
        padding: 15px;
    }

    .action-buttons {
        flex-direction: row;
    }

    .btn {
        font-size: 13px;
        padding: 8px 12px;
    }

    .btn-text {
        display: inline;
    }

    .conversation-list {
        padding: 8px;
    }

    .conversation-item {
        padding: 12px;
        margin-bottom: 6px;
    }

    .chat-header {
        padding: 12px 16px;
    }

    .chat-title {
        font-size: 16px;
    }

    .chat-controls .btn {
        font-size: 12px;
        padding: 6px 10px;
    }

    .chat-window {
        padding: 15px;
        gap: 15px;
        padding-top: 10px;
    }

    .message {
        max-width: 95%;
        gap: 8px;
    }

    .avatar {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .message-content {
        padding: 12px 16px;
    }

    .message-text {
        font-size: 14px;
    }

    .input-area {
        padding: 15px;
    }

    #messageInput {
        font-size: 14px;
        padding: 12px 45px 12px 14px;
    }

    #sendButton {
        width: 45px;
        height: 45px;
        font-size: 16px;
    }

    /* 表格在移动端的适配 */
    .chat-table {
        font-size: 12px;
    }

    .chat-table th,
    .chat-table td {
        padding: 8px 10px;
    }
}

/* 小屏手机 (480px 以下) */
@media (max-width: 480px) {
    .app-container {
        padding: 5px;
        gap: 5px;
    }

    .sidebar {
        width: 90%;
    }

    .sidebar-toggle {
        top: 50%;
        left: 5px;
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .sidebar-header {
        padding: 12px;
    }

    .action-buttons {
        gap: 5px;
    }

    .btn {
        font-size: 12px;
        padding: 6px 8px;
    }

    .conversation-item {
        padding: 10px;
        font-size: 13px;
    }

    .conversation-title {
        font-size: 13px;
    }

    .conversation-meta {
        font-size: 11px;
    }

    .chat-header {
        padding: 10px 12px;
    }

    .chat-title {
        font-size: 15px;
    }

    .chat-controls .btn span {
        display: none;
    }

    .chat-window {
        padding: 10px;
        gap: 12px;
    }

    .message {
        max-width: 98%;
        gap: 6px;
    }

    .avatar {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .message-content {
        padding: 10px 14px;
        font-size: 13px;
    }

    .input-area {
        padding: 12px;
    }

    #messageInput {
        font-size: 13px;
        padding: 10px 40px 10px 12px;
    }

    #sendButton {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }

    .input-actions {
        right: 8px;
        bottom: 8px;
    }

    .input-action {
        font-size: 14px;
    }

    /* 消息操作按钮在移动端更易点击 */
    .action-btn {
        width: 28px;
        height: 28px;
    }
}

/* 横屏手机优化 */
@media (max-width: 768px) and (orientation: landscape) {
    .sidebar {
        width: 300px;
    }

    .main-content {
        height: 100%;
    }
}

/* 超小屏手机优化 */
@media (max-width: 360px) {
    .sidebar-header {
        padding: 10px;
    }

    .btn {
        padding: 5px 6px;
        font-size: 11px;
    }

    .conversation-item {
        padding: 8px;
    }

    .chat-header {
        padding: 8px 10px;
    }

    .message-content {
        padding: 8px 12px;
    }

    .input-area {
        padding: 10px;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .btn:hover {
        transform: none;
    }

    #sendButton:hover {
        transform: none;
    }

    .action-btn:hover {
        transform: none;
    }

    .conversation-item:hover {
        background: inherit;
    }

    .conversation-item:active {
        background: var(--bg-light);
    }

    /* 在触摸设备上始终显示消息操作按钮 */
    .message-actions {
        display: flex !important;
        opacity: 0.7;
    }
}

/* 高DPI屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .btn, #sendButton, .action-btn {
        -webkit-tap-highlight-color: transparent;
    }
}


