/* 全局样式 */
:root {
    --primary-color: #4b48ef;
    --primary-hover: #3a37d0;
    --main-bg: #ffffff;
    --chat-bg: #f7f9fc;
    --text-dark: #2c2c2c;
    --text-light: #666666;
    --border-color: #e0e0e0;
    --input-bg: #f5f5f5;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --button-hover: #f0f0f0;
    --user-bubble: linear-gradient(135deg, #4b48ef, #6a67ff);
    --ai-bubble: #ffffff;
    --ai-avatar-bg: #e9f5ff;
    --ai-avatar-color: #4b48ef;
    --accent-color: #00c2ff;
    --success-color: #00d084;
    --card-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
    --glass-bg: rgba(255, 255, 255, 0.8);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: var(--text-dark);
    background-color: var(--main-bg);
    line-height: 1.6;
    overflow: hidden;
    height: 100vh;
}

/* 应用容器 */
.app-container {
    display: flex;
    height: 100vh;
    width: 100%;
}

/* 主内容区样式 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    overflow-y: auto;
}

/* 欢迎页面 */
.welcome-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 120px 20px 40px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.welcome-header h1 {
    font-size: 2rem;
    margin-bottom: 40px;
    color: var(--text-dark);
    font-weight: 500;
}

/* 输入区域样式 */
.input-container {
    width: 100%;
    position: relative;
}

.welcome-input {
    margin-bottom: 30px;
}

.input-wrapper {
    position: relative;
    border-radius: 24px;
    background-color: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.input-wrapper:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 8px 20px rgba(75, 72, 239, 0.15);
    transform: translateY(-2px);
    background-color: white;
}

.input-wrapper:focus-within {
    box-shadow: 0 4px 12px var(--shadow-color);
}

textarea {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-dark);
    font-size: 16px;
    padding: 16px 20px;
    resize: none;
    font-family: inherit;
    max-height: 200px;
    overflow-y: auto;
    border-radius: 24px;
}

.input-buttons {
    display: flex;
    align-items: center;
    padding-right: 12px;
}

.action-button {
    background: transparent;
    border: none;
    color: var(--text-light);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-left: 4px;
}

.action-button:hover {
    background-color: var(--button-hover);
}

.send-button {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-left: 8px;
    box-shadow: 0 4px 10px rgba(75, 72, 239, 0.2);
}

.send-button:hover {
    background: linear-gradient(135deg, var(--primary-hover), var(--accent-color));
    box-shadow: 0 6px 15px rgba(75, 72, 239, 0.3);
    transform: translateY(-2px);
}

.send-button:active {
    transform: scale(0.95);
}

/* 快速操作按钮 */
.quick-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.quick-action-btn {
    background-color: transparent;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 14px;
    color: var(--text-dark);
    cursor: pointer;
    transition: background-color 0.2s;
}

.quick-action-btn:hover {
    background-color: var(--button-hover);
}

/* 聊天页面 */
.chat-page {
    display: none;
    flex-direction: column;
    height: 100vh;
    padding: 0;
    background-color: var(--chat-bg);
    position: relative;
    background-image: linear-gradient(to bottom right, rgba(240, 240, 255, 0.5), rgba(255, 255, 255, 0.8));
    background-attachment: fixed;
}

.chat-header {
    text-align: center;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    background-color: var(--glass-bg);
    box-shadow: 0 1px 10px rgba(0, 0, 0, 0.03);
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.chat-header-left {
    width: 40px;
}

.chat-header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 60px;
}

.chat-header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.chat-header h1 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
    letter-spacing: -0.3px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.chat-header-status {
    font-size: 0.75rem;
    color: var(--success-color);
    display: flex;
    align-items: center;
    background-color: rgba(0, 208, 132, 0.1);
    padding: 4px 10px;
    border-radius: 12px;
    border: 1px solid rgba(0, 208, 132, 0.2);
}

.chat-header-status::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: var(--success-color);
    border-radius: 50%;
    margin-right: 6px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 208, 132, 0.4);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(0, 208, 132, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 208, 132, 0);
    }
}

.back-button {
    position: absolute;
    left: 15px;
    background: transparent;
    border: none;
    color: var(--text-dark);
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
}

/* 消息容器 */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
    scroll-behavior: smooth;
    display: flex;
    flex-direction: column;
}

