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

:root {
    --primary-color: #4b5563;
    --primary-dark: #374151;
    --secondary-color: #6b7280;
    --accent-color: #64748b;
    --danger-color: #ef4444;
    --success-color: #10b981;
    --background-color: #f3f4f6;
    --card-bg: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --editor-bg: #1f2937;
    --editor-text: #f9fafb;
    --header-height: 60px;
    --border-radius: 8px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --transition: all 0.3s ease;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--background-color);
    padding: 0;
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    background-color: var(--card-bg);
    box-shadow: var(--shadow-sm);
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

header h1 {
    margin-bottom: 8px;
    color: var(--primary-color);
    font-weight: 700;
    font-size: 2rem;
}

header p {
    color: var(--text-secondary);
    font-size: 1rem;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
    flex: 1;
}

.theme-selector {
    text-align: center;
    margin: 20px 0;
    background-color: var(--card-bg);
    padding: 15px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.theme-selector span {
    margin-right: 10px;
    color: var(--text-secondary);
    font-weight: 500;
}

.theme-btn {
    padding: 8px 16px;
    margin: 0 5px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    background-color: var(--background-color);
    color: var(--text-primary);
    font-weight: 500;
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.theme-btn:hover {
    background-color: var(--border-color);
}

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

main {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
}

.editor-container, .preview-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-radius: var(--border-radius);
    overflow: hidden;
    background-color: var(--card-bg);
    box-shadow: var(--shadow);
}

.editor-header, .preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: var(--primary-color);
    color: white;
}

.editor-header h2, .preview-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
}

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

#file-upload {
    display: none;
}

.file-upload-btn, #clear-btn, #copy-btn {
    padding: 8px 16px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-upload-btn {
    background-color: var(--accent-color);
    color: white;
}

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

#clear-btn {
    background-color: var(--danger-color);
    color: white;
}

#clear-btn:hover {
    background-color: #dc2626;
}

#copy-btn {
    background-color: var(--success-color);
    color: white;
}

#copy-btn:hover {
    background-color: #059669;
}

#markdown-editor, #html-preview {
    flex: 1;
    padding: 20px;
    min-height: 500px;
    overflow: auto;
}

#markdown-editor {
    resize: none;
    font-family: 'Fira Code', 'Courier New', Courier, monospace;
    font-size: 15px;
    line-height: 1.6;
    border: none;
    outline: none;
    background-color: var(--editor-bg);
    color: var(--editor-text);
}

#html-preview {
    background-color: white;
    min-height: 500px;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

footer {
    text-align: center;
    padding: 20px;
    background-color: var(--card-bg);
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

#copy-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #4c6bff;
    color: white;
    padding: 10px 20px;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    transition: opacity 0.3s ease;
    z-index: 1000;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateY(20px); }
    10% { opacity: 1; transform: translateY(0); }
    90% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-20px); }
}

#debug-info {
    margin-top: 20px;
    padding: 15px;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    display: none;
}

#debug-info h3 {
    margin-bottom: 10px;
    color: var(--text-primary);
}

#debug-output {
    background-color: var(--editor-bg);
    color: var(--editor-text);
    padding: 10px;
    border-radius: 4px;
    max-height: 300px;
    overflow: auto;
    margin-bottom: 10px;
    font-family: 'Fira Code', monospace;
    font-size: 14px;
}

#toggle-debug {
    padding: 8px 16px;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
}

#toggle-debug:hover {
    background-color: #475569;
}

/* 响应式设计 */
@media (max-width: 768px) {
    main {
        flex-direction: column;
    }
    
    #markdown-editor, #html-preview {
        min-height: 300px;
    }
    
    .editor-header, .preview-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .editor-actions {
        width: 100%;
        justify-content: space-between;
    }
}

/* 添加一些额外的美化效果 */
.editor-container {
    transition: var(--transition);
}

.editor-container:focus-within {
    box-shadow: var(--shadow-lg);
}

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

::-webkit-scrollbar-track {
    background: var(--background-color);
}

::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

.preview-header.sticky {
    position: sticky;
    top: 0;
    background-color: var(--primary-color);
    z-index: 100;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
}

/* 移除悬浮按钮相关样式 */

/* 添加颜色选择器的样式 */
.color-picker-container {
    display: flex;
    align-items: center;
    margin: 0 10px;
}

.color-picker-container label {
    margin-right: 5px;
    font-size: 14px;
}

.preview-actions {
    display: flex;
    align-items: center;
}

/* 颜色选择区域样式 */
.color-selection {
    display: flex;
    align-items: center;
    margin: 0 10px;
    flex-wrap: wrap;
    gap: 5px;
}

.color-selection label {
    margin-right: 5px;
    white-space: nowrap;
}

.preset-colors {
    display: flex;
    margin-left: 10px;
}

