/* ============================================================
   Markdown转Word - 样式表
   响应式设计，PC + 移动端适配
   ============================================================ */

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    color: #333;
    background: #f5f7fa;
    line-height: 1.6;
    min-height: 100vh;
}

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

a {
    color: #4a90d9;
    text-decoration: none;
}

/* ---------- Header ---------- */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 40px 0 36px;
    text-align: center;
}

.header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.header .subtitle {
    font-size: 0.95rem;
    opacity: 0.9;
}

/* ---------- Tool Navigation ---------- */
.tool-nav {
    background: #fff;
    border-bottom: 1px solid #ebeef5;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tool-nav .container {
    display: flex;
    gap: 0;
    white-space: nowrap;
}

.tool-nav a {
    display: inline-block;
    padding: 12px 18px;
    font-size: 0.9rem;
    color: #666;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
    flex-shrink: 0;
}

.tool-nav a:hover {
    color: #667eea;
    border-bottom-color: #c0c4cc;
}

.tool-nav a.active {
    color: #667eea;
    border-bottom-color: #667eea;
    font-weight: 600;
}

/* ---------- Main ---------- */
.main {
    padding: 24px 0 48px;
}

/* ---------- Editor Layout ---------- */
.editor-layout {
    display: flex;
    gap: 16px;
    min-height: 520px;
}

.editor-pane,
.preview-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* ---------- Pane Header ---------- */
.pane-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #fff;
    border: 1px solid #ebeef5;
    border-bottom: none;
    border-radius: 10px 10px 0 0;
}

.pane-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #555;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pane-header h3 svg {
    width: 16px;
    height: 16px;
    color: #667eea;
}