/* 助手信息卡片 */
.chat-assistant-info {
    display: flex;
    background-color: var(--glass-bg);
    border-radius: 16px;
    padding: 16px;
    margin: 5px 0 20px;
    box-shadow: var(--card-shadow);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    animation: fadeIn 0.5s ease;
    max-width: 90%;
}

.assistant-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    margin-right: 12px;
    box-shadow: 0 3px 8px rgba(75, 72, 239, 0.15);
    overflow: hidden;
}

.assistant-info h2 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 6px 0;
    color: var(--text-dark);
}

.assistant-info p {
    font-size: 0.85rem;
    color: var(--text-light);
    margin: 0;
    line-height: 1.4;
}

.message {
    padding: 16px 18px;
    margin-bottom: 24px;
    border-radius: 18px;
    animation: fadeIn 0.3s ease;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    max-width: 75%;
    position: relative;
    transition: all 0.3s ease;
}

.message:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
}

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

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.1rem;
    overflow: hidden;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.8);
}

.user-message .message-avatar {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 2px 5px rgba(75, 72, 239, 0.3);
}

.ai-message .message-avatar {
    background-color: var(--ai-avatar-bg);
    color: var(--ai-avatar-color);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.message-content {
    flex: 1;
    line-height: 1.6;
    color: var(--text-dark);
    font-size: 14px;
    word-break: break-word;
    letter-spacing: 0.2px;
}

.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4,
.message-content h5,
.message-content h6 {
    margin-top: 1em;
    margin-bottom: 0.5em;
    font-weight: 600;
    line-height: 1.25;
}

.message-content h1 {
    font-size: 1.5em;
}

.message-content h2 {
    font-size: 1.3em;
}

.message-content h3 {
    font-size: 1.1em;
}

.message-content p {
    margin-bottom: 0.8em;
}

.message-content ul,
.message-content ol {
    margin-bottom: 0.8em;
    padding-left: 1.5em;
}

.message-content li {
    margin-bottom: 0.3em;
}

.message-content a {
    color: var(--primary-color);
    text-decoration: none;
}

.message-content a:hover {
    text-decoration: underline;
}

.message-content blockquote {
    border-left: 3px solid var(--border-color);
    padding-left: 1em;
    margin-left: 0;
    color: var(--text-light);
    font-style: italic;
}

.message-content img {
    max-width: 100%;
    border-radius: 4px;
}

.message-content table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 1em;
}

.message-content th,
.message-content td {
    border: 1px solid var(--border-color);
    padding: 8px;
    text-align: left;
}

.message-content th {
    background-color: rgba(0, 0, 0, 0.03);
}

.message-content tr:nth-child(even) {
    background-color: rgba(0, 0, 0, 0.01);
}

.message-content pre {
    background-color: #f6f8fa;
    border-radius: 6px;
    padding: 12px;
    overflow-x: auto;
    margin: 0.8em 0;
    position: relative;
}

.message-content code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.9em;
    background-color: rgba(0, 0, 0, 0.05);
    padding: 0.2em 0.4em;
    border-radius: 3px;
}

.message-content pre code {
    background-color: transparent;
    padding: 0;
    border-radius: 0;
    font-size: 0.85em;
    line-height: 1.5;
}

.user-message {
    background: var(--user-bubble);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
    box-shadow: 0 5px 15px rgba(75, 72, 239, 0.25);
    position: relative;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.user-message::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: -8px;
    width: 16px;
    height: 16px;
    background: var(--primary-color);
    border-bottom-left-radius: 16px;
    box-shadow: 0 2px 5px rgba(75, 72, 239, 0.1);
    clip-path: polygon(0 0, 0% 100%, 100% 100%);
}

.user-message .message-content {
    color: white;
}

.ai-message {
    background-color: var(--ai-bubble);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    margin-right: auto;
    border-bottom-left-radius: 4px;
    position: relative;
    border: 1px solid rgba(0, 0, 0, 0.03);
    background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 1));
}

.ai-message::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: -8px;
    width: 16px;
    height: 16px;
    background: white;
    border-bottom-right-radius: 16px;
    box-shadow: -2px 2px 5px rgba(0, 0, 0, 0.03);
    clip-path: polygon(100% 0, 0 100%, 100% 100%);
}

/* 消息时间戳 */
.message-time {
    font-size: 10px;
    color: rgba(0, 0, 0, 0.4);
    margin-top: 4px;
    text-align: right;
    position: absolute;
    bottom: 4px;
    right: 10px;
}

