:root {
    --bg-color: #fff5f8;
    --primary-pink: #ff85a2;
    --secondary-pink: #ffb7c5;
    --lavender: #e0c3fc;
    --soft-white: #ffffff;
    --text-dark: #5c4b51;
    --accent-sparkle: #ffd166;
    --pane-shadow: 0 10px 30px rgba(255, 133, 162, 0.15);
    --header-height: 80px;
}

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

body {
    font-family: 'Quicksand', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-dark);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    background-image:
        radial-gradient(circle at 10% 10%, rgba(255, 183, 197, 0.3) 0%, transparent 30%),
        radial-gradient(circle at 90% 90%, rgba(224, 195, 252, 0.3) 0%, transparent 30%);
    position: relative;
}

/* Sparkle Background effect */
body::before {
    content: "✨";
    position: absolute;
    top: 50px;
    left: 10%;
    font-size: 24px;
    opacity: 0.5;
}

body::after {
    content: "🎀";
    position: absolute;
    bottom: 50px;
    right: 10%;
    font-size: 24px;
    opacity: 0.5;
}

.main-container {
    width: 96vw;
    height: 92vh;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    border: 3px solid var(--soft-white);
    border-radius: 40px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.05);
    animation: bounceIn 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes bounceIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

header {
    height: var(--header-height);
    padding: 0 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px dashed var(--secondary-pink);
}

.logo {
    font-family: 'Comfortaa', cursive;
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-pink);
}

.logo span {
    color: var(--lavender);
}

.btn-magic {
    background: linear-gradient(135deg, var(--primary-pink) 0%, var(--lavender) 100%);
    border: none;
    color: white;
    padding: 12px 28px;
    border-radius: 25px;
    font-family: 'Comfortaa', cursive;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(255, 133, 162, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-magic:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 20px rgba(255, 133, 162, 0.6);
}

.btn-magic:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.editor-container {
    flex: 1;
    display: flex;
    overflow: hidden;
    padding: 25px;
    gap: 25px;
}

.pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 30px;
    box-shadow: var(--pane-shadow);
    border: 2px solid var(--secondary-pink);
    overflow: hidden;
    transition: transform 0.3s ease;
}

.pane:focus-within {
    transform: translateY(-5px);
    border-color: var(--primary-pink);
}

.pane-header {
    padding: 15px 25px;
    background: var(--bg-color);
    border-bottom: 1px solid var(--secondary-pink);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    color: var(--primary-pink);
}

.title-area {
    padding: 15px 20px 0 20px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.title-area label {
    font-size: 12px;
    color: var(--primary-pink);
    font-weight: 700;
    margin-left: 10px;
}

#pdfTitle {
    border: 2px solid var(--bg-color);
    background: var(--bg-color);
    border-radius: 15px;
    padding: 10px 15px;
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
    font-size: 16px;
    color: var(--text-dark);
    outline: none;
    transition: all 0.2s ease;
}

#pdfTitle:focus {
    background: white;
    border-color: var(--secondary-pink);
}

#markdownInput {
    flex: 1;
    border: none;
    resize: none;
    padding: 20px;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 15px;
    line-height: 1.6;
    outline: none;
    background: transparent;
    color: var(--text-dark);
}

#previewContent {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
    background: white;
}

/* Markdown Styling Improvements */
.markdown-body {
    line-height: 1.8; /* Significant interlineado */
    font-size: 16px;
    color: var(--text-dark);
}

.markdown-body h1 {
    color: var(--primary-pink);
    border-bottom: 2px solid var(--lavender);
    padding-bottom: 10px;
    margin-top: 20px;
    margin-bottom: 30px; /* More space after title */
    font-size: 2.2em;
}

.markdown-body h2 {
    color: var(--primary-pink);
    border-bottom: 1.5px solid var(--lavender);
    padding-bottom: 5px;
    margin-top: 35px;
    margin-bottom: 20px;
    font-size: 1.8em;
}

.markdown-body h3 {
    color: var(--text-dark);
    margin-top: 25px;
    margin-bottom: 15px;
    font-size: 1.4em;
}

.markdown-body p {
    margin-bottom: 25px; /* Significant spacing between paragraphs */
}

.markdown-body blockquote {
    border-left: 6px solid var(--lavender);
    background: var(--bg-color);
    padding: 20px 25px;
    margin: 25px 0;
    border-radius: 0 20px 20px 0;
    font-style: italic;
    color: #7d6b72;
}

.markdown-body ul,
.markdown-body ol {
    padding-left: 30px;
    margin-bottom: 25px;
}

.markdown-body li {
    margin-bottom: 12px; /* Spacing between list items */
}

.markdown-body code {
    background: var(--bg-color);
    padding: 3px 8px;
    border-radius: 6px;
    font-family: monospace;
    font-size: 0.9em;
    color: var(--primary-pink);
}

.markdown-body pre {
    background: #2d2b30;
    color: #f8f8f2;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 25px;
    overflow-x: auto;
}

.markdown-body pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

footer {
    padding: 15px;
    text-align: center;
    font-size: 14px;
    color: var(--primary-pink);
    font-weight: 500;
}

@media (max-width: 850px) {
    .editor-container {
        flex-direction: column;
    }
    .main-container {
        height: auto;
        min-height: 95vh;
        overflow-y: auto;
    }
    body {
        overflow-y: auto;
    }
}

/* PDF Specific Styles (for html2pdf process) */
.pdf-export-body {
    padding: 60px !important; /* Proper margins for the PDF */
    background: white !important;
}