/* Main content */
.main-content {
    flex: 1;
    overflow: hidden;
}

.editor-container {
    display: flex;
    height: 100%;
}

.pane {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.editor-pane {
    flex: 1;
    border-right: 1px solid var(--border-color);
    position: relative;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.preview-pane {
    flex: 1;
    transition: all 0.3s ease;
}

.pane-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 0.875rem;
}

.pane-title {
    color: var(--text-primary);
    margin-right: 1.5rem;
    flex-shrink: 0;
}

.editor-info {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: normal;
}

.editor-info span {
    white-space: nowrap;
}

/* Pane divider */
.pane-divider {
    width: 4px;
    background-color: var(--border-color);
    cursor: col-resize;
    position: relative;
}

.pane-divider:hover {
    background-color: var(--accent-color);
}

.pane-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 30px;
    background-color: var(--text-muted);
    border-radius: 1px;
}

/* Editor textarea */
#editor {
    flex: 1 1 auto;
    padding: 1rem;
    border: none;
    outline: none;
    resize: none;
    font-family: var(--font-family-mono);
    font-size: 16px;
    line-height: 1.6;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    tab-size: 4;
    font-weight: 400;
    box-sizing: border-box;
    /* Simple, clean styling */
    white-space: pre-wrap;
    word-wrap: break-word;
    transition: all 0.3s ease;
}

#editor::placeholder {
    color: var(--text-muted);
    font-size: 16px;
    opacity: 0.8;
    position: relative;
    z-index: 10;
    line-height: 1.6;
    font-weight: 400;
    white-space: pre-wrap;
}



/* Syntax Highlighting Styles */
.syntax-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    overflow: hidden;
}

.syntax-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 1rem;
    margin: 0;
    border: none;
    font-family: var(--font-family-mono);
    font-size: 16px;
    line-height: 1.6;
    font-weight: 400;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    overflow: auto;
    pointer-events: none;
    z-index: 1;
    color: var(--text-primary);
    box-sizing: border-box;
    /* Ensure exact alignment with textarea */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    /* Critical: Match textarea exactly */
    letter-spacing: normal;
    word-spacing: normal;
    text-indent: 0;
    text-align: left;
    text-transform: none;
    text-decoration: none;
    /* Prevent any text rendering differences */
    -webkit-text-size-adjust: 100%;
    -webkit-font-feature-settings: normal;
    font-feature-settings: normal;
    font-variant: normal;
    font-stretch: normal;
}

.syntax-backdrop::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

/* Syntax highlighting colors */
.hl-header { 
    color: var(--accent-color); 
    font-weight: 700; 
}

.hl-bold { 
    color: var(--text-primary); 
    font-weight: 700; 
}

.hl-italic { 
    color: var(--text-primary); 
    font-style: italic; 
}

.hl-code { 
    color: var(--danger-color); 
    background: var(--bg-tertiary); 
    padding: 0.125rem 0.25rem; 
    border-radius: 3px; 
    font-weight: 500; 
}

.hl-code-block { 
    color: var(--danger-color); 
    background: var(--bg-tertiary); 
    display: block; 
    padding: 0.5rem; 
    margin: 0.25rem 0; 
    border-radius: 3px; 
    border-left: 3px solid var(--danger-color); 
    font-weight: 500; 
}

.hl-link { 
    color: var(--accent-color); 
    text-decoration: underline; 
    font-weight: 500; 
}

.hl-image { 
    color: var(--warning-color); 
    font-weight: 700; 
    background: rgba(253, 126, 20, 0.1); 
    padding: 0.125rem 0.25rem; 
    border-radius: 3px; 
}

.hl-image-placeholder { 
    color: var(--success-color); 
    font-weight: 700; 
    background: rgba(25, 135, 84, 0.2); 
    padding: 0.125rem 0.25rem; 
    border-radius: 3px; 
}

.hl-list { 
    color: var(--accent-color); 
    font-weight: 700; 
}

.hl-quote { 
    color: var(--text-secondary); 
    font-style: italic; 
    font-weight: 500; 
}

.hl-quote-marker { 
    color: var(--accent-color); 
    font-weight: 700; 
}

.hl-strikethrough { 
    color: var(--text-secondary); 
    text-decoration: line-through; 
    font-weight: 500; 
}

.hl-hr { 
    color: var(--text-muted); 
    font-weight: 600; 
}

/* Image collapse toggle button */
.image-collapse-toggle {
    margin-left: auto;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

/* Syntax highlighting overlay */
.syntax-highlight-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 1rem;
    font-family: var(--font-family-mono);
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow: hidden;
    pointer-events: none;
    z-index: 10;
    background: transparent;
}

.syntax-line {
    min-height: 1.5em;
    position: relative;
}

/* Editor with syntax highlighting */
.editor-pane.has-syntax-highlight {
    position: relative;
}

