/* Markdown Editor Styles */
.markdown-editor-wrapper {
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--color-background-subtle);
    margin-bottom: 1rem;
}

.markdown-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--color-background-muted);
    border-bottom: 1px solid var(--color-border);
    flex-wrap: wrap;
}

.toolbar-group {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.toolbar-group:not(:last-child)::after {
    content: '';
    width: 1px;
    height: 20px;
    background: var(--color-border);
    margin-left: 0.5rem;
}

.toolbar-toggle {
    margin-left: auto;
}

.toolbar-btn {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border);
    background: var(--color-background-subtle);
    color: var(--color-text);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.toolbar-btn:hover {
    background: var(--color-background);
    border-color: var(--color-primary);
}

.toolbar-btn:active {
    background: var(--color-background-muted);
}

.markdown-editor-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 500px; /* Taller for better editing experience */
    gap: 2px; /* Small gap between editor and preview */
    max-width: none; /* Allow full width usage */
}

.markdown-editor-container.preview-hidden {
    grid-template-columns: 1fr;
}

.markdown-input-section {
    border-right: 1px solid var(--color-border);
}

.markdown-textarea {
    width: 100%;
    height: 100%;
    min-height: 500px; /* Match container height */
    border: none;
    padding: 1rem;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.5;
    resize: vertical;
    outline: none;
    background: var(--color-background);
    color: var(--color-text);
}

.markdown-preview-section {
    padding: 1rem;
    background: var(--color-background-subtle);
    overflow-y: auto;
}

.markdown-preview-content {
    font-family: var(--font-primary);
    line-height: var(--line-height-relaxed); /* Match content-body line-height */
    color: var(--color-text);
}

.markdown-preview-content h1,
.markdown-preview-content h2,
.markdown-preview-content h3,
.markdown-preview-content h4,
.markdown-preview-content h5,
.markdown-preview-content h6 {
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.markdown-preview-content h1 { font-size: 1.875rem; }
.markdown-preview-content h2 { font-size: 1.5rem; }
.markdown-preview-content h3 { font-size: 1.25rem; }
.markdown-preview-content h4 { font-size: 1.125rem; }
.markdown-preview-content h5 { font-size: 1rem; }
.markdown-preview-content h6 { font-size: 0.875rem; }

.markdown-preview-content p {
    margin-bottom: 1rem;
}

.markdown-preview-content ul,
.markdown-preview-content ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.markdown-preview-content li {
    margin-bottom: 0.25rem;
}

.markdown-preview-content blockquote {
    border-left: 4px solid var(--color-border);
    margin: 1rem 0;
    padding-left: 1rem;
    color: var(--color-text-muted);
    font-style: italic;
}

.markdown-preview-content code {
    background: var(--color-background-muted);
    padding: 0.125rem 0.25rem;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--color-text);
}

.markdown-preview-content pre {
    background: var(--color-background-muted);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 1rem;
    overflow-x: auto;
    margin-bottom: 1rem;
}

.markdown-preview-content pre code {
    background: none;
    padding: 0;
}

.markdown-preview-content a {
    color: var(--color-primary);
    text-decoration: none;
}

.markdown-preview-content a:hover {
    text-decoration: underline;
}

.markdown-preview-content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 0.5rem 0;
}

.markdown-preview-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.markdown-preview-content th,
.markdown-preview-content td {
    border: 1px solid var(--color-border);
    padding: 0.5rem;
    text-align: left;
}

.markdown-preview-content th {
    background: var(--color-background-muted);
    font-weight: 600;
}

/* Attachment Upload Styles */
.attachment-upload-section {
    border-top: 1px solid var(--color-border);
    background: var(--color-background-muted);
}

.attachment-drop-zone {
    padding: 2rem;
    border: 2px dashed var(--color-border);
    margin: 1rem;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--color-background);
}

.attachment-drop-zone:hover {
    border-color: var(--color-primary);
    background: var(--color-background-muted);
}

.attachment-drop-zone.drag-over {
    border-color: var(--color-primary);
    background: var(--color-background-muted);
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.drop-zone-icon {
    font-size: 2rem;
    color: var(--color-text-muted);
}

.drop-zone-text {
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

#attachment-file-input {
    display: none;
}

.attachment-list {
    padding: 0 1rem 1rem;
}

.upload-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: var(--color-background);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    transition: all 0.2s ease;
    color: var(--color-text);
}

.upload-item.uploading {
    border-color: var(--color-warning, #ffc107);
    background: var(--color-background-muted);
}

.upload-item.success {
    border-color: var(--color-success, #28a745);
    background: var(--color-background-muted);
}

.upload-item.error {
    border-color: var(--color-danger, #dc3545);
    background: var(--color-background-muted);
}

.upload-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.upload-filename {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--color-text);
}

.upload-status {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.upload-progress {
    width: 100%;
    height: 4px;
    background: var(--color-background-muted);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.upload-progress-bar {
    height: 100%;
    background: var(--color-primary);
    width: 0%;
    transition: width 0.3s ease;
    animation: progress-indeterminate 1.5s infinite;
}

@keyframes progress-indeterminate {
    0% { width: 0%; margin-left: 0%; }
    50% { width: 50%; margin-left: 25%; }
    100% { width: 0%; margin-left: 100%; }
}

.upload-actions {
    display: flex;
    gap: 0.5rem;
    margin-left: 1rem;
}

.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-small:hover {
    background: #e9ecef;
}

.btn-small.btn-secondary {
    color: #666;
}

.btn-small.btn-secondary:hover {
    background: #f8f9fa;
}

/* Responsive Design */
@media (max-width: 768px) {
    .markdown-editor-container {
        grid-template-columns: 1fr;
    }
    
    .markdown-input-section {
        border-right: none;
        border-bottom: 1px solid #ddd;
    }
    
    .markdown-preview-section {
        border-top: 1px solid #ddd;
    }
    
    .toolbar-group {
        flex-wrap: wrap;
    }
    
    .attachment-drop-zone {
        padding: 1rem;
        margin: 0.5rem;
    }
}

