/* WP Markdown Content - Frontend Styles */

/* Base markdown content styling */
.markdown-content-wrapper {
    width: 100%;
}

.markdown-content {
    line-height: 1.6;
    color: #333;
    background: transparent;
}

.markdown-content-title {
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

/* Paragraph styling */
.markdown-paragraph {
    margin-bottom: 16px;
    text-align: justify;
}

/* Header styling */
.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    margin-top: 24px;
    margin-bottom: 16px;
    font-weight: 600;
    line-height: 1.25;
}

.markdown-content h1 {
    font-size: 2em;
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 8px;
}

.markdown-content h2 {
    font-size: 1.5em;
    color: #34495e;
    border-bottom: 1px solid #bdc3c7;
    padding-bottom: 6px;
}

.markdown-content h3 {
    font-size: 1.25em;
    color: #2c3e50;
}

.markdown-content h4 {
    font-size: 1em;
    color: #34495e;
}

.markdown-content h5 {
    font-size: 0.875em;
    color: #7f8c8d;
}

.markdown-content h6 {
    font-size: 0.85em;
    color: #95a5a6;
}

/* Text formatting */
.markdown-content strong {
    font-weight: 600;
    color: #2c3e50;
}

.markdown-content em {
    font-style: italic;
    color: #34495e;
}

/* Links */
.markdown-content a {
    color: #3498db;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.3s ease;
}

.markdown-content a:hover {
    color: #2980b9;
    border-bottom-color: #2980b9;
}

/* Code styling */
.markdown-inline-code {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 2px 6px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
    color: #e74c3c;
}

.markdown-code-block {
    border-radius: 0;
    padding: 16px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
    line-height: 1.4;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-all;
    margin: 16px 0;
    position: relative;
    background: transparent !important;
    border: none !important;
    max-width: 100%;
}

.markdown-code {
    background: transparent !important;
    color: #333 !important; /* Dark text for light background */
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    font-family: inherit !important;
    font-size: inherit !important;
}

/* Remove custom language styling since highlight.js handles it */
.language-javascript,
.language-js,
.language-php,
.language-css,
.language-html,
.language-python,
.language-sql {
    background: inherit !important;
    color: inherit !important;
}

/* Tables */
.markdown-table {
    border-collapse: collapse;
    width: 100%;
    margin: 16px 0;
    background: transparent;
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
}

.markdown-table th,
.markdown-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.markdown-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 2px solid #dee2e6;
}

.markdown-table tr:nth-child(even) {
    background: #f8f9fa;
}

.markdown-table tr:hover {
    background: #e9ecef;
}

.markdown-table tr:last-child td {
    border-bottom: none;
}

/* Lists */
.markdown-list {
    margin: 16px 0;
    padding-left: 30px;
}

.markdown-list li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.markdown-list ul,
.markdown-list ol {
    margin-top: 8px;
    margin-bottom: 8px;
    list-style: none;
}

/* Blockquotes */
.markdown-blockquote {
    margin: 16px 0;
    padding: 16px 20px;
    background: transparent;
    border-left: 4px solid #3498db;
    font-style: italic;
    color: #555;
}

/* Horizontal rules */
.markdown-hr {
    margin: 24px 0;
    border: none;
    height: 2px;
    background: linear-gradient(to right, #3498db, #2980b9);
    border-radius: 1px;
}

/* Images */
.markdown-image {
    max-width: 100%;
    height: auto;
    border-radius: 0;
    box-shadow: none;
    margin: 16px 0;
}

/* Table of Contents */
.markdown-toc {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    margin: 20px 0;
}

.markdown-toc-title {
    margin-top: 0;
    margin-bottom: 16px;
    color: #2c3e50;
    font-size: 1.2em;
    font-weight: 600;
}

.markdown-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.markdown-toc-list li {
    margin: 8px 0;
}

.markdown-toc-list a {
    color: #34495e;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.markdown-toc-list a:hover {
    background: #3498db;
    color: #fff;
}

.markdown-toc-list a.active {
    background: #3498db;
    color: #fff;
}

.markdown-toc-level-1 { margin-left: 0; font-weight: 600; }
.markdown-toc-level-2 { margin-left: 20px; }
.markdown-toc-level-3 { margin-left: 40px; }
.markdown-toc-level-4 { margin-left: 60px; }
.markdown-toc-level-5 { margin-left: 80px; }
.markdown-toc-level-6 { margin-left: 100px; }

/* Copy button for code blocks */
.markdown-copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #3498db;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.markdown-copy-btn:hover {
    background: #2980b9;
}

.markdown-copy-btn.copied {
    background: #27ae60;
}

pre:hover .markdown-copy-btn {
    opacity: 1;
}

/* Anchor links for headers */
.markdown-anchor-link {
    opacity: 0;
    margin-left: 8px;
    color: #bdc3c7 !important;
    text-decoration: none !important;
    border: none !important;
    font-weight: normal;
}

.markdown-content h1:hover .markdown-anchor-link,
.markdown-content h2:hover .markdown-anchor-link,
.markdown-content h3:hover .markdown-anchor-link,
.markdown-content h4:hover .markdown-anchor-link,
.markdown-content h5:hover .markdown-anchor-link,
.markdown-content h6:hover .markdown-anchor-link {
    opacity: 1;
}

/* Image modal */
.markdown-image-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.9);
}

