:root {
    /* 主题色系 - 使用更现代的深蓝紫色调 */
    --primary-gradient-start: #4e54c8;
    --primary-gradient-end: #8f94fb;
    --sidebar-bg-start: #1a1c23;
    --sidebar-bg-end: #242832;
    
    /* 强调色 */
    --accent-color: #6c5ce7;
    --accent-hover: #5b4bc4;
    --success-color: #00b894;
    --warning-color: #fdcb6e;
    --danger-color: #ff7675;
    --info-color: #74b9ff;

    /* 中性色 */
    --bg-body: #f0f2f5;
    --bg-surface: #ffffff;
    --text-primary: #2d3436;
    --text-secondary: #636e72;
    --text-muted: #b2bec3;
    --border-color: #dfe6e9;
    
    /* 侧边栏特定 */
    --sidebar-text: #dfe6e9;
    --sidebar-text-muted: #a4b0be;
    --sidebar-input-bg: rgba(255, 255, 255, 0.05);
    --sidebar-border: rgba(255, 255, 255, 0.08);
    
    /* 尺寸与阴影 */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.04);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.08);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.12);
}

/* 全局样式 */
body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    line-height: 1.6;
}

/* 侧边栏美化 */
.sidebar {
    background: linear-gradient(180deg, var(--sidebar-bg-start) 0%, var(--sidebar-bg-end) 100%);
    color: var(--sidebar-text);
    padding: 0;
    box-shadow: 4px 0 24px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
    width: 300px;
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
    border-right: 1px solid rgba(0,0,0,0.1);
}

.sidebar-header {
    padding: 24px;
    text-align: center;
    border-bottom: 1px solid var(--sidebar-border);
    background: rgba(0,0,0,0.2);
    backdrop-filter: blur(10px);
}

.sidebar-header h4 {
    margin: 0;
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
    background: linear-gradient(45deg, #fff, #a4b0be);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.config-section,
.file-browser-section,
.cron-section {
    padding: 24px;
    border-bottom: 1px solid var(--sidebar-border);
}

.sidebar h5 {
    margin-bottom: 16px;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sidebar-text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar .form-label {
    color: var(--sidebar-text);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 6px;
}

.sidebar .form-control,
.sidebar .form-select {
    background: var(--sidebar-input-bg);
    border: 1px solid var(--sidebar-border);
    color: #fff;
    font-size: 0.9rem;
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    transition: all 0.2s ease;
}

.sidebar .form-control:focus,
.sidebar .form-select:focus {
    background: rgba(255,255,255,0.1);
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.2);
    color: #fff;
}

.sidebar .form-text {
    color: var(--sidebar-text-muted);
    font-size: 0.8rem;
    margin-top: 6px;
}

/* Webhook 切换按钮组 */
.webhook-toggle-group {
    background: var(--sidebar-input-bg);
    padding: 3px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--sidebar-border);
}

.webhook-toggle-group .btn-webhook-toggle {
    border: none;
    border-radius: 4px;
    color: var(--sidebar-text-muted);
    font-size: 0.85rem;
    padding: 6px 12px;
    background: transparent;
}

.webhook-toggle-group .btn-webhook-toggle:hover {
    color: #fff;
    background: rgba(255,255,255,0.05);
}

.webhook-toggle-group .btn-webhook-toggle.active {
    background: var(--accent-color);
    color: #fff;
    box-shadow: 0 2px 8px rgba(108, 92, 231, 0.4);
}

.webhook-hidden-box {
    background: rgba(0,0,0,0.2);
    border: 1px dashed var(--sidebar-border);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-top: 8px;
    color: var(--sidebar-text-muted);
    font-size: 0.85rem;
}

.webhook-hidden-box .masked-value {
    font-family: monospace;
    letter-spacing: 2px;
    opacity: 0.7;
}

/* 主内容区 */
.main-content {
    margin-left: 300px;
    width: calc(100% - 300px);
    background: var(--bg-body);
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.content-header {
    background: var(--bg-surface);
    padding: 20px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    z-index: 10;
}

.content-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.02em;
}

.editor-container {
    padding: 24px 32px;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.editor-split {
    display: flex;
    gap: 24px;
    height: 100%;
    align-items: stretch;
}

.split-pane {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.editor-pane {
    flex: 7;
}

.preview-pane {
    flex: 3;
}

.editor-section,
.preview-section {
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    flex: 1;
}

.editor-section:hover,
.preview-section:hover {
    box-shadow: var(--shadow-lg);
}

.editor-header,
.preview-header {
    background: var(--bg-surface);
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.editor-header span,
.preview-header span {
    display: flex;
    align-items: center;
}

.editor-header i,
.preview-header i {
    color: var(--accent-color);
    margin-right: 8px;
}

/* 编辑器工具栏 */
.editor-tools .btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    transition: all 0.2s;
}

.editor-tools .btn:hover {
    background: var(--bg-body);
    color: var(--accent-color);
    border-color: var(--accent-color);
}

/* CodeMirror 自定义 */
.editor-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.editor-body .CodeMirror {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    line-height: 1.6;
    font-size: 14px;
    height: 100%;
}

.preview-content {
    padding: 24px;
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-primary);
    overflow-y: auto;
    flex: 1;
}

.preview-content blockquote {
    border-left: 4px solid var(--accent-color);
    background: rgba(108, 92, 231, 0.05);
    padding: 12px 16px;
    margin: 16px 0;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.preview-content pre {
    background: #282c34;
    color: #abb2bf;
    padding: 16px;
    border-radius: var(--radius-sm);
}

.preview-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 12px 0;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}

/* 按钮美化 */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 500;
    padding: 8px 16px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-gradient-start), var(--primary-gradient-end));
    border: none;
    box-shadow: 0 4px 12px rgba(78, 84, 200, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(78, 84, 200, 0.4);
}