.pane-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* ---------- Editor Textarea ---------- */
.md-editor {
    width: 100%;
    flex: 1;
    padding: 16px;
    border: 1px solid #ebeef5;
    border-radius: 0 0 10px 10px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.88rem;
    line-height: 1.7;
    color: #333;
    background: #fff;
    resize: none;
    outline: none;
    tab-size: 4;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.md-editor:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.md-editor::placeholder {
    color: #c0c4cc;
}

/* ---------- Preview ---------- */
.md-preview {
    flex: 1;
    padding: 16px 20px;
    border: 1px solid #ebeef5;
    border-radius: 0 0 10px 10px;
    background: #fff;
    overflow-y: auto;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.md-preview.empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #c0c4cc;
    font-size: 0.95rem;
}

/* Preview rendered markdown styles */
.md-preview h1 { font-size: 1.8rem; margin: 0.8em 0 0.4em; border-bottom: 1px solid #eee; padding-bottom: 0.3em; }
.md-preview h2 { font-size: 1.5rem; margin: 0.8em 0 0.4em; border-bottom: 1px solid #eee; padding-bottom: 0.3em; }
.md-preview h3 { font-size: 1.25rem; margin: 0.8em 0 0.4em; }
.md-preview h4 { font-size: 1.1rem; margin: 0.6em 0 0.3em; }
.md-preview h5 { font-size: 1rem; margin: 0.6em 0 0.3em; }
.md-preview h6 { font-size: 0.9rem; margin: 0.6em 0 0.3em; color: #666; }

.md-preview p { margin: 0.6em 0; line-height: 1.8; }
.md-preview ul, .md-preview ol { padding-left: 2em; margin: 0.5em 0; }
.md-preview li { margin: 0.25em 0; line-height: 1.7; }
.md-preview blockquote {
    margin: 0.8em 0;
    padding: 0.5em 1em;
    border-left: 4px solid #667eea;
    background: #f8f9ff;
    color: #555;
}
.md-preview code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.85em;
    background: #f0f2ff;
    padding: 2px 6px;
    border-radius: 3px;
    color: #c7254e;
}
.md-preview pre {
    margin: 0.8em 0;
    padding: 12px 16px;
    background: #282c34;
    border-radius: 8px;
    overflow-x: auto;
}
.md-preview pre code {
    background: none;
    color: #abb2bf;
    padding: 0;
    font-size: 0.85rem;
}
.md-preview img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 8px 0;
}
.md-preview table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.8em 0;
}
.md-preview th, .md-preview td {
    border: 1px solid #d0d5dd;
    padding: 8px 12px;
    text-align: left;
    font-size: 0.9rem;
}
.md-preview th {
    background: #f2f2f2;
    font-weight: 600;
}
.md-preview a {
    color: #4a90d9;
    text-decoration: underline;
}
.md-preview hr {
    border: none;
    border-top: 1px solid #e0e0e0;
    margin: 1.5em 0;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
    text-decoration: none;
    line-height: 1.5;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-outline {
    background: #fff;
    color: #667eea;
    border: 1px solid #667eea;
}

.btn-outline:hover {
    background: #f0f2ff;
}

.btn-danger {
    background: #fff;
    color: #f56c6c;
    border: 1px solid #f56c6c;
}

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

.btn-lg {
    padding: 12px 32px;
    font-size: 1rem;
    border-radius: 10px;
}

.btn-xs {
    padding: 4px 10px;
    font-size: 0.78rem;
    border-radius: 5px;
}

/* ---------- Action Section ---------- */
.action-section {
    text-align: center;
    padding: 16px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    position: sticky;
    bottom: 0;
    z-index: 100;
    background: #f5f7fa;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
}

.action-hint {
    font-size: 0.85rem;
    color: #999;
    margin-top: 10px;
    text-align: center;
}

/* ---------- File Upload Area ---------- */
.file-upload-area {
    border: 2px dashed #c0c4cc;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    background: #fff;
    transition: border-color 0.3s, background-color 0.3s;
    cursor: pointer;
    margin-bottom: 16px;
}

.file-upload-area:hover,
.file-upload-area.dragover {
    border-color: #667eea;
    background: #f0f2ff;
}

.file-upload-area .upload-icon {
    color: #909399;
    margin-bottom: 8px;
}

.file-upload-area:hover .upload-icon {
    color: #667eea;
}

.file-upload-area p {
    font-size: 0.9rem;
    color: #909399;
}

.file-upload-area p strong {
    color: #667eea;
}

/* ---------- Loading Overlay ---------- */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e0e0e0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-overlay > p:first-of-type {
    font-size: 1.05rem;
    font-weight: 500;
    color: #555;
}

.loading-sub {
    font-size: 0.85rem;
    color: #999;
    margin-top: 4px;
}

/* ---------- Info Section (SEO) ---------- */
.info-section {
    padding: 40px 0;
}

.info-section:nth-child(even) {
    background: #fff;
    border-top: 1px solid #ebeef5;
    border-bottom: 1px solid #ebeef5;
}

.info-section h2 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: #333;
}

.feature-list {
    list-style: none;
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.feature-list li {
    padding: 12px 16px;
    background: #fafafa;
    border-radius: 8px;
    font-size: 0.93rem;
    line-height: 1.7;
}

.feature-list li strong {
    color: #667eea;
}

.step-list {
    padding-left: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.step-list li {
    font-size: 0.93rem;
    line-height: 1.7;
    padding-left: 4px;
}

.step-list li::marker {
    color: #667eea;
    font-weight: 700;
}

.faq-list dt {
    font-weight: 600;
    font-size: 0.95rem;
    color: #333;
    margin-top: 16px;
    margin-bottom: 4px;
}

.faq-list dt:first-child {
    margin-top: 0;
}

.faq-list dd {
    font-size: 0.9rem;
    color: #666;
    margin-left: 0;
    margin-bottom: 8px;
    line-height: 1.7;
}

/* ---------- Footer ---------- */
.footer {
    background: #333;
    color: #999;
    text-align: center;
    padding: 20px 0;
    font-size: 0.85rem;
}

/* ---------- Word Count ---------- */
.word-count {
    font-size: 0.78rem;
    color: #909399;
    padding: 6px 0;
    text-align: right;
}

/* ---------- Options Panel ---------- */
.options-panel {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #ebeef5;
    border-radius: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.options-panel label {
    font-size: 0.85rem;
    color: #555;
    display: flex;
    align-items: center;
    gap: 6px;
}

.options-panel select,
.options-panel input[type="text"] {
    padding: 5px 10px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #333;
    background: #fff;
    outline: none;
    transition: border-color 0.2s;
}

.options-panel select:focus,
.options-panel input[type="text"]:focus {
    border-color: #667eea;
}

/* ============================================================
   移动端适配
   ============================================================ */
@media (max-width: 768px) {
    .header {
        padding: 28px 0 24px;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .header .subtitle {
        font-size: 0.85rem;
    }

    .editor-layout {
        flex-direction: column;
        min-height: auto;
    }

    .editor-pane,
    .preview-pane {
        width: 100%;
    }

    .md-editor {
        min-height: 260px;
    }

    .md-preview {
        min-height: 200px;
    }

    .btn-lg {
        width: 100%;
        padding: 14px 24px;
        font-size: 1rem;
    }

    .action-section {
        flex-direction: column;
    }

    .options-panel {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .info-section {
        padding: 28px 0;
    }

    .info-section h2 {
        font-size: 1.15rem;
    }

    .feature-list {
        gap: 8px;
    }

    .feature-list li {
        font-size: 0.88rem;
        padding: 10px 12px;
    }
}

@media (max-width: 380px) {
    .pane-header {
        padding: 8px 12px;
    }

    .pane-header h3 {
        font-size: 0.82rem;
    }
}

@media (min-width: 769px) {
    .feature-list {
        grid-template-columns: 1fr 1fr;
    }

    .md-editor {
        min-height: 460px;
    }

    .md-preview {
        min-height: 460px;
    }
}