.markdown-image-modal-content {
    position: relative;
    margin: auto;
    padding: 20px;
    width: 90%;
    max-width: 1200px;
    text-align: center;
    top: 50%;
    transform: translateY(-50%);
}

.markdown-image-modal-content img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.markdown-image-modal-close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
}

.markdown-image-modal-close:hover {
    color: #bbb;
}

.markdown-image-modal-caption {
    color: #f1f1f1;
    margin-top: 15px;
    font-size: 16px;
}

/* Clickable images cursor */
.markdown-image {
    cursor: pointer;
    transition: transform 0.3s ease;
}

.markdown-image:hover {
    transform: scale(1.02);
}

/* Error messages */
.markdown-error {
    background: #fee;
    border: 1px solid #fcc;
    color: #c33;
    padding: 12px;
    border-radius: 4px;
    margin: 16px 0;
}

/* Style variations */

/* GitHub style */
.markdown-style-github {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    background: transparent;
    border: none;
    border-radius: 0;
}

.markdown-style-github .markdown-content {
    color: #24292f;
}

.markdown-style-github h1,
.markdown-style-github h2 {
    border-bottom: 1px solid #d0d7de;
}

.markdown-style-github .markdown-code-block {
    background: transparent;
    color: #24292f;
    border: none;
}

.markdown-style-github .markdown-inline-code {
    background: transparent;
    color: #24292f;
    border: none;
}

/* Minimal style */
.markdown-style-minimal {
    font-family: "Times New Roman", Times, serif;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
}

.markdown-style-minimal .markdown-content {
    color: #000;
    max-width: 100%;
    margin: 0;
}

.markdown-style-minimal h1,
.markdown-style-minimal h2,
.markdown-style-minimal h3,
.markdown-style-minimal h4,
.markdown-style-minimal h5,
.markdown-style-minimal h6 {
    color: #000;
    border: none;
}

.markdown-style-minimal .markdown-code-block {
    background: transparent;
    color: #000;
    border: none;
}

/* Responsive design */
@media (max-width: 768px) {
    .markdown-content-wrapper {
        width: 100%;
    }
    
    .markdown-content h1 {
        font-size: 1.5em;
    }
    
    .markdown-content h2 {
        font-size: 1.25em;
    }
    
    .markdown-toc {
        padding: 15px;
    }
    
    .markdown-code-block {
        font-size: 0.8em;
        padding: 12px;
        white-space: pre-wrap;
        word-wrap: break-word;
        overflow-x: auto;
    }
    
    .markdown-copy-btn {
        font-size: 11px;
        padding: 4px 8px;
    }
    
    .markdown-toc-level-2 { margin-left: 15px; }
    .markdown-toc-level-3 { margin-left: 30px; }
    .markdown-toc-level-4 { margin-left: 45px; }
    .markdown-toc-level-5 { margin-left: 60px; }
    .markdown-toc-level-6 { margin-left: 75px; }
}

/* Force transparent theme for all code blocks - override highlight.js themes */
.markdown-content pre,
.markdown-content pre[class*="language-"],
.hljs {
    background: transparent !important;
    color: #333 !important;
    border: none !important;
}

/* Override specific highlight.js classes */
.hljs-comment,
.hljs-quote {
    color: #6a737d !important;
}

.hljs-keyword,
.hljs-selector-tag,
.hljs-addition {
    color: #d73a49 !important;
}

.hljs-number,
.hljs-string,
.hljs-meta .hljs-meta-string,
.hljs-literal,
.hljs-doctag,
.hljs-regexp {
    color: #032f62 !important;
}

.hljs-title,
.hljs-section,
.hljs-name,
.hljs-selector-id,
.hljs-selector-class {
    color: #6f42c1 !important;
}

.hljs-attribute,
.hljs-attr,
.hljs-variable,
.hljs-template-variable,
.hljs-class .hljs-title,
.hljs-type {
    color: #e36209 !important;
}

.hljs-symbol,
.hljs-bullet,
.hljs-subst,
.hljs-meta,
.hljs-meta .hljs-keyword,
.hljs-selector-attr,
.hljs-selector-pseudo,
.hljs-link {
    color: #005cc5 !important;
}

.hljs-built_in,
.hljs-deletion {
    color: #22863a !important;
}

.hljs-formula {
    background: #eee8d5 !important;
}

.hljs-emphasis {
    font-style: italic !important;
}

.hljs-strong {
    font-weight: bold !important;
}

/* Responsive code blocks for mobile */
@media (max-width: 768px) {
    .markdown-code-block {
        font-size: 0.8em;
        padding: 12px;
        white-space: pre-wrap;
        word-wrap: break-word;
        overflow-x: auto;
    }
    
    .markdown-content-wrapper {
        width: 100%;
    }
    
    .markdown-copy-btn {
        font-size: 11px;
        padding: 4px 8px;
    }
}

/* Ensure proper container width */
.markdown-content-container {
    max-width: 100%;
    overflow: hidden;
}

.markdown-content {
    max-width: 100%;
    overflow-wrap: break-word;
}

/* Ensure all markdown content takes full width regardless of style */
.markdown-content-wrapper,
.markdown-style-github .markdown-content-wrapper,
.markdown-style-minimal .markdown-content-wrapper,
.markdown-content-wrapper .markdown-content,
.markdown-style-github .markdown-content,
.markdown-style-minimal .markdown-content {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}
