/* Custom File Input Styles */
.custom-file-input-wrapper {
    position: relative;
}

.custom-file-input-wrapper input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-input-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.375rem 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    background-color: #fff;
    min-height: 38px;
}

.file-input-text {
    color: #6c757d;
    font-size: 0.875rem;
}

.file-input-display:hover {
    border-color: #86b7fe;
}

.file-input-display:focus-within {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Markdown Content Styles */
.markdown-content {
    line-height: 1.6;
    color: #333;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 600;
    line-height: 1.25;
    color: #2c3e50;
}

.markdown-content h1 {
    font-size: 2.25rem;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 0.5rem;
}

.markdown-content h2 {
    font-size: 1.875rem;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 0.3rem;
}

.markdown-content h3 {
    font-size: 1.5rem;
}

.markdown-content h4 {
    font-size: 1.25rem;
}

.markdown-content h5 {
    font-size: 1.125rem;
}

.markdown-content h6 {
    font-size: 1rem;
    color: #6c757d;
}

.markdown-content p {
    margin-bottom: 1rem;
}

.markdown-content a {
    color: #007bff;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
}

.markdown-content a:hover {
    color: #0056b3;
    border-bottom-color: #0056b3;
}

.markdown-content strong {
    font-weight: 600;
    color: #2c3e50;
}

.markdown-content em {
    font-style: italic;
    color: #495057;
}

.markdown-content code {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 0.25rem;
    padding: 0.125rem 0.25rem;
    font-size: 0.875em;
    color: #e83e8c;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.markdown-content pre {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 0.375rem;
    padding: 1rem;
    margin: 1rem 0;
    overflow-x: auto;
    font-size: 0.875rem;
    line-height: 1.45;
}

.markdown-content pre code {
    background: none;
    border: none;
    padding: 0;
    color: #333;
    font-size: inherit;
}

.markdown-content blockquote {
    border-left: 4px solid #007bff;
    padding-left: 1rem;
    margin: 1rem 0;
    color: #6c757d;
    font-style: italic;
}

.markdown-content ul,
.markdown-content ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

.markdown-content li {
    margin-bottom: 0.25rem;
}

.markdown-content table {
    width: 100%;
    margin: 1rem 0;
    border-collapse: collapse;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    overflow: hidden;
}

.markdown-content th,
.markdown-content td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

.markdown-content th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

.markdown-content tr:nth-child(even) {
    background-color: #f8f9fa;
}

.markdown-content tr:hover {
    background-color: #e9ecef;
}

.markdown-content img {
    max-width: 100%;
    height: auto;
    border-radius: 0.375rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin: 1rem 0;
}

.markdown-content hr {
    border: none;
    height: 1px;
    background-color: #e9ecef;
    margin: 2rem 0;
}

/* MathJax Styles */
.markdown-content .MathJax {
    font-size: 1.1em;
}

.markdown-content .MathJax_Display {
    margin: 1.5rem 0;
    text-align: center;
}

/* Code Highlighting */
.markdown-content .highlight {
    background-color: #f8f9fa;
    border-radius: 0.375rem;
    padding: 1rem;
    margin: 1rem 0;
    overflow-x: auto;
}

.markdown-content .highlight pre {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
}

/* Table of Contents */
.markdown-content .toc {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 0.375rem;
    padding: 1rem;
    margin: 1rem 0;
}

.markdown-content .toc ul {
    margin: 0;
    padding-left: 1.5rem;
}

.markdown-content .toc a {
    color: #495057;
    text-decoration: none;
}

.markdown-content .toc a:hover {
    color: #007bff;
}

/* Markdown Editor Styles */
.markdown-editor-container {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    overflow: hidden;
}

.editor-toolbar {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 0.5rem;
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.editor-toolbar .btn {
    border-radius: 0.25rem;
    padding: 0.375rem 0.5rem;
    font-size: 0.875rem;
}

.markdown-editor {
    border: none !important;
    border-radius: 0 !important;
    resize: vertical;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
}

.markdown-editor:focus {
    box-shadow: none;
    border-color: transparent;
}

/* Responsive Design */
@media (max-width: 768px) {
    .markdown-content h1 {
        font-size: 1.875rem;
    }
    
    .markdown-content h2 {
        font-size: 1.5rem;
    }
    
    .markdown-content h3 {
        font-size: 1.25rem;
    }
    
    .editor-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .editor-toolbar .btn {
        margin-bottom: 0.25rem;
    }
}

/* Dark Theme Support */
@media (prefers-color-scheme: dark) {
    .markdown-content {
        color: #e9ecef;
    }
    
    .markdown-content h1,
    .markdown-content h2,
    .markdown-content h3,
    .markdown-content h4,
    .markdown-content h5,
    .markdown-content h6 {
        color: #f8f9fa;
    }
    
    .markdown-content code {
        background-color: #495057;
        color: #f8f9fa;
    }
    
    .markdown-content pre {
        background-color: #495057;
        border-color: #6c757d;
    }
    
    .markdown-content pre code {
        color: #f8f9fa;
    }
    
    .markdown-content blockquote {
        border-left-color: #007bff;
        color: #adb5bd;
    }
    
    .markdown-content table {
        border-color: #6c757d;
    }
    
    .markdown-content th {
        background-color: #495057;
        color: #f8f9fa;
    }
    
    .markdown-content tr:nth-child(even) {
        background-color: #495057;
    }
    
    .markdown-content tr:hover {
        background-color: #6c757d;
    }
}
