/* --- markdown-render-enhanced.css --- */

/* Apply to the main container holding the rendered Markdown */
/* Ensure this selector targets your specific rendered markdown container */
.prose-enhanced, /* Add this class to your #markdown-render-area and #markdown-preview-area */
#markdown-render-area, 
#markdown-preview-area {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--tw-prose-body, #cbd5e1); /* Default to Tailwind Prose var or a fallback */
    line-height: 1.7;
    word-wrap: break-word;
}

/* --- Headings --- */
.prose-enhanced h1, .prose-enhanced h2, .prose-enhanced h3, .prose-enhanced h4, .prose-enhanced h5, .prose-enhanced h6 {
    color: var(--tw-prose-headings, #f1f5f9);
    font-weight: 600;
    margin-top: 1.5em;
    margin-bottom: 0.75em;
    line-height: 1.3;
}
.prose-enhanced h1 {
    font-size: 2.25em; /* 36px */
    border-bottom: 2px solid var(--tw-prose-hr, #334155);
    padding-bottom: 0.4em;
}
.prose-enhanced h2 {
    font-size: 1.875em; /* 30px */
    border-bottom: 1px solid var(--tw-prose-hr, #334155);
    padding-bottom: 0.3em;
}
.prose-enhanced h3 {
    font-size: 1.5em; /* 24px */
}
.prose-enhanced h4 {
    font-size: 1.25em; /* 20px */
}
.prose-enhanced h5 {
    font-size: 1.125em; /* 18px */
}
.prose-enhanced h6 {
    font-size: 1em; /* 16px */
    color: var(--tw-prose-captions, #94a3b8);
}

/* --- Paragraphs & Text --- */
.prose-enhanced p {
    margin-top: 0;
    margin-bottom: 1.25em;
}
.prose-enhanced a {
    color: var(--brand-cyan, #06b6d4); /* Use your brand color */
    text-decoration: none;
    font-weight: 500;
}
.prose-enhanced a:hover {
    text-decoration: underline;
    color: var(--brand-indigo, #4f46e5);
}
.prose-enhanced strong {
    color: var(--tw-prose-bold, #e2e8f0);
    font-weight: 600;
}
.prose-enhanced em {
    font-style: italic;
}
.prose-enhanced del { /* Strikethrough */
    text-decoration: line-through;
    color: var(--brand-text-dark, #64748b);
}

/* --- Lists --- */
.prose-enhanced ul, .prose-enhanced ol {
    margin-top: 0;
    margin-bottom: 1.25em;
    padding-left: 1.75em; /* More pronounced indent */
}
.prose-enhanced li {
    margin-bottom: 0.5em;
}
.prose-enhanced ul li::marker {
    color: var(--brand-purple, #7c3aed);
}
.prose-enhanced ol li::marker {
    color: var(--brand-purple, #7c3aed);
    font-weight: 500;
}
.prose-enhanced li > p { /* Paragraphs inside list items */
    margin-bottom: 0.5em;
}
.prose-enhanced li > ul, .prose-enhanced li > ol {
    margin-top: 0.5em;
    margin-bottom: 0.5em;
}

/* --- Task Lists (GFM Style) --- */
.prose-enhanced ul li.task-list-item { /* Class often added by marked.js extensions */
    list-style-type: none;
    padding-left: 0.25em;
}
.prose-enhanced ul li.task-list-item input[type="checkbox"] {
    margin-right: 0.5em;
    vertical-align: middle;
    /* Add custom styling for checkboxes if desired, using Tailwind's form plugin can help here if installed */
    /* For basic styling without form plugin: */
    appearance: none;
    -webkit-appearance: none;
    background-color: var(--brand-bg-light, #334155);
    border: 1px solid var(--brand-text-dark, #64748b);
    border-radius: 0.25em;
    width: 1em;
    height: 1em;
    position: relative;
    top: 0.15em; /* Adjust vertical alignment */
}
.prose-enhanced ul li.task-list-item input[type="checkbox"]:checked {
    background-color: var(--brand-indigo, #4f46e5);
    border-color: var(--brand-indigo, #4f46e5);
}
.prose-enhanced ul li.task-list-item input[type="checkbox"]:checked::after {
    content: '\\2713'; /* Checkmark unicode */
    font-size: 0.8em;
    color: white;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}
.prose-enhanced ul li.task-list-item.checked label, /* Some extensions add 'checked' class to li */
.prose-enhanced ul li.task-list-item input[type="checkbox"]:checked + label { /* If label follows checkbox */
    text-decoration: line-through;
    color: var(--brand-text-dark, #64748b);
}


/* --- Blockquotes --- */
.prose-enhanced blockquote {
    margin-left: 0;
    margin-right: 0;
    padding: 0.75em 1.25em;
    border-left: 4px solid var(--brand-purple, #7c3aed);
    background-color: rgba(124, 58, 237, 0.07); /* Faint purple background */
    color: var(--tw-prose-quotes, #d1d5db);
    font-style: normal;
    border-radius: 0 0.25rem 0.25rem 0;
}
.prose-enhanced blockquote p {
    margin-bottom: 0.5em;
}
.prose-enhanced blockquote p:last-child {
    margin-bottom: 0;
}

/* --- Code Blocks --- */
.prose-enhanced pre {
    background-color: var(--brand-bg-medium, #1e293b); /* Slightly different from atom-one-dark base */
    border: 1px solid var(--brand-bg-light, #334155);
    border-radius: 0.5rem;
    padding: 1em;
    overflow-x: auto;
    font-size: 0.875em; /* Slightly smaller */
    line-height: 1.6;
    margin-bottom: 1.5em;
    position: relative; /* For copy button positioning */
}
.prose-enhanced pre code.hljs { /* From highlight.js */
    padding: 0 !important; /* highlight.js adds padding, remove it for pre */
    background: none !important;
    color: inherit; /* Inherit color from pre, or let hljs theme dictate */
    white-space: pre; /* Ensure pre formatting is maintained */
    font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
/* Style for inline code */
.prose-enhanced code:not(pre code) {
    background-color: rgba(var(--brand-pink-rgb, 236, 72, 153), 0.15); /* Faint pink background */
    color: var(--brand-pink, #ec4899);
    padding: 0.2em 0.4em;
    margin: 0 0.1em;
    font-size: 0.875em;
    border-radius: 0.25rem;
    font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* --- Tables --- */
.prose-enhanced table {
    width: 100%;
    margin-bottom: 1.5em;
    border-collapse: collapse;
    border: 1px solid var(--brand-bg-light, #334155);
    font-size: 0.9em;
}
.prose-enhanced th, .prose-enhanced td {
    border: 1px solid var(--brand-bg-light, #334155);
    padding: 0.6em 0.8em;
    text-align: left;
}
.prose-enhanced th {
    background-color: rgba(51, 65, 85, 0.5); /* brand-bg-light with transparency */
    font-weight: 600;
    color: var(--brand-text-light, #e2e8f0);
}
.prose-enhanced tr:nth-child(even) {
    background-color: rgba(30, 41, 59, 0.3); /* Fainter bg for even rows */
}

/* --- Horizontal Rules --- */
.prose-enhanced hr {
    border: 0;
    height: 2px;
    background-image: linear-gradient(to right, transparent, var(--brand-purple, #7c3aed), transparent);
    margin: 2.5em 0;
}

/* --- Images --- */
.prose-enhanced img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    margin-top: 1em;
    margin-bottom: 1em;
    display: block; /* For centering with margin auto */
    margin-left: auto;
    margin-right: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
/* Figure and Figcaption for image captions (if your Markdown parser supports it or you add it) */
.prose-enhanced figure {
    margin: 1.5em 0;
}
.prose-enhanced figcaption {
    text-align: center;
    font-size: 0.875em;
    color: var(--brand-text-dark, #64748b);
    margin-top: 0.5em;
}

/* --- Admonitions/Alerts (Example - requires JS or Markdown extension to add classes) --- */
/* You'd need your Markdown parser to add classes like .admonition .note */
.prose-enhanced .admonition {
    padding: 1em 1.25em;
    margin-bottom: 1.5em;
    border-left-width: 4px;
    border-radius: 0.25rem;
}
.prose-enhanced .admonition-title {
    font-weight: 600;
    margin-bottom: 0.25em;
}
.prose-enhanced .admonition.note {
    border-left-color: var(--brand-cyan, #06b6d4);
    background-color: rgba(6, 182, 212, 0.07);
}
.prose-enhanced .admonition.note .admonition-title {
    color: var(--brand-cyan, #06b6d4);
}
.prose-enhanced .admonition.warning {
    border-left-color: var(--brand-orange, #f97316);
    background-color: rgba(249, 115, 22, 0.07);
}
.prose-enhanced .admonition.warning .admonition-title {
    color: var(--brand-orange, #f97316);
}
.prose-enhanced .admonition.danger, .prose-enhanced .admonition.error {
    border-left-color: var(--brand-pink, #ec4899); /* Or a red color */
    background-color: rgba(236, 72, 153, 0.07);
}
.prose-enhanced .admonition.danger .admonition-title,
.prose-enhanced .admonition.error .admonition-title {
    color: var(--brand-pink, #ec4899);
}

/* --- Print Styles --- */
@media print {
    body, .prose-enhanced, #markdown-render-area, #markdown-preview-area {
        background-color: #ffffff !important;
        color: #000000 !important;
        font-size: 12pt;
    }
    .prose-enhanced a {
        color: #0000ff !important;
        text-decoration: underline !important;
    }
    .prose-enhanced pre, .prose-enhanced code:not(pre code) {
        background-color: #f0f0f0 !important;
        color: #333333 !important;
        border: 1px solid #cccccc !important;
        page-break-inside: avoid;
    }
    .prose-enhanced img {
        max-width: 80% !important; /* Ensure images fit well on page */
        page-break-inside: avoid;
    }
    .prose-enhanced blockquote {
        border-left-color: #cccccc !important;
        background-color: #f9f9f9 !important;
        color: #333333 !important;
    }
    .prose-enhanced table, .prose-enhanced th, .prose-enhanced td {
        border-color: #cccccc !important;
    }
    .prose-enhanced th {
        background-color: #e9e9e9 !important;
    }
    /* Hide non-content elements for print */
    #main-navbar, #share-modal-overlay, #share-modal, #go-to-top-button, .header-button, #markdown-view-tabs-container, footer {
        display: none !important;
    }
    #paste-view-container, #password-prompt-area, #message-area {
        box-shadow: none !important;
        border: none !important;
    }
}

.copy-code-btn-md {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.375rem;
    background-color: #4a5568;
    color: #e2e8f0;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    opacity: 0.7;
    transition: opacity 0.2s;
}
pre:hover .copy-code-btn-md {
    opacity: 1;
}
.copy-code-btn-md:hover {
    background-color: #2d3748;
}