/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 导航栏 */
.navbar {
    background: white;
    border-radius: 12px;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 24px;
}

.nav-brand {
    font-size: 24px;
    font-weight: bold;
    color: #667eea;
}

.nav-links a {
    color: #666;
    text-decoration: none;
    margin: 0 16px;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: #667eea;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-level {
    background: #667eea;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
}

/* 按钮 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f0f0f0;
    color: #666;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-danger {
    background: #ff4757;
    color: white;
}

.btn-danger:hover {
    background: #ff3344;
}

.btn-full {
    width: 100%;
}

.btn-back {
    margin-bottom: 20px;
}

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

/* 区块 */
.section {
    background: white;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.section h1 {
    font-size: 36px;
    margin-bottom: 12px;
    color: #333;
}

.section h2 {
    font-size: 28px;
    margin-bottom: 16px;
    color: #333;
}

.subtitle {
    color: #666;
    margin-bottom: 24px;
}

/* 功能卡片 */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.feature-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    transition: transform 0.3s;
    cursor: pointer;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.feature-card h3 {
    margin-bottom: 8px;
    color: #333;
}

.feature-card p {
    color: #666;
    margin-bottom: 12px;
}

/* 徽章 */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
}

.badge-free {
    background: #10b981;
    color: white;
}

.badge-vip {
    background: #f59e0b;
    color: white;
}

.badge-premium {
    background: #8b5cf6;
    color: white;
}

/* 内容列表 */
.content-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.content-item {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.content-item:hover {
    background: #f0f0f0;
    border-color: #667eea;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.content-header h3 {
    color: #333;
}

/* 用户管理 */
.admin-actions {
    margin-bottom: 24px;
    display: flex;
    gap: 12px;
}

.user-table-container {
    overflow-x: auto;
}

.user-table {
    width: 100%;
    border-collapse: collapse;
}

.user-table th,
.user-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.user-table th {
    background: #f8f9fa;
    font-weight: 600;
}

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

.status-active {
    color: #10b981;
    font-weight: 500;
}

.status-disabled {
    color: #ef4444;
    font-weight: 500;
}

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

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    padding: 32px;
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
    position: relative;
    animation: slideIn 0.3s ease;
}

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

.close {
    position: absolute;
    top: 16px;
    right: 16px;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.close:hover {
    color: #333;
}

/* 表单 */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

/* 测试账号提示 */
.demo-accounts {
    margin-top: 16px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 14px;
    color: #666;
}

.demo-accounts p {
    margin: 4px 0;
}

/* 提示消息 */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    display: none;
    z-index: 2000;
    animation: fadeInUp 0.3s ease;
}

.toast.show {
    display: block;
}

.toast.success {
    background: #10b981;
}

.toast.error {
    background: #ef4444;
}

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

/* 内容详情 */
#content-detail {
    margin-top: 20px;
}

.code-block {
    background: #f6f8fa;
    color: #24292e;
    padding: 20px;
    border-radius: 8px;
    font-family: 'Consolas', 'Monaco', monospace;
    overflow-x: auto;
    margin: 16px 0;
    border: 1px solid #e1e4e8;
}

.code-header {
    background: #f1f3f5;
    padding: 8px 16px;
    border-radius: 8px 8px 0 0;
    margin: -20px -20px 0 -20px;
    color: #495057;
    font-size: 14px;
    border-bottom: 1px solid #e1e4e8;
}

/* 代码编辑器 */
.code-editor-container {
    margin: 16px 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #d1d5db;
}

.code-editor-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.code-editor-header span {
    font-weight: 600;
}

.code-editor-actions {
    display: flex;
    gap: 8px;
}

.code-editor {
    width: 100%;
    min-height: 300px;
    padding: 16px;
    border: none;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    background: #f8f9fa;
    color: #24292e;
    tab-size: 4;
    -moz-tab-size: 4;
}

.code-editor:focus {
    outline: none;
    background: #ffffff;
}

.code-output-header {
    background: #e9ecef;
    color: #495057;
    padding: 8px 16px;
    font-size: 14px;
}

.code-output {
    background: #f1f3f5;
    color: #24292e;
    padding: 16px;
    min-height: 100px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    white-space: pre-wrap;
    word-break: break-all;
}

.code-output.loading {
    color: #6c757d;
    font-style: italic;
}

.code-output.success {
    border-left: 4px solid #10b981;
    background: #f0fdf4;
}