.user-message .message-time {
    color: rgba(255, 255, 255, 0.7);
    position: absolute;
    bottom: 4px;
    right: 10px;
}

/* 聊天输入区域 */
.chat-input {
    padding: 12px 16px 20px;
    position: sticky;
    bottom: 0;
    z-index: 5;
    background: transparent;
}

.floating-input-container {
    max-width: 90%;
    width: 700px;
    margin: 0 auto;
}

.chat-input .input-wrapper {
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 24px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* 添加消息状态指示器 */
.message-status {
    font-size: 11px;
    color: var(--text-light);
    text-align: center;
    margin: 8px 0;
    opacity: 0.7;
    padding: 3px 10px;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 10px;
    display: inline-block;
    align-self: center;
}

/* 添加消息分组时间戳 */
.message-date-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 15px 0;
    color: var(--text-light);
    font-size: 11px;
}

.message-date-divider::before,
.message-date-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background-color: var(--border-color);
    margin: 0 10px;
}

.message-date-divider span {
    padding: 2px 8px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 10px;
}

/* 打字动画效果 */
.typing-animation {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px 0;
}

/* 消息操作按钮 */
.message-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: none;
    gap: 5px;
}

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

.message-action-btn {
    background: rgba(255, 255, 255, 0.8);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-light);
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    position: relative;
}

.message-action-btn:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.user-message .message-action-btn {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

.user-message .message-action-btn:hover {
    background: rgba(255, 255, 255, 0.5);
}

.copy-tooltip {
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    white-space: nowrap;
    animation: fadeIn 0.3s ease;
}

/* 版本信息 */
.version-info {
    position: fixed;
    bottom: 5px;
    right: 10px;
    font-size: 10px;
    color: var(--text-light);
    opacity: 0.5;
    z-index: 1;
}

/* 密钥输入界面 */
.key-input-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f5f7fa, #e4e8f0);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.key-input-card {
    background-color: white;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    padding: 30px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    animation: fadeInUp 0.5s ease;
}

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

.key-input-header {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.key-input-header img {
    margin-right: 10px;
}

.key-input-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.key-input-description {
    color: var(--text-light);
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.key-input-form {
    display: flex;
    margin-bottom: 15px;
}

.key-input-form input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 10px 0 0 10px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}

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

.key-input-form button {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    border: none;
    border-radius: 0 10px 10px 0;
    padding: 0 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.key-input-form button:hover {
    filter: brightness(1.1);
}

.key-input-error {
    color: #ff4d4f;
    font-size: 0.85rem;
    min-height: 20px;
    text-align: left;
}

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

.typing-dot:nth-child(1) {
    animation-delay: 0s;
}

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

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

@keyframes typingAnimation {
    0%, 100% {
        transform: scale(0.8);
        opacity: 0.6;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
    }
}
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px 15px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background-color: var(--text-light);
    border-radius: 50%;
    opacity: 0.6;
    animation: typingAnimation 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
    animation-delay: 0s;
}

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

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

@keyframes typingAnimation {
    0%, 100% {
        transform: scale(1);
        opacity: 0.6;
    }
    50% {
        transform: scale(1.5);
        opacity: 1;
    }
}

/* 加载动画 */
.loading-container {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(75, 72, 239, 0.2);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

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

/* 响应式设计 */
@media (max-width: 768px) {
    .welcome-container {
        padding: 80px 20px 40px;
    }
    
    .welcome-header h1 {
        font-size: 1.8rem;
    }
    
    .quick-actions {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 10px;
        justify-content: flex-start;
    }
}

/* 打字机效果 */
.typing-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--primary-color);
    margin-right: 5px;
    animation: blink 1s infinite;
}

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

/* 代码块样式 */
pre {
    background-color: #f5f5f5;
    border-radius: 8px;
    padding: 16px;
    overflow-x: auto;
    margin: 12px 0;
    position: relative;
    border: 1px solid var(--border-color);
}

code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    color: var(--text-dark);
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #eaeaea;
    padding: 8px 12px;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    font-size: 12px;
    color: var(--text-dark);
    border-bottom: 1px solid var(--border-color);
}

.copy-code {
    background: transparent;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    transition: opacity 0.2s;
}

.copy-code:hover {
    opacity: 0.8;
}

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

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

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

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