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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100vh;
    overflow: hidden;
}

.container {
    display: flex;
    height: 100vh;
    padding: 20px;
    gap: 20px;
}

/* 侧边栏 */
.sidebar {
    width: 300px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    padding: 28px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.logo {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 36px;
    padding-bottom: 28px;
    border-bottom: 2px solid rgba(102, 126, 234, 0.1);
}

.logo .icon {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.logo h2 {
    font-size: 22px;
    color: #1a1a1a;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.functions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 36px;
}

.func-btn {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 2px solid transparent;
    padding: 16px 20px;
    border-radius: 14px;
    cursor: pointer;
    font-size: 15px;
    color: #555;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.func-btn:hover {
    background: #fff;
    border-color: rgba(102, 126, 234, 0.3);
    color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.2);
}

.func-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 6px 24px rgba(102, 126, 234, 0.5);
    transform: translateY(-2px);
}

.current-functions {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
}

.current-functions h3 {
    font-size: 13px;
    color: #999;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
}

#functionList {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.function-item {
    padding: 14px 16px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 12px;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all 0.3s;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.function-item:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.function-item .info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.function-item .color-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    box-shadow: 0 2px 8px currentColor;
}

.function-item .remove-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    opacity: 0.5;
    transition: all 0.2s;
    color: #ff4444;
}

.function-item .remove-btn:hover {
    opacity: 1;
    transform: scale(1.2);
}

/* 主内容区 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 40px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.message {
    display: flex;
    gap: 14px;
    animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

.avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.message.assistant .avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.message.user .avatar {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
}

.content {
    max-width: 70%;
    padding: 18px 24px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.7;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.message.assistant .content {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    color: #333;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.message.user .content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

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

.content p:last-child {
    margin-bottom: 0;
}

.content h4 {
    margin-top: 16px;
    margin-bottom: 8px;
    font-size: 16px;
}

.content ul {
    margin-left: 24px;
    margin-top: 10px;
}

.content ul li {
    margin-bottom: 6px;
}

/* 数据表格 */
.data-table {
    margin: 16px 0;
    overflow-x: auto;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.data-table table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
    background: white;
    border-radius: 12px;
    overflow: hidden;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
}

.data-table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 12px;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover {
    background: #f8f9fa;
}

/* 图表容器 */
.chart-container {
    margin: 20px 0;
    padding: 24px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 2px solid rgba(102, 126, 234, 0.1);
}

.chart-wrapper {
    position: relative;
    height: 450px;
}

/* 对比规律样式 */
.content > div[style*="background: #fff3cd"],
.content > div[style*="background: #e3f2fd"] {
    padding: 20px 24px !important;
    border-radius: 14px !important;
    border-left: 4px solid !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06) !important;
    margin: 16px 0 !important;
}

/* 练习题与批改 */
.practice-item {
    margin: 12px 0;
    padding: 14px;
    background: #f9f9f9;
    border-radius: 8px;
    border-left: 3px solid #667eea;
}

.practice-item .question {
    font-weight: 500;
    margin-bottom: 8px;
}

.practice-item .options {
    margin-left: 20px;
}

.practice-item .options div {
    margin: 6px 0;
}

.answer-input {
    width: 100%;
    padding: 8px 12px;
    margin-top: 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.submit-answer-btn {
    margin-top: 8px;
    margin-right: 8px;
    padding: 8px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.submit-answer-btn:hover {
    background: #5568d3;
}

.quiz-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.analysis-box,
.compare-box,
.guide-box,
.feedback-box {
    margin: 12px 0;
    padding: 12px 14px;
    border-radius: 8px;
}

.analysis-box {
    background: #f9f9f9;
}

.compare-box {
    background: #fff3cd;
    border-left: 3px solid #ffc107;
}

.guide-box {
    background: #e3f2fd;
}

.feedback-box {
    background: #e8f5e9;
}

.mindmap {
    background: white;
    padding: 16px;
    border-radius: 8px;
    border: 1px solid #ddd;
    overflow-x: auto;
}

.content ol {
    margin-left: 24px;
    margin-top: 8px;
}

.content pre {
    white-space: pre;
    font-family: Consolas, 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
}

/* 输入区域 */
.input-area {
    padding: 24px 40px;
    background: linear-gradient(to top, rgba(248, 249, 250, 0.8), transparent);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 14px;
}

.voice-btn {
    width: 48px;
    height: 48px;
    border: none;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 12px;
    cursor: pointer;
    font-size: 22px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.voice-btn:hover {
    background: #fff;
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.voice-btn.listening {
    background: linear-gradient(135deg, #ff4444 0%, #ff6b6b 100%);
    animation: pulse 1.5s infinite;
    color: white;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 68, 68, 0.7);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(255, 68, 68, 0);
    }
}

.voice-output-btn {
    width: 48px;
    height: 48px;
    border: none;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 12px;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.voice-output-btn:hover {
    background: #fff;
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.voice-output-btn.active {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
}

.voice-output-btn.speaking {
    animation: speaking 0.5s infinite;
}

@keyframes speaking {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.15);
    }
}

#userInput {
    flex: 1;
    padding: 14px 20px;
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 24px;
    font-size: 15px;
    outline: none;
    transition: all 0.3s;
    background: white;
}

#userInput:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.send-btn {
    width: 48px;
    height: 48px;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
}

.send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(102, 126, 234, 0.6);
}

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

.send-btn span {
    color: white;
    font-size: 22px;
    font-weight: bold;
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: scale(1);
}

/* 加载动画 */
.loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #667eea;
    font-weight: 500;
}

.loading::after {
    content: '●●●';
    letter-spacing: 2px;
    animation: dots 1.5s steps(3) infinite;
}

@keyframes dots {
    0% { content: '●○○'; }
    33% { content: '●●○'; }
    66% { content: '●●●'; }
}

/* 语音状态指示器 */
.voice-status {
    position: fixed;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    color: white;
    padding: 18px 32px;
    border-radius: 28px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    animation: fadeInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate(-50%, 30px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

.voice-indicator {
    display: flex;
    align-items: center;
    gap: 14px;
}

.voice-indicator .pulse {
    width: 14px;
    height: 14px;
    background: #ff4444;
    border-radius: 50%;
    animation: pulseDot 1.5s infinite;
}

@keyframes pulseDot {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.4);
        opacity: 0.5;
    }
}

.voice-indicator .text {
    font-size: 15px;
    font-weight: 600;
}

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

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

::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.5);
}

/* 响应式优化 */
@media (max-width: 1200px) {
    .sidebar {
        width: 260px;
    }

    .content {
        max-width: 80%;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 12px;
        gap: 12px;
    }

    .sidebar {
        width: 240px;
        padding: 20px;
    }

    .chat-container {
        padding: 24px;
    }

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