.code-output.error {
    border-left: 4px solid #ef4444;
    background: #fef2f2;
    color: #b91c1c;
}

.output-success {
    color: #10b981;
    font-weight: bold;
}

.output-error {
    color: #ef4444;
    font-weight: bold;
}

.output-info {
    color: #f59e0b;
    font-weight: bold;
}

/* 代码输出 - 等待输入状态 */
.code-output.waiting {
    border-left: 4px solid #f59e0b;
    background: #fffbeb;
    color: #92400e;
    animation: pulse-waiting 2s ease-in-out infinite;
}

@keyframes pulse-waiting {
    0%, 100% { background: #fffbeb; }
    50% { background: #fef3c7; }
}

/* 预定义输入值 */
.code-inputs {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    padding: 16px;
    margin-top: 16px;
}

.code-inputs h4 {
    color: #0284c7;
    margin-bottom: 8px;
}

.code-inputs .hint {
    font-size: 14px;
    color: #666;
    margin: 8px 0 12px 0;
}

.code-input-editor {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    background: white;
    color: #24292e;
}

.code-input-editor:focus {
    outline: none;
    border-color: #667eea;
}

/* 动态输入对话框 */
.input-dialog-content {
    max-width: 450px !important;
    width: 90% !important;
    padding: 0;
}

.input-dialog-header {
    padding: 20px 24px 12px;
    border-bottom: 1px solid #eee;
}

.input-dialog-header h2 {
    margin: 0 0 8px 0;
    color: #333;
    font-size: 20px;
}

/* 突出的提示区域 */
.input-dialog-prominent {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 18px;
    font-weight: 500;
    border-radius: 0;
}

.input-dialog-prominent .prompt-icon {
    font-size: 24px;
}

.input-dialog-prominent .prompt-text {
    flex: 1;
}

.input-dialog-hint {
    color: #666;
    margin: 0;
    font-size: 14px;
    padding: 8px 24px 16px;
}

/* 批量输入容器 */
.batch-inputs-container {
    padding: 16px 24px;
}

.batch-input-item {
    margin-bottom: 16px;
}

.batch-input-item:last-child {
    margin-bottom: 0;
}

.batch-input-item label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
}

.batch-input-item .input-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: #667eea;
    color: white;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.batch-input-item input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    box-sizing: border-box;
    transition: border-color 0.3s;
}

.batch-input-item input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-dialog-field {
    padding: 16px 24px;
    margin: 0;
}

.input-dialog-field:last-of-type {
    margin-bottom: 8px;
}

.input-dialog-field input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.input-dialog-field input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-dialog-footer {
    padding: 16px 24px 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.input-dialog-tips {
    color: #999;
    font-size: 12px;
}

.input-dialog-tips kbd {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    border: 1px solid #ddd;
}

.input-dialog-actions {
    display: flex;
    gap: 12px;
}

/* 代码提示 */
.code-tips {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    padding: 16px;
    margin-top: 16px;
}

.code-tips h4 {
    color: #0284c7;
    margin-bottom: 8px;
}

.code-tips ul {
    margin-left: 20px;
    color: #666;
}

.code-tips li {
    margin: 4px 0;
}

/* 键盘按键样式 */
.code-tips kbd {
    display: inline-block;
    padding: 2px 8px;
    font-size: 12px;
    font-family: 'Consolas', 'Monaco', monospace;
    line-height: 1.4;
    color: #24292e;
    background: #f6f8fa;
    border: 1px solid #cfd4da;
    border-radius: 4px;
    box-shadow: inset 0 -1px 0 #cfd4da;
}

/* 响应式 */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 16px;
    }

    .nav-links {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
    }

    .features {
        grid-template-columns: 1fr;
    }

    .section {
        padding: 20px;
    }
}

/* ===== Notebook 样式 ===== */

.notebook-actions {
    margin-bottom: 24px;
}

.notebook-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* 文件夹相关样式 */
.folder-item {
    margin: 8px 0;
}

.folder-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    cursor: pointer;
    background: #f8f9fa;
    border-radius: 6px;
    transition: all 0.2s;
    user-select: none;
}

.folder-header:hover {
    background: #f0f0f0;
}

.folder-icon {
    font-size: 20px;
    transition: transform 0.2s;
}

.folder-name {
    font-weight: 500;
    color: #333;
}

.folder-children {
    margin-top: 4px;
}

