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

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background-color: white;
    color: #333;
    line-height: 1.6;
}

body {
    display: flex;
    flex-direction: column;
    padding: 0;
    padding-bottom: 50px;
    min-height: 50vh;
}

form {
    padding-bottom: 100px;
}

.container {
    flex: 1;
    width: 100%;
    min-height: 100vh;
    margin: 0;
    background-color: white;
    padding: 20px;
    padding-bottom: 150px;
    box-shadow: none;
    border-radius: 0;
}

h1 {
    color: #2c3e50;
    margin-bottom: 30px;
    text-align: center;
    font-size: 28px;
}

/* 表单组样式优化 */
.form-group {
    margin-bottom: 25px;
    width: 100%;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
    font-size: 14px;
}

input[type="text"],
textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s;
}

input[type="text"]:focus,
textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

textarea {
    resize: vertical;
    min-height: 300px;
    max-height: 70vh;
    font-family: inherit;
    flex: 1;
}

/* 提交按钮样式优化 */
button[type="submit"], #sendButton {
    width: auto;
    padding: 14px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
    margin: 30px auto 80px !important;
    display: block;
    position: relative;
}

button[type="submit"]:hover {
    background-color: #2980b9;
}

button[type="submit"]:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

/* HTML编辑器和预览容器 */
.html-editor-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 10px;
    min-height: 60vh;
}

.editor-section, .preview-section {
    flex: 1;
    min-width: 300px;
    min-height: 60vh;
    display: flex;
    flex-direction: column;
}

/* HTML预览区域 */
.preview-section {
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.preview-section h4 {
    margin: 0;
    padding: 12px 15px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    font-size: 16px;
    color: #495057;
}

.html-preview {
    flex: 1;
    padding: 15px;
    background-color: white;
    min-height: 400px;
    max-height: 70vh;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* 为预览内容设置基础样式 */
.html-preview h1, .html-preview h2, .html-preview h3, .html-preview h4, .html-preview h5, .html-preview h6 {
    margin-top: 1em;
    margin-bottom: 0.5em;
}

.html-preview p {
    margin-bottom: 1em;
}

.html-preview ul, .html-preview ol {
    margin-left: 20px;
    margin-bottom: 1em;
}

/* 编辑器部分样式优化 */
.editor-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.editor-section > textarea {
    flex: 1;
    min-height: 300px;
}

/* 文件上传区域样式 */
.file-upload {
    padding: 15px;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 0;
}

.file-upload label {
    margin-bottom: 0;
    font-weight: normal;
    white-space: nowrap;
}

#htmlFile {
    flex: 1;
    min-width: 200px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
}

#clearHtml {
    width: auto;
    padding: 8px 16px;
    background-color: #6c757d;
    font-size: 14px;
    white-space: nowrap;
}

#clearHtml:hover {
    background-color: #5a6268;
}

.result {
    margin-top: 30px;
    padding: 20px;
    border-radius: 6px;
    font-size: 14px;
}

.result.success {
    background-color: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.result.error {
    background-color: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

.result.info {
    background-color: #e3f2fd;
    color: #1565c0;
    border: 1px solid #bbdefb;
}

/* 模态框样式 */
.modal {
    display: none; /* 默认隐藏 */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
    transition: opacity 0.3s ease;
}

.modal-content {
    background-color: #fefefe;
    margin: 15% auto;
    padding: 30px;
    border: 1px solid #888;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    position: relative;
    animation: modalFadeIn 0.3s ease-out;
}

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

.close-button {
    color: #aaa;
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close-button:hover,
.close-button:focus {
    color: #333;
    text-decoration: none;
    cursor: pointer;
}

.modal-message {
    margin: 20px 0 30px;
    padding: 15px;
    border-radius: 6px;
    min-height: 40px;
    font-size: 16px;
    line-height: 1.5;
}

.confirm-button {
    width: auto;
    padding: 12px 30px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    display: block;
    margin: 0 auto;
    transition: background-color 0.3s;
}

.confirm-button:hover {
    background-color: #2980b9;
}

/* 为弹窗消息添加不同类型的样式 */
.modal-message.success {
    background-color: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.modal-message.error {
    background-color: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

.modal-message.info {
    background-color: #e3f2fd;
    color: #1565c0;
    border: 1px solid #bbdefb;
}

@media (max-width: 768px) {
    .container {
        padding: 20px;
    }
    
h1 {
        font-size: 24px;
    }
}

/* 加载动画样式 */
.loading-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 模态框样式优化 */
.modal-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    text-align: center;
}

.modal-message p {
    margin: 0;
    font-size: 16px;
}

/* 禁用状态的确定按钮 */
.confirm-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 弹窗样式补充 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: #fefefe;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 500px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    position: relative;
}

.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    top: 10px;
    right: 15px;
}

.close-button:hover,
.close-button:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.confirm-button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    margin-top: 20px;
    transition: background-color 0.3s;
}

.confirm-button:hover:not(:disabled) {
    background-color: #2980b9;
}

/* 消息类型样式 */
.modal-message.success {
    color: #27ae60;
}

.modal-message.error {
    color: #e74c3c;
}

.modal-message.info {
    color: #3498db;
}