/* Apply base styles from github-markdown-css via body class */
body.markdown-body {
    box-sizing: border-box;
    min-width: 200px;
    max-width: 980px; /* Match GitHub's max width for preview consistency */
    margin: 0 auto;
    padding: 45px; /* Default padding from github-markdown-css */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
    line-height: 1.6;
    background-color: #f6f8fa; /* Light background */
}

/* Override body padding for full width container */
body {
    padding: 0;
    max-width: 100%; /* Allow container to manage width */
}


.container {
    max-width: 1200px; /* Allow wider container for side-by-side */
    margin: 20px auto;
    padding: 25px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

h1 {
    text-align: center;
    color: #24292e; /* GitHub-like heading color */
    margin-bottom: 10px;
    border-bottom: 1px solid #eaecef;
    padding-bottom: 0.3em;
}

h1 i {
    margin-right: 10px;
    color: #0366d6; /* GitHub blue */
}

p {
    text-align: center;
    color: #586069; /* GitHub secondary text color */
    margin-bottom: 30px;
}

.editor-preview-container {
    display: flex;
    gap: 20px; /* Space between editor and preview */
    min-height: 60vh; /* Ensure decent height */
    margin-bottom: 25px;
}

.editor-pane,
.preview-pane {
    flex: 1; /* Each takes half the space */
    display: flex;
    flex-direction: column;
}

label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #24292e;
    padding-bottom: 5px;
    border-bottom: 1px solid #eaecef;
}

textarea#markdown-input {
    flex-grow: 1; /* Take remaining vertical space */
    width: 100%;
    padding: 15px;
    border: 1px solid #d1d5da; /* GitHub border color */
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 1rem;
    font-family: monospace; /* Monospace for code */
    resize: none; /* Disable manual resize, rely on flex */
    background-color: #f6f8fa; /* Light background for editor */
    line-height: 1.5;
}

textarea#markdown-input:focus {
    border-color: #0366d6;
    outline: none;
    box-shadow: 0 0 0 3px rgba(3, 102, 214, 0.3);
}

.preview-box {
    flex-grow: 1; /* Take remaining vertical space */
    border: 1px solid #d1d5da;
    border-radius: 6px;
    padding: 15px;
    overflow-y: auto; /* Scroll if content overflows */
    background-color: #fff; /* White background for preview */
    /* Apply markdown-body styles specifically here if not on body */
    /* box-sizing: border-box; */ /* Already inherited */
}

/* Ensure preview content uses markdown styles */
.preview-box > *:first-child {
    margin-top: 0 !important;
}
.preview-box > *:last-child {
    margin-bottom: 0 !important;
}


.back-link {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eaecef;
}

.back-link a {
    color: #0366d6;
    text-decoration: none;
    font-weight: 500;
}

.back-link a:hover {
    text-decoration: underline;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    body.markdown-body {
        padding: 15px; /* Adjust padding for smaller screens */
    }
    .editor-preview-container {
        flex-direction: column; /* Stack panes vertically */
        min-height: auto;
    }
    textarea#markdown-input,
    .preview-box {
        min-height: 300px; /* Set min-height when stacked */
    }
    .container {
        padding: 15px;
    }
}