/* Notebook 文件项 */
.notebook-file-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px 8px 28px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    margin: 4px 0;
}

.notebook-file-item:hover {
    background: #eef2ff;
}

.notebook-file-item .notebook-icon {
    font-size: 18px;
}

.notebook-name {
    color: #555;
    font-size: 14px;
}

/* 旧样式保持兼容 */
.notebook-item {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.notebook-item:hover {
    background: #f0f0f0;
    border-color: #667eea;
}

.notebook-item .notebook-icon {
    font-size: 40px;
}

.notebook-info h3 {
    margin: 0 0 4px 0;
    color: #333;
}

.notebook-filename {
    color: #666;
    font-size: 14px;
    margin: 0;
}

.notebook-time {
    color: #999;
    font-size: 12px;
    margin: 4px 0 0 0;
}

.empty-state,
.error-state {
    text-align: center;
    padding: 40px;
    color: #666;
}

.empty-state .hint {
    font-size: 14px;
    color: #999;
    margin-top: 8px;
}

.error-state {
    color: #ef4444;
}

.loading-text {
    text-align: center;
    padding: 20px;
    color: #666;
}

.notebook-meta {
    color: #666;
    font-size: 14px;
    margin-bottom: 24px;
}

.notebook-cells {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.notebook-cell {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
}

.notebook-cell .cell-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    font-size: 12px;
}

.code-cell .cell-header {
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.markdown-cell .cell-header {
    background: #fef3c7;
    border-bottom: 1px solid #fcd34d;
}

.cell-type {
    font-weight: 600;
    color: #666;
}

.cell-actions {
    display: flex;
    gap: 8px;
}

.markdown-cell .markdown-content {
    padding: 16px;
    line-height: 1.6;
}

.markdown-content h2 {
    font-size: 20px;
    margin: 16px 0 8px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}

.markdown-content h3 {
    font-size: 18px;
    margin: 12px 0 6px 0;
}

.markdown-content h4 {
    font-size: 16px;
    margin: 10px 0 4px 0;
}

.markdown-content p {
    margin: 8px 0;
}

.markdown-content ul {
    margin: 8px 0 8px 24px;
}

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

.markdown-content code,
.inline-code {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
}

.markdown-content pre {
    background: #f6f8fa;
    color: #24292e;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 12px 0;
    border: 1px solid #e1e4e8;
}

.markdown-content pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

.code-cell textarea.code-editor {
    min-height: 150px;
}

.code-cell .cell-output-header {
    background: #e9ecef;
    color: #495057;
    padding: 8px 16px;
    font-size: 12px;
}

.code-cell .code-output {
    min-height: 60px;
    background: #f8f9fa;
}

/* 选项卡样式 */
.folder-tabs {
    display: flex;
    gap: 12px;
    margin: 24px 0;
    flex-wrap: wrap;
    justify-content: center;
}

.folder-tab {
    padding: 12px 24px;
    border: 2px solid transparent;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.3);
    color: white;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.folder-tab:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.folder-tab.active {
    background: white;
    color: #667eea;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* 选项卡内容区域 */
.tab-content {
    background: white;
    border-radius: 16px;
    padding: 24px;
    min-height: 300px;
}

/* Notebook 网格布局 */
.notebook-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

/* Notebook 卡片 */
.notebook-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.notebook-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    border-color: #667eea;
}

.notebook-card-icon {
    font-size: 40px;
    flex-shrink: 0;
}

.notebook-card-info h3 {
    margin: 0 0 6px 0;
    font-size: 16px;
    color: #333;
    word-break: break-word;
}

.notebook-card-info .notebook-path {
    margin: 0;
    font-size: 12px;
    color: #999;
    word-break: break-all;
}

/* 导航栏样式 */
.notebook-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

.notebook-navigation .nav-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.notebook-navigation .prev-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    justify-content: flex-start;
}

.notebook-navigation .prev-btn:hover {
    transform: translateX(-4px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.notebook-navigation .next-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    justify-content: flex-end;
}

.notebook-navigation .next-btn:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.notebook-navigation .back-btn {
    background: #e9ecef;
    color: #495057;
}

.notebook-navigation .back-btn:hover {
    background: #dee2e6;
}

@media (max-width: 768px) {
    .notebook-navigation {
        flex-direction: column;
        gap: 8px;
    }

    .notebook-navigation .nav-btn {
        width: 100%;
    }
}
