/* explain_ai.css - Styles for AI Explanation feature */

/* Markdown content styling */
.markdown-content {
    padding: 20px;
    padding-top: 0;
    line-height: 1.6;
    color: #333;
}

.markdown-content h1 {
    font-size: 2em;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
    margin-top: 24px;
    margin-bottom: 16px;
}

.markdown-content h2 {
    font-size: 1.5em;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
    margin-top: 24px;
    margin-bottom: 16px;
}

.markdown-content h3 {
    font-size: 1.25em;
    margin-top: 24px;
    margin-bottom: 16px;
}

.markdown-content h4, .markdown-content h5, .markdown-content h6 {
    margin-top: 24px;
    margin-bottom: 16px;
}

.markdown-content p {
    margin-bottom: 16px;
}

.markdown-content code {
    background-color: #f6f8fa;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.9em;
}

.markdown-content pre {
    background-color: #f6f8fa;
    padding: 16px;
    border-radius: 6px;
    overflow-x: auto;
    margin-bottom: 16px;
}

.markdown-content pre code {
    background-color: transparent;
    padding: 0;
    border-radius: 0;
    font-size: 14px;  /* Changed from 0.85em to fixed 14px for better readability */
    line-height: 1.6;  /* Increased from 1.45 for better spacing */
}

.markdown-content ul, .markdown-content ol {
    margin-bottom: 16px;
    padding-left: 2em;
}

.markdown-content li {
    margin-bottom: 4px;
}

.markdown-content blockquote {
    margin: 0 0 16px 0;
    padding: 0 1em;
    color: #6a737d;
    border-left: 4px solid #dfe2e5;
}

.markdown-content table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 16px;
}

.markdown-content table th, .markdown-content table td {
    border: 1px solid #dfe2e5;
    padding: 6px 13px;
}

.markdown-content table th {
    background-color: #f6f8fa;
    font-weight: 600;
}

.markdown-content table tr:nth-child(2n) {
    background-color: #f6f8fa;
}

.markdown-content a {
    color: #0366d6;
    text-decoration: none;
}

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

.markdown-content img {
    max-width: 100%;
    height: auto;
}

.markdown-content hr {
    height: 4px;
    padding: 0;
    margin: 24px 0;
    background-color: #e1e4e8;
    border: 0;
}

/* PlantUML diagram styling */
.plantuml-diagram {
    text-align: center;
    margin: 20px 0;
    padding: 10px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.plantuml-diagram img {
    max-width: 100%;
    height: auto;
    display: inline-block;
}

.plantuml-diagram-actions {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #eee;
    text-align: center;
}

.plantuml-open-link {
    display: inline-block;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: normal;
    color: #337ab7;
    text-decoration: none;
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.plantuml-open-link:hover {
    color: #23527c;
    background-color: #e7e9eb;
    border-color: #adadad;
    text-decoration: none;
}

.plantuml-open-link .glyphicon {
    margin-right: 4px;
}

/* Mermaid diagram styling */
.mermaid-diagram {
    text-align: center;
    margin: 20px 0;
    padding: 10px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Tabs styling */
#markdown-tabs {
    margin-bottom: 0;
    border-bottom: none;
}

#markdown-tabs > li > a {
    border-radius: 4px 4px 0 0;
}

/* Custom markdown toolbar - floats right next to tabs */
#custom-markdown-toolbar {
    z-index: 10;
}

#custom-markdown-toolbar #id_custom_position {
    display: inline-block;
    width: auto;
    max-width: 180px;
    margin-right: 0;
    font-size: 13px;
    height: 30px;
    padding: 5px 10px;
    vertical-align: top;
}

#custom-markdown-toolbar label[for="id_custom_position"] {
    font-size: 13px;
    color: #555;
    vertical-align: top;
    line-height: 30px;
}

#custom-markdown-toolbar #btn-copy-ai-to-custom {
    vertical-align: top;
    height: 30px;
    padding: 5px 12px;
    font-size: 13px;
    line-height: 18px;
}

.tab-content {
    border: 1px solid #ddd;
    border-top: none;
    min-height: 400px;
}

.tab-content > .tab-pane {
    padding: 0;
}

#tab-view {
    background-color: #fff;
}

#tab-edit {
    background-color: #f9f9f9;
    padding: 0;
}

#tab-edit textarea {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.9em;
    border: 1px solid #ddd;
    border-radius: 4px;
    min-height: 500px;
}

/* CodeMirror editor styling */
#tab-edit .CodeMirror,
#tab-edit-custom .CodeMirror {
    border: 1px solid #ddd;
    height: auto;
    min-height: 500px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 14px;
    line-height: 1.6;
}

#tab-edit .CodeMirror-scroll,
#tab-edit-custom .CodeMirror-scroll {
    min-height: 500px;
}

#tab-edit .CodeMirror-gutters,
#tab-edit-custom .CodeMirror-gutters {
    background-color: #f6f8fa;
    border-right: 1px solid #ddd;
}

#tab-edit .CodeMirror-linenumber,
#tab-edit-custom .CodeMirror-linenumber {
    color: #999;
    padding: 0 5px;
}

/* Markdown syntax highlighting in CodeMirror */
#tab-edit .cm-header,
#tab-edit-custom .cm-header {
    color: #0366d6;
    font-weight: bold;
}

#tab-edit .cm-header-1,
#tab-edit-custom .cm-header-1 {
    font-size: 1.6em;
}

#tab-edit .cm-header-2,
#tab-edit-custom .cm-header-2 {
    font-size: 1.4em;
}

#tab-edit .cm-header-3,
#tab-edit-custom .cm-header-3 {
    font-size: 1.2em;
}