.preset-color {
    width: 24px;
    height: 24px;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin: 0 3px;
    padding: 2px;
    background: none;
    cursor: pointer;
}

.preset-color span {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 2px;
}

.preset-color:hover {
    border-color: #666;
}

.preset-color.active {
    border-color: #000;
    box-shadow: 0 0 3px rgba(0,0,0,0.3);
}

.color-history {
    display: flex;
    margin-left: 10px;
}

.history-color {
    width: 20px;
    height: 20px;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin: 0 2px;
    cursor: pointer;
}

.history-color:hover {
    border-color: #666;
}

/* 确保在小屏幕上也能正常显示 */
@media (max-width: 768px) {
    .color-selection {
        margin: 5px 0;
        justify-content: flex-start;
    }
    
    .preset-colors, .color-history {
        margin-left: 0;
        margin-top: 5px;
    }
}

/* 重新设计的调色板样式 */
.color-panel {
    background-color: #f8f9fa;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin: 10px;
    overflow: hidden;
    width: 300px;
}

.color-panel-header {
    background-color: #e9ecef;
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #dee2e6;
}

.color-panel-title {
    font-weight: 600;
    font-size: 14px;
    color: #495057;
}

.color-picker {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    padding: 0;
    background: none;
}

.color-panel-body {
    padding: 15px;
}

.preset-colors {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.preset-color {
    width: 100%;
    aspect-ratio: 1;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 3px;
    background: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.preset-color span {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 5px;
    transition: all 0.2s ease;
}

.preset-color:hover {
    border-color: #adb5bd;
    transform: scale(1.05);
}

.preset-color.active {
    border-color: #212529;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.2);
}

.color-history-container {
    margin-top: 15px;
}

.history-label {
    display: block;
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 8px;
}

.color-history {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.history-color {
    width: 100%;
    aspect-ratio: 1;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.history-color:hover {
    border-color: #adb5bd;
    transform: scale(1.05);
}

/* 将调色板集成到预览区域头部 */
.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    flex-wrap: wrap;
    gap: 10px;
}

.preview-title {
    font-size: 18px;
    font-weight: 600;
    color: #343a40;
    margin: 0;
}

.preview-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.action-button {
    background-color: #4c6bff;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 15px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.action-button:hover {
    background-color: #3a56e0;
}

.action-button:active {
    background-color: #2a46d0;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .preview-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .color-panel {
        width: 100%;
        margin: 10px 0;
    }
    
    .preview-actions {
        width: 100%;
        justify-content: space-between;
    }
}

/* 新的控制面板样式 */
.control-panel {
    background-color: #f8f9fa;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin: 0 auto 20px;
    padding: 15px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    gap: 15px;
}

.control-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-button {
    display: flex;
    align-items: center;
    gap: 6px;
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 14px;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s ease;
}

.control-button:hover {
    background-color: #f1f3f5;
    border-color: #adb5bd;
}

.control-button.primary {
    background-color: #4c6bff;
    color: white;
    border-color: #4c6bff;
}

.control-button.primary:hover {
    background-color: #3a56e0;
    border-color: #3a56e0;
}

.control-button svg {
    flex-shrink: 0;
}

.control-label {
    font-size: 14px;
    color: #495057;
    font-weight: 500;
}

/* 颜色选择器样式 */
.color-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-input {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    padding: 0;
    background: none;
}

.color-presets {
    display: flex;
    gap: 6px;
}

.color-preset {
    width: 24px;
    height: 24px;
    border: 2px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.color-preset:hover {
    transform: scale(1.1);
    border-color: #adb5bd;
}

.color-preset.active {
    border-color: #212529;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.2);
}

.color-history-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-history {
    display: flex;
    gap: 6px;
}

.history-color {
    width: 24px;
    height: 24px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.history-color:hover {
    transform: scale(1.1);
    border-color: #adb5bd;
}

/* 简化编辑区和预览区 */
.section-title {
    font-size: 18px;
    font-weight: 600;
    color: #343a40;
    margin: 0 0 10px 0;
    padding: 0;
}

.editor-container, .preview-container {
    flex: 1;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    background-color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
}

#markdown-editor, #html-preview {
    flex: 1;
    padding: 20px;
    overflow: auto;
    border: none;
    background-color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: #212529;
}

#markdown-editor {
    resize: none;
}

#html-preview {
    background-color: #fff;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .control-panel {
        flex-direction: column;
        align-items: stretch;
    }
    
    .control-section {
        flex-wrap: wrap;
    }
    
    .color-selector, .color-history-wrapper {
        flex-wrap: wrap;
    }
    
    main {
        flex-direction: column;
    }
    
    .editor-container, .preview-container {
        margin-bottom: 20px;
    }
    
    #markdown-editor, #html-preview {
        min-height: 300px;
    }
}

/* 文件上传按钮隐藏原始样式 */
#file-upload {
    display: none;
} 