/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family:
        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #faf8f5;
    color: #2d2d2d;
    min-height: 100vh;
    padding: 20px;
}

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

/* ===== HEADER ===== */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0 20px;
    border-bottom: 2px solid #e8e5e0;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #2d2d2d;
    letter-spacing: -0.5px;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.header-actions button {
    padding: 8px 18px;
    background: transparent;
    border: 1.5px solid #d0ccc6;
    border-radius: 8px;
    color: #2d2d2d;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: 0.3s;
}

.header-actions button:hover {
    background: #2d2d2d;
    color: #faf8f5;
    border-color: #2d2d2d;
}

/* ===== EDITOR LAYOUT (Split Screen) ===== */
.editor-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    height: calc(100vh - 140px);
    min-height: 500px;
}

.editor-panel,
.preview-panel {
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #e8e5e0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.panel-label {
    padding: 12px 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #8a8580;
    background: #faf8f5;
    border-bottom: 1px solid #e8e5e0;
    flex-shrink: 0;
}

/* ===== EDITOR PANEL ===== */
#markdown-input {
    flex: 1;
    padding: 20px;
    border: none;
    font-family: "SF Mono", "Consolas", monospace;
    font-size: 0.95rem;
    line-height: 1.7;
    color: #2d2d2d;
    background: transparent;
    resize: none;
    outline: none;
}

#markdown-input::placeholder {
    color: #b5b0aa;
}

.editor-stats {
    padding: 10px 20px;
    font-size: 0.8rem;
    color: #8a8580;
    border-top: 1px solid #e8e5e0;
    background: #faf8f5;
    display: flex;
    gap: 20px;
    flex-shrink: 0;
}

/* ===== PREVIEW PANEL ===== */
.preview-content {
    flex: 1;
    padding: 20px 24px;
    overflow-y: auto;
    font-family: "Georgia", "Times New Roman", serif;
    font-size: 1.05rem;
    line-height: 1.8;
    color: #2d2d2d;
}

/* ===== MARKDOWN STYLES (Preview) ===== */
.preview-content h1 {
    font-size: 2.2rem;
    font-weight: 700;
    margin: 0.5em 0 0.3em;
    letter-spacing: -0.5px;
    color: #1a1a1a;
}

.preview-content h2 {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0.5em 0 0.3em;
    color: #1a1a1a;
}

.preview-content h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0.4em 0 0.2em;
    color: #1a1a1a;
}

.preview-content p {
    margin: 0.6em 0;
}

.preview-content strong {
    font-weight: 700;
    color: #1a1a1a;
}

.preview-content em {
    font-style: italic;
}

.preview-content ul,
.preview-content ol {
    padding-left: 1.5em;
    margin: 0.6em 0;
}

.preview-content li {
    margin: 0.2em 0;
}

.preview-content a {
    color: #e67e22;
    text-decoration: none;
    border-bottom: 1px solid #e67e2240;
}

.preview-content a:hover {
    border-bottom-color: #e67e22;
}

.preview-content code {
    font-family: "SF Mono", "Consolas", monospace;
    font-size: 0.9em;
    background: #f0ede8;
    padding: 0.1em 0.4em;
    border-radius: 4px;
    color: #2d2d2d;
}

.preview-content pre {
    background: #f0ede8;
    padding: 16px 20px;
    border-radius: 12px;
    overflow-x: auto;
    margin: 0.8em 0;
    border-left: 4px solid #e67e22;
}

.preview-content pre code {
    background: transparent;
    padding: 0;
    font-size: 0.9rem;
    color: #2d2d2d;
}

.preview-content blockquote {
    border-left: 4px solid #e67e22;
    padding: 0.1em 0 0.1em 1.2em;
    margin: 0.8em 0;
    color: #5a5550;
    background: #faf8f5;
    padding: 0.6em 1.2em;
    border-radius: 0 8px 8px 0;
}

.preview-content img {
    max-width: 100%;
    border-radius: 12px;
    margin: 0.6em 0;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.preview-content hr {
    border: none;
    border-top: 2px solid #e8e5e0;
    margin: 1.2em 0;
}

.preview-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.8em 0;
}

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

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

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .editor-layout {
        grid-template-columns: 1fr;
        height: auto;
        gap: 16px;
    }

    .editor-panel,
    .preview-panel {
        height: 400px;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
    }

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

@media (max-width: 480px) {
    body {
        padding: 12px;
    }

    .editor-panel,
    .preview-panel {
        height: 320px;
    }

    .header-actions {
        width: 100%;
    }

    .header-actions button {
        flex: 1;
        text-align: center;
    }
}