#tab-edit .cm-strong,
#tab-edit-custom .cm-strong {
    font-weight: bold;
}

#tab-edit .cm-em,
#tab-edit-custom .cm-em {
    font-style: italic;
}

#tab-edit .cm-link,
#tab-edit-custom .cm-link {
    color: #0366d6;
    text-decoration: underline;
}

#tab-edit .cm-comment,
#tab-edit-custom .cm-comment {
    color: #6a737d;
    background-color: #f6f8fa;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

#tab-edit .cm-quote,
#tab-edit-custom .cm-quote {
    color: #6a737d;
    font-style: italic;
}

#tab-edit .cm-variable-2,
#tab-edit .cm-variable-3,
#tab-edit .cm-keyword,
#tab-edit-custom .cm-variable-2,
#tab-edit-custom .cm-variable-3,
#tab-edit-custom .cm-keyword {
    color: #d73a49;
}

#tab-edit .form-group,
#tab-edit-custom .form-group {
    margin: 0;
}

#tab-edit .help-block,
#tab-edit-custom .help-block {
    margin: 10px 15px;
}

/* Edit Custom tab specific styling */
#tab-edit-custom {
    background-color: #f9f9f9;
    padding: 0;
}

/* Export buttons */
#btn-export-html, #btn-export-pdf {
    margin-left: 5px;
}

/* Panel styling improvements */
#markdown-display-panel {
    margin-bottom: 20px;
}

/* Background color of Collapsible Explanation Header */
#markdown-display-panel .panel-heading {
    background-color: #fff;
    border-bottom: none;
    padding: 10px 15px;
}

/* Text color of Collapsible Explanation Header */
#markdown-display-panel .panel-heading a {
    color: darkcyan;
    text-decoration: none;
}

#markdown-display-panel .panel-heading a:hover {
    text-decoration: underline;
}

/* Accordion improvements */
.panel-title a {
    display: block;
    text-decoration: none;
}

.panel-title a:hover {
    text-decoration: none;
}

/* Help text styling */
.help-block {
    color: #737373;
    font-size: 0.9em;
    margin-top: 5px;
    margin-bottom: 10px;
}

/* Status messages */
.status {
    margin: 10px 0;
    font-size: 0.9em;
}

.status-debug {
    margin: 10px 0;
    font-size: 0.85em;
    color: #666;
}

/* Right sidebar improvements */
#main-right {
    position: fixed;
    right: 0;
    top: 60px;
    width: 40%;
    height: calc(100% - 60px);
    background-color: #fff;
    border-left: 2px solid #ddd;
    padding: 15px;
    overflow-y: auto;
    z-index: 1000;
}

#main-right.hidden {
    display: none;
}

#main-right .preview_heading {
    margin-top: 0;
    padding-top: 0;
    color: #333;
}

#main-right .my-silly-scrolling-area {
    max-height: calc(100vh - 150px);
    overflow-y: auto;
    padding: 10px;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Button improvements */
.btn-toolbar {
    margin-bottom: 15px;
}

.btn-toolbar .btn {
    margin-right: 5px;
}

/* Loading overlay customization */
.loadingoverlay {
    background-color: rgba(0, 0, 0, 0.7) !important;
}

.loadingoverlay_element {
    color: #fff !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #main-right {
        width: 100%;
        left: 0;
        top: 0;
        height: 100%;
    }
    
    .tab-content {
        min-height: 300px;
    }
}

/* Metadata display list */
.dl-horizontal dt {
    text-align: left;
    font-weight: 600;
    color: #555;
}

.dl-horizontal dd {
    margin-bottom: 10px;
}

/* Label improvements */
.label {
    font-size: 0.85em;
    padding: 4px 8px;
    margin-right: 5px;
}

/* File tree improvements */
.ztree {
    margin: 0;
    padding: 5px;
    color: #333;
}

.ztree li {
    padding: 2px 0;
}

/* Diagram ID badge */
.diagram_id {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #f0ad4e;
    color: #fff;
    padding: 0px 5px;
    border-radius: 3px;
    font-size: 0.5em;
    font-weight: normal;
}

/* Please pick files message */
#please_pick_files {
    color: #d9534f;
    font-weight: bold;
    margin-top: 10px;
}

#please_pick_files.no-display {
    display: none;
}

/* Form field improvements */
textarea.form-control {
    resize: vertical;
}

input[type="text"].form-control,
textarea.form-control,
select.form-control {
    border-radius: 4px;
    border: 1px solid #ccc;
}

input[type="text"].form-control:focus,
textarea.form-control:focus,
select.form-control:focus {
    border-color: #66afe9;
    outline: 0;
    box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102,175,233,.6);
}

/* Alert improvements */
.alert {
    margin-bottom: 15px;
}

/* Code highlighting improvements */
.hljs {
    display: block;
    overflow-x: auto;
    padding: 0.5em;
    background: #f6f8fa;
    color: #24292e;
}

/* List table improvements */
.table > tbody > tr > td {
    vertical-align: middle;
}

.table .btn-group-vertical {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.table .text-muted {
    color: #999;
}

/* Pagination improvements */
.pagination {
    margin: 20px 0;
}

.pagination > li > a,
.pagination > li > span {
    color: #337ab7;
}

.pagination > .active > a,
.pagination > .active > span {
    background-color: #337ab7;
    border-color: #337ab7;
}

/* Model dropdown tooltips - make them wider for descriptions */
.tooltip-inner {
    max-width: 400px;
    min-width: 200px;
    width: auto;
    text-align: left;
    padding: 8px 12px;
}
