body {
    font-family: sans-serif;
    line-height: 1.6;
    padding: 20px;
    max-width: 800px;
    margin: 0 auto;
    background-color: #f8f9fa;
}

textarea {
    width: 100%;
    margin-bottom: 15px;
    font-family: monospace;
    border: 1px solid #ccc;
    padding: 10px;
    box-sizing: border-box; /* Include padding in width */
}

button {
    padding: 10px 15px;
    font-size: 1em;
    cursor: pointer;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    margin-bottom: 15px;
}

button:hover {
    background-color: #0056b3;
}

#statusMessage {
    margin-top: 10px;
    font-weight: bold;
    min-height: 1.2em; /* Prevent layout shift */
}

#htmlPreview {
    margin-top: 20px;
    border: 1px dashed #ccc;
    padding: 15px;
    overflow-x: auto; /* Handle wide tables */
}

/* Basic table styling for preview */
#htmlPreview table {
    border-collapse: collapse;
    width: auto; /* Let table size naturally */
    border: 1px solid #dee2e6;
    margin-bottom: 0;
}

#htmlPreview th,
#htmlPreview td {
    border: 1px solid #dee2e6;
    padding: 8px;
    text-align: left;
}

#htmlPreview th {
    background-color: rgba(0, 123, 255, 0.1);
    font-weight: bold;
}

/* 自定义样式，与Bootstrap集成 */
.language-switcher button.active {
    font-weight: bold;
}

/* 保留原有的表格预览样式，并与Bootstrap融合 */
.preview-container {
    overflow-x: auto; /* 处理宽表格 */
    min-height: 100px;
}

/* 适配深色和浅色模式 */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #212529;
        color: #f8f9fa;
    }
    
    .card {
        background-color: #343a40;
        border-color: #495057;
    }
    
    .card-header:not(.bg-primary) {
        background-color: #343a40;
        border-color: #495057;
        color: #ffffff;
    }
    
    .card-body {
        background-color: #343a40;
        color: #ffffff;
    }
    
    .form-control {
        background-color: #2b3035;
        color: #ffffff;
        border-color: #495057;
    }
    
    .form-control::placeholder {
        color: #adb5bd;
    }
    
    #markdownInput {
        background-color: #2b3035;
        color: #ffffff;
        border-color: #495057;
    }
    
    .preview-container {
        background-color: #2b3035;
        color: #ffffff;
        border: 1px solid #495057;
    }
    
    #htmlPreview table {
        border-color: #6c757d;
    }
    
    #htmlPreview th,
    #htmlPreview td {
        border-color: #6c757d;
        color: #ffffff;
    }
    
    #htmlPreview th {
        background-color: rgba(0, 123, 255, 0.2);
    }
}

/* 响应式调整 */
@media (max-width: 768px) {
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
}