/* 自定义样式 */

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

/* 主题按钮 */
.topic-btn {
    padding: 0.5rem 1.5rem;
    border-radius: 0.5rem;
    background-color: #374151;
    color: #9CA3AF;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.topic-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.4s, height 0.4s;
}

.topic-btn:hover::before {
    width: 200px;
    height: 200px;
}

.topic-btn:hover {
    background-color: #4B5563;
    color: #E5E7EB;
    transform: translateY(-2px);
}

.topic-btn.active {
    background-color: #3B82F6;
    color: white;
    border-color: #60A5FA;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.topic-btn.active::after {
    content: '✓';
    position: absolute;
    top: -5px;
    right: -5px;
    background: #10B981;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 控制按钮 */
.control-btn {
    padding: 0.5rem 1.5rem;
    border-radius: 0.5rem;
    background-color: #374151;
    color: white;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid #4B5563;
    position: relative;
    overflow: hidden;
}

.control-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.control-btn:hover::before {
    width: 150px;
    height: 150px;
}

.control-btn:hover {
    background-color: #4B5563;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.control-btn:active {
    transform: translateY(0);
}

/* 滑块样式 */
.slider-container {
    margin-bottom: 1.5rem;
    animation: slideIn 0.3s ease;
}

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

.slider-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: #D1D5DB;
}

.slider-value {
    font-family: Monaco, monospace;
    color: #60A5FA;
    font-weight: bold;
    background: rgba(59, 130, 246, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
}

input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #4B5563;
    outline: none;
    -webkit-appearance: none;
    position: relative;
}

input[type="range"]::before {
    content: '';
    position: absolute;
    height: 8px;
    background: linear-gradient(90deg, #3B82F6, #60A5FA);
    border-radius: 4px;
    width: var(--value, 0%);
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #3B82F6;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.5);
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: #60A5FA;
    transform: scale(1.3);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.7);
}

input[type="range"]::-webkit-slider-thumb:active {
    transform: scale(1.1);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #3B82F6;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.5);
}

input[type="range"]::-moz-range-thumb:hover {
    background: #60A5FA;
    transform: scale(1.3);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.7);
}

/* 预设问题按钮 */
.preset-question-btn {
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    background-color: #1F2937;
    color: #9CA3AF;
    font-size: 0.75rem;
    border: 1px solid #374151;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.preset-question-btn::before {
    content: '💬';
    position: absolute;
    left: -20px;
    opacity: 0;
    transition: all 0.3s;
}

.preset-question-btn:hover::before {
    left: 8px;
    opacity: 1;
}

.preset-question-btn:hover {
    background-color: #374151;
    color: #E5E7EB;
    border-color: #4B5563;
    padding-left: 1.5rem;
    transform: translateX(5px);
}

/* 聊天消息 */
.chat-message {
    padding: 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    line-height: 1.5;
    animation: messageSlideIn 0.3s ease;
}

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

.chat-message.user {
    background: linear-gradient(135deg, #1E40AF, #3B82F6);
    color: white;
    margin-left: 2rem;
    box-shadow: 0 2px 8px rgba(30, 64, 175, 0.3);
}

.chat-message.ai {
    background-color: #374151;
    color: #E5E7EB;
    margin-right: 2rem;
    border-left: 3px solid #3B82F6;
}

.chat-message.loading {
    background-color: #374151;
    color: #9CA3AF;
    font-style: italic;
    animation: pulse 1.5s infinite;
}

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

/* 打字机效果 */
@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.typing-cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background-color: currentColor;
    margin-left: 2px;
    animation: blink 1s infinite;
}

/* Canvas容器 */
#canvas-container {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

#canvas-container canvas {
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

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

#chat-history::-webkit-scrollbar-track {
    background: #1F2937;
    border-radius: 3px;
}

#chat-history::-webkit-scrollbar-thumb {
    background: #4B5563;
    border-radius: 3px;
    transition: background 0.3s;
}

#chat-history::-webkit-scrollbar-thumb:hover {
    background: #6B7280;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    main {
        flex-direction: column;
    }

    main > div:last-child {
        width: 100%;
        border-left: none;
        border-top: 1px solid #374151;
        max-height: 50vh;
    }
}

/* API配置弹窗 */
#api-config-modal {
    backdrop-filter: blur(4px);
}

#api-config-modal.show {
    display: flex;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* 知识点卡片动画 */
#knowledge-card {
    animation: fadeIn 0.5s ease;
}

/* 页脚动画 */
footer {
    animation: slideUp 0.5s ease;
}

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

/* 加载动画 */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #4B5563;
    border-top-color: #3B82F6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* 选择框样式 */
select {
    cursor: pointer;
    transition: all 0.3s ease;
}

select:hover {
    border-color: #60A5FA !important;
}

select:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 输入框动画 */
#user-input {
    transition: all 0.3s ease;
}

#user-input:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
    transform: translateY(-1px);
}

/* 按钮点击效果 */
button {
    position: relative;
    z-index: 1;
}

button:active {
    transform: scale(0.98);
}

/* 提示文字闪烁 */
@keyframes glow {
    0%, 100% {
        text-shadow: 0 0 5px rgba(59, 130, 246, 0.5);
    }
    50% {
        text-shadow: 0 0 20px rgba(59, 130, 246, 0.8);
    }
}

.glow-text {
    animation: glow 2s ease-in-out infinite;
}

