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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background-color: #fff;
    min-height: 100vh;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

header h1 {
    color: #2c3e50;
    font-size: 2.5rem;
    margin-bottom: 10px;
}

header p {
    color: #7f8c8d;
    font-size: 1.1rem;
}

main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

.input-section, .preview-section {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #e9ecef;
}

.input-header, .preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #dee2e6;
}

.input-header h2, .preview-header h2 {
    color: #495057;
    font-size: 1.5rem;
}

.input-options {
    display: flex;
    gap: 15px;
}

.input-options label {
    cursor: pointer;
    font-size: 0.9rem;
}

.input-options input[type="radio"] {
    margin-right: 5px;
}

.input-method {
    display: none;
}

.input-method.active {
    display: block;
}

#markdown-input {
    width: 100%;
    height: 400px;
    padding: 15px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    background-color: #fff;
}

#markdown-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.file-drop-zone {
    border: 2px dashed #ced4da;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    background-color: #fff;
    transition: all 0.3s ease;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.file-drop-zone:hover,
.file-drop-zone.drag-over {
    border-color: #007bff;
    background-color: #f8f9ff;
}

.file-drop-zone p {
    margin-bottom: 15px;
    color: #6c757d;
}

.file-drop-zone button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.file-drop-zone button:hover {
    background-color: #0056b3;
}

.convert-btn {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

.convert-btn:hover {
    background-color: #218838;
}

.convert-btn:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
}

.preview-content {
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 20px;
    min-height: 400px;
    overflow-y: auto;
    max-height: 600px;
}

.preview-content .placeholder {
    color: #6c757d;
    font-style: italic;
    text-align: center;
    margin-top: 50px;
}

/* Markdown preview styling */
.preview-content h1,
.preview-content h2,
.preview-content h3,
.preview-content h4,
.preview-content h5,
.preview-content h6 {
    margin-top: 20px;
    margin-bottom: 10px;
    color: #2c3e50;
}

.preview-content h1 { font-size: 2rem; }
.preview-content h2 { font-size: 1.75rem; }
.preview-content h3 { font-size: 1.5rem; }
.preview-content h4 { font-size: 1.25rem; }
.preview-content h5 { font-size: 1.1rem; }
.preview-content h6 { font-size: 1rem; }

.preview-content p {
    margin-bottom: 15px;
}

.preview-content ul,
.preview-content ol {
    margin-left: 20px;
    margin-bottom: 15px;
}

.preview-content li {
    margin-bottom: 5px;
}

.preview-content pre {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 15px;
    overflow-x: auto;
}

.preview-content code {
    background-color: #f8f9fa;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
}

.preview-content pre code {
    background-color: transparent;
    padding: 0;
}

.preview-content blockquote {
    border-left: 4px solid #007bff;
    padding-left: 20px;
    margin: 15px 0;
    color: #6c757d;
}

.preview-content table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 15px;
}

.preview-content th,
.preview-content td {
    border: 1px solid #dee2e6;
    padding: 8px 12px;
    text-align: left;
}

.preview-content th {
    background-color: #f8f9fa;
    font-weight: 600;
}

/* Math formula styling */

}

.mathml-code {
    display: block;
    width: 100%;
    overflow-x: auto;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    border-radius: 6px;
    line-height: 1.45;

    white-space: pre-wrap;
}

footer {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
    color: #6c757d;
    font-size: 0.9rem;
}

/* Loading state */
.loading {
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive design */
@media (max-width: 768px) {
    main {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .input-header,
    .preview-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .convert-btn {
        width: 100%;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .container {
        padding: 10px;
    }
}