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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-600: #4b5563;
    --gray-800: #1f2937;
    --sidebar-width: 280px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.6;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: var(--sidebar-width);
    background: white;
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h2 {
    font-size: 1.125rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.theme-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.theme-item {
    padding: 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 0.5rem;
    border: 2px solid transparent;
}

.theme-item:hover {
    background: var(--gray-100);
}

.theme-item.active {
    background: #eef2ff;
    border-color: var(--primary);
}

.theme-item h4 {
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
}

.theme-item p {
    font-size: 0.75rem;
    color: var(--gray-600);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.theme-stats {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.theme-stats span {
    font-size: 0.625rem;
    padding: 0.125rem 0.375rem;
    background: var(--gray-200);
    border-radius: 0.25rem;
}

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

.content-header {
    padding: 1.5rem 2rem;
    background: white;
    border-bottom: 1px solid var(--gray-200);
}

.content-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.theme-desc {
    color: var(--gray-600);
    font-size: 0.875rem;
}

/* 内容网格 */
.content-grid {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    padding: 1.5rem;
    overflow: hidden;
}

/* 面板 */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.panel-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
}

/* 问答面板 */
.chat-panel {
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.chat-message {
    margin-bottom: 1rem;
    padding: 0.75rem;
    border-radius: 0.5rem;
}

.chat-message.user {
    background: #e0e7ff;
    margin-left: 2rem;
}

.chat-message.assistant {
    background: var(--gray-100);
    margin-right: 2rem;
}

.chat-message .role {
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--gray-600);
    margin-bottom: 0.25rem;
}

.chat-message .content {
    font-size: 0.875rem;
    white-space: pre-wrap;
}

.chat-input-area {
    padding: 1rem;
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: 0.75rem;
}

.chat-input-area textarea {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.5rem;
    resize: none;
    font-family: inherit;
}

/* 白板面板 */
.whiteboard-panel {
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
}

.whiteboard-actions {
    display: flex;
    gap: 0.5rem;
}

.whiteboard {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    font-size: 0.9375rem;
    line-height: 1.8;
    outline: none;
    min-height: 300px;
}

.whiteboard:empty::before {
    content: attr(placeholder);
    color: var(--gray-300);
}

/* 概念高亮 */
.concept-term {
    color: #3b82f6;
    font-weight: 600;
    cursor: pointer;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    background: #dbeafe;
    transition: all 0.2s;
}

.concept-term:hover {
    background: #bfdbfe;
    transform: translateY(-1px);
}

/* 按钮 */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    transition: all 0.3s;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--gray-200);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 1rem;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.concept-modal {
    max-width: 500px;
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-600);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* 表单 */
.form {
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

/* 无主题提示 */
.no-theme-msg {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--gray-600);
    font-size: 1.125rem;
}

.no-theme-msg i {
    font-size: 4rem;
    margin-bottom: 1rem;
    color: var(--gray-300);
}

/* 设置模态框 */
.settings-modal {
    max-width: 700px;
}

.settings-section {
    margin-bottom: 2rem;
}

.settings-section h4 {
    margin-bottom: 1rem;
    color: var(--gray-800);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* 开关按钮 */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--gray-300);
    transition: 0.4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

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

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

/* 测试结果 */
.test-result {
    margin-left: 1rem;
    font-size: 0.875rem;
}

.test-result.success {
    color: var(--success);
}

.test-result.error {
    color: var(--danger);
}

/* 用户菜单 */
.sidebar-user-menu {
    padding: 1rem;
    border-top: 1px solid var(--gray-200);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.user-info i {
    font-size: 1.25rem;
    color: var(--primary);
}

/* 认证模态框 */
.auth-modal {
    max-width: 400px;
}

.auth-form {
    padding: 1.5rem;
}

.auth-switch {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--gray-600);
}

.auth-switch a {
    color: var(--primary);
    text-decoration: none;
}

.auth-switch a:hover {
    text-decoration: underline;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* 笔记面板 */
.notes-panel {
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
}

.notes-list-view {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.notes-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.note-item {
    padding: 1rem;
    background: var(--gray-100);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.note-item:hover {
    background: var(--gray-200);
}

.note-item h4 {
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
}

.note-item p {
    font-size: 0.75rem;
    color: var(--gray-600);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.note-tags {
    display: flex;
    gap: 0.25rem;
    margin-top: 0.5rem;
}

.note-tag {
    font-size: 0.625rem;
    padding: 0.125rem 0.375rem;
    background: var(--primary);
    color: white;
    border-radius: 0.25rem;
}

.note-edit-view {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.note-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.note-form input,
.note-form textarea {
    padding: 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.5rem;
    font-family: inherit;
    font-size: 0.875rem;
}

.note-form textarea {
    flex: 1;
    min-height: 200px;
    resize: vertical;
}

.note-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* 响应式 */
@media (max-width: 1024px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
}