.btn-success {
    background: var(--success-color);
    border: none;
    color: #fff;
}

.btn-outline-secondary {
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.btn-outline-secondary:hover {
    background: var(--bg-body);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

/* 文件浏览器 */
.file-list {
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--sidebar-border);
    border-radius: var(--radius-sm);
    max-height: 250px;
    overflow-y: auto;
}

.file-item {
    border-bottom: 1px solid var(--sidebar-border);
    padding: 10px 12px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    cursor: pointer;
    gap: 10px; /* Use gap for consistent spacing */
}

.file-item:hover {
    background: rgba(255,255,255,0.05);
}

.file-item.directory .file-icon { color: #f1c40f; }
.file-item.file .file-icon { color: #74b9ff; }

.file-icon {
    width: 20px; /* Increased width for better icon accommodation */
    text-align: center;
    flex-shrink: 0;
    /* margin-right removed in favor of gap */
}

.file-name {
    flex: 1;
    word-break: break-all;
    line-height: 1.4;
}

.file-size {
    font-size: 0.8rem;
    color: var(--sidebar-text-muted);
    white-space: nowrap;
    flex-shrink: 0;
    font-family: monospace;
}

.file-browser-controls {
    display: flex;
    gap: 8px;
}

.file-browser-controls .btn {
    flex: 1;
    justify-content: center;
    display: flex;
    align-items: center;
    gap: 6px;
}
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.2);
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.2);
}

/* 响应式微调 */
@media (max-width: 992px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        box-shadow: none;
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
    }
    
    .editor-split {
        flex-direction: column;
    }
    
    .editor-pane, .preview-pane {
        min-height: 500px;
    }
    
    .editor-section, .preview-section {
        margin-bottom: 20px;
    }
}

/* 提及人员区域 */
.mention-section {
    background: var(--bg-surface);
    padding: 16px;
    border-top: 1px solid var(--border-color);
}

.mention-person-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.mention-person-item label {
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
}

.mention-person-item input[type="checkbox"] {
    margin-right: 6px;
}

/* 定时任务列表美化 */
.cron-jobs-list {
    max-height: 250px;
    overflow-y: auto;
}

.cron-job-item {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--sidebar-border);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    padding: 12px;
    transition: all 0.2s;
    color: var(--sidebar-text);
}

.cron-job-item:hover {
    background: rgba(255,255,255,0.06);
    transform: translateX(4px);
    border-left: 3px solid var(--accent-color);
}


.current-path {
    background: var(--sidebar-input-bg);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    font-family: monospace;
    font-size: 0.85rem;
    border: 1px solid var(--sidebar-border);
}

/* Sidebar Specific Overrides for Contrast */
.sidebar .btn-outline-secondary {
    color: var(--sidebar-text);
    border-color: var(--sidebar-border);
    background: rgba(255, 255, 255, 0.05);
}

.sidebar .btn-outline-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border-color: #fff;
}

.sidebar .text-muted,
.sidebar .form-text,
.sidebar .small,
.sidebar small {
    color: var(--sidebar-text-muted) !important;
}

.sidebar .form-control::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.cron-job-item .text-muted {
    color: var(--sidebar-text-muted) !important;
}

/* Badge Customization */
.badge {
    border-radius: 12px;
    padding: 4px 8px;
    font-weight: 600;
}

.badge.bg-success {
    background: var(--success-color) !important;
}

.badge.bg-secondary {
    background: var(--text-secondary) !important;
}