.editor-pane.has-syntax-highlight #editor {
    background: transparent;
    color: transparent;
    position: relative;
    z-index: 1;
    caret-color: var(--text-primary);
}

/* Show selection and improve cursor visibility */
.editor-pane.has-syntax-highlight #editor::selection {
    background: var(--accent-color);
    color: white;
}

.editor-pane.has-syntax-highlight #editor::-moz-selection {
    background: var(--accent-color);
    color: white;
}

/* Ensure proper cursor and selection visibility */
.syntax-wrapper #editor {
    caret-color: var(--text-primary) !important;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 0 var(--text-primary);
}

.syntax-wrapper #editor:focus {
    outline: none;
    caret-color: var(--accent-color) !important;
}

/* Syntax highlighting styles */

/* Headers */
.md-header-marker {
    color: var(--accent-color);
    font-weight: 700;
    opacity: 0.8;
}

.md-header-text {
    color: var(--accent-color);
    font-weight: 600;
}

/* Bold and Italic */
.md-bold-marker {
    color: var(--text-muted);
    font-weight: normal;
}

.md-bold-text {
    color: var(--text-primary);
    font-weight: 700;
}

.md-italic-marker {
    color: var(--text-muted);
    font-weight: normal;
}

.md-italic-text {
    color: var(--text-primary);
    font-style: italic;
}

/* Inline Code */
.md-code-marker {
    color: var(--danger-color);
    background-color: var(--bg-tertiary);
    font-weight: 600;
}

.md-code-text {
    color: var(--danger-color);
    background-color: var(--bg-tertiary);
    font-family: var(--font-family-mono);
    font-weight: 500;
}

/* Code Blocks */
.code-block-delimiter .md-code-block-start,
.code-block-delimiter .md-code-block-end {
    color: var(--danger-color);
    background-color: var(--bg-tertiary);
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius-sm);
}

.code-block-delimiter .md-code-block-lang {
    color: var(--warning-color);
    background-color: var(--bg-tertiary);
    font-weight: 600;
    margin-left: 0.25rem;
}

.code-block-content {
    background-color: var(--bg-tertiary);
    padding-left: 0.5rem;
    border-left: 3px solid var(--danger-color);
}

.md-code-block-content {
    color: var(--text-primary);
    font-family: var(--font-family-mono);
    font-size: 0.9em;
}

/* Links */
.md-link-marker {
    color: var(--accent-color);
    opacity: 0.7;
}

.md-link-text {
    color: var(--accent-color);
    font-weight: 500;
}

.md-link-url {
    color: var(--text-muted);
    text-decoration: underline;
    opacity: 0.8;
}

/* Regular Images */
.md-image-marker {
    color: var(--warning-color);
    opacity: 0.8;
}

.md-image-alt {
    color: var(--warning-color);
    font-weight: 500;
}

.md-image-url {
    color: var(--text-muted);
    opacity: 0.6;
}

/* Image Placeholders - GREEN */
.md-image-placeholder {
    color: var(--success-color);
    font-weight: 600;
}

.md-image-placeholder + .md-image-alt {
    color: var(--success-color);
    font-weight: 500;
}

.md-image-id {
    color: var(--success-color);
    font-weight: 700;
    background-color: rgba(25, 135, 84, 0.15);
    padding: 0.125rem 0.375rem;
    border-radius: var(--border-radius-sm);
    border: 1px solid rgba(25, 135, 84, 0.3);
}

/* Lists */
.md-list-marker {
    color: var(--accent-color);
    font-weight: 700;
}

.md-list-text {
    color: var(--text-primary);
}

/* Blockquotes */
.md-quote-marker {
    color: var(--accent-color);
    font-weight: 700;
    opacity: 0.8;
}

.md-quote-text {
    color: var(--text-secondary);
    font-style: italic;
    opacity: 0.9;
}

/* Strikethrough */
.md-strikethrough-marker {
    color: var(--text-muted);
    opacity: 0.7;
}

.md-strikethrough-text {
    color: var(--text-secondary);
    text-decoration: line-through;
    opacity: 0.8;
}

/* Horizontal Rules */
.md-hr {
    color: var(--text-muted);
    opacity: 0.6;
    font-weight: 300;
}

/* Loading state for image processing */
.editor-pane.processing-image {
    position: relative;
}

.editor-pane.processing-image::before {
    content: '📷 Processing image...';
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: var(--accent-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 500;
    z-index: 100;
    animation: processingPulse 1.5s ease-in-out infinite;
}

@keyframes processingPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Image collapse highlighting - DISABLED (no longer using overlay backgrounds) */
.image-highlight-overlay {
    display: none; /* Hide completely - not needed without background highlights */
}

/* Overlay no longer used - classes removed since they're not visible */
