/* PLUMED Section Styles */

/* PLUMED Citation Note */
.plumed-citation-note {
    background: #e3f2fd;
    border: 2px solid #2196f3;
    border-left: 5px solid #2196f3;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    box-shadow: 0 2px 4px rgba(33, 150, 243, 0.1);
}

.plumed-citation-note i {
    color: #2196f3;
    font-size: 1.5rem;
    margin-top: 0.2rem;
    flex-shrink: 0;
}

.citation-content {
    flex: 1;
    color: #1565c0;
    line-height: 1.6;
}

.citation-content p {
    margin: 0.5rem 0;
    font-size: 0.95rem;
}

.citation-content p:first-child {
    margin-top: 0;
}

.citation-content p:last-child {
    margin-bottom: 0;
}

.citation-content strong {
    color: #0d47a1;
    font-weight: 600;
}

.citation-content a {
    color: #1976d2;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.citation-content a:hover {
    color: #0d47a1;
    text-decoration: underline;
}

.citation-content a i {
    font-size: 0.85rem;
    color: inherit;
    margin: 0;
}

.plumed-container {
    display: flex;
    gap: 2rem;
    margin-top: 1.5rem;
    min-height: 600px;
}

/* Left Sidebar */
.plumed-sidebar {
    width: 300px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    display: flex;
    flex-direction: column;
    max-height: 800px;
    overflow: hidden;
}

.sidebar-header {
    padding: 1rem;
    background: #2c3e50;
    color: white;
    border-bottom: 2px solid #3498db;
}

.sidebar-header h3 {
    margin: 0 0 1rem 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.sidebar-header h3 i {
    margin-right: 0.5rem;
    color: #3498db;
}

.search-box {
    position: relative;
}

.search-input {
    width: 100%;
    padding: 0.5rem 2.5rem 0.5rem 0.75rem;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.search-icon {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #7f8c8d;
    pointer-events: none;
}

.cv-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.cv-item {
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cv-item:hover {
    background: #e3f2fd;
    border-color: #3498db;
    transform: translateX(5px);
}

.cv-item.active {
    background: #3498db;
    color: white;
    border-color: #2980b9;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

.cv-item-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.cv-item-category {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 0.25rem;
}

.cv-item.active .cv-item-category {
    opacity: 0.9;
}

.cv-item-icon {
    color: #3498db;
    margin-left: 0.5rem;
}

.cv-item.active .cv-item-icon {
    color: white;
}

/* Right Content Panel */
.plumed-content {
    flex: 1;
    background: white;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    padding: 1.5rem;
    overflow-y: auto;
    max-height: 800px;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e1e8ed;
}

.content-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.plumed-doc-link {
    color: #3498db;
    text-decoration: none;
    font-size: 0.85em;
    margin-left: 0.5rem;
    transition: color 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.plumed-doc-link:hover {
    color: #2980b9;
    text-decoration: underline;
}

.plumed-doc-link i {
    font-size: 0.75em;
}

.welcome-message {
    text-align: center;
    padding: 3rem 1rem;
    color: #7f8c8d;
}

.welcome-message i {
    color: #bdc3c7;
    margin-bottom: 1rem;
}

.welcome-message h3 {
    color: #2c3e50;
    margin: 1rem 0;
}

/* Documentation Sections */
.cv-documentation {
    margin-bottom: 2rem;
}

.doc-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

.doc-section h4 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
}

.doc-section h4 {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.doc-section h4 i {
    margin-right: 0.5rem;
    color: #3498db;
}

/* Options heading with legend on the right - only apply space-between to headings with color-legend */
.doc-section h4 .color-legend {
    margin-left: auto;
}

/* For browsers that support :has() */
@supports selector(:has(*)) {
    .doc-section h4:has(.color-legend) {
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 1rem;
    }
}

/* Fallback for browsers without :has() support - use a class */
.doc-section h4.options-heading-with-legend {
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.color-legend {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.85rem;
    font-weight: normal;
    color: #7f8c8d;
    margin-left: auto;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-item code {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
}

.doc-content {
    color: #555;
    line-height: 1.8;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.description-paragraph {
    margin-bottom: 1rem;
    line-height: 1.8;
}

.description-list {
    list-style: none;
    padding-left: 0;
    margin: 1rem 0;
}

.description-list li {
    padding: 0.5rem 0 0.5rem 1.5rem;
    position: relative;
    line-height: 1.8;
    margin-bottom: 0.5rem;
}

.description-list li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: #3498db;
    font-size: 1.2em;
    font-weight: bold;
    line-height: 1.4;
}

.description-list li:last-child {
    margin-bottom: 0;
}

/* Ensure Unicode mathematical symbols render correctly */
.doc-content,
.math-formula {
    font-variant-numeric: normal;
    text-rendering: optimizeLegibility;
    -webkit-font-feature-settings: "kern" 1;
    font-feature-settings: "kern" 1;
}

.syntax-box,
.example-box {
    background: #2c3e50;
    color: #ecf0f1;
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.example-box {
    background: #34495e;
    border-left: 4px solid #3498db;
}

/* Editor Section */
.cv-editor-section {
    margin-top: 2rem;
    border-top: 2px solid #e1e8ed;
    padding-top: 1.5rem;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.editor-header h4 {
    color: #2c3e50;
    margin: 0;
    font-size: 1.1rem;
}

.editor-header h4 i {
    margin-right: 0.5rem;
    color: #3498db;
}

.editor-actions {
    display: flex;
    gap: 0.5rem;
}

.cv-editor {
    width: 100%;
    min-height: 300px;
    padding: 1rem;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    resize: vertical;
    transition: border-color 0.3s ease;
}

.cv-editor:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.editor-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: #7f8c8d;
}

/* Saved Configurations */
.saved-configs {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid #e1e8ed;
}

.saved-configs h4 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.saved-configs h4 i {
    margin-right: 0.5rem;
    color: #3498db;
}

.config-item {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.config-item:hover {
    background: #e3f2fd;
    border-color: #3498db;
}

.config-item-name {
    font-weight: 600;
    color: #2c3e50;
}

.config-item-actions {
    display: flex;
    gap: 0.5rem;
}

.config-item-actions button {
    padding: 0.25rem 0.75rem;
    font-size: 0.85rem;
}

/* Section Description */
.section-description {
    color: #7f8c8d;
    margin-bottom: 1.5rem;
    font-style: italic;
}

/* Glossary and Options Lists */
.glossary-content,
.options-list,
.components-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.glossary-item {
    background: white;
    padding: 1rem;
    border-radius: 6px;
    border-left: 3px solid #9b59b6;
    margin-bottom: 0.5rem;
}

.glossary-item strong {
    color: #2c3e50;
    font-size: 1rem;
    display: inline-block;
    margin-right: 0.5rem;
}

.glossary-item p {
    margin: 0.5rem 0 0 0;
    color: #555;
    line-height: 1.6;
}

.glossary-content > p {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 1rem;
}

/* Options Keywords - Horizontal Layout */
.options-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.options-keywords code {
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    display: inline-block;
    transition: all 0.2s ease;
}

.keyword-required {
    background: #fee;
    color: #c33;
    border: 1px solid #fcc;
}

.keyword-required:hover {
    background: #fdd;
    border-color: #c33;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(204, 51, 51, 0.2);
}

.keyword-optional {
    background: #f5f5f5;
    color: #666;
    border: 1px solid #ddd;
}

.keyword-optional:hover {
    background: #eee;
    border-color: #999;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Components Lists */
.components-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.component-item {
    background: white;
    padding: 1rem;
    border-radius: 6px;
    border-left: 3px solid #3498db;
    margin-bottom: 0.5rem;
}

.component-item strong {
    color: #2c3e50;
    font-size: 1rem;
    display: inline-block;
    margin-right: 0.5rem;
}

.component-item p {
    margin: 0.5rem 0 0 0;
    color: #555;
    line-height: 1.6;
}

/* Notes List */
.notes-list {
    list-style: none;
    padding: 0;
}

.notes-list li {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: #fff3cd;
    border-left: 3px solid #ffc107;
    border-radius: 4px;
    color: #856404;
}

.notes-list li::before {
    content: "ℹ️";
    margin-right: 0.5rem;
}

/* Math Formulas */
.math-formula {
    background: #f8f9fa;
    padding: 0.75rem;
    border-radius: 4px;
    margin: 0.75rem 0;
    font-family: 'Times New Roman', 'DejaVu Serif', serif;
    font-size: 1rem;
    border-left: 3px solid #3498db;
    white-space: pre-wrap;
    line-height: 1.8;
    color: #2c3e50;
    font-style: italic;
}

/* Mathematical formatting */
.math-fraction {
    display: inline-flex;
    flex-direction: column;
    vertical-align: middle;
    text-align: center;
    margin: 0 0.3em;
    line-height: 1;
    font-size: 1.1em;
}

.math-numerator {
    border-bottom: 1.5px solid currentColor;
    padding: 0 0.3em 0.1em 0.3em;
    line-height: 1.1;
}

.math-denominator {
    padding: 0.1em 0.3em 0 0.3em;
    line-height: 1.1;
}

.math-sqrt {
    display: inline-block;
    position: relative;
    vertical-align: middle;
    margin: 0 0.2em;
    font-size: 1.1em;
}

.math-sqrt-symbol {
    font-size: 1.3em;
    vertical-align: middle;
    margin-right: 0.1em;
    line-height: 1;
}

.math-radicand {
    display: inline-block;
    padding: 0.1em 0.3em;
    margin-left: 0.1em;
    border-top: 1.5px solid currentColor;
    vertical-align: middle;
}

.math-formula sup,
.math-formula sub,
.description-paragraph sup,
.description-paragraph sub,
.description-list li sup,
.description-list li sub {
    font-size: 0.75em;
    line-height: 0;
    position: relative;
    vertical-align: baseline;
    font-weight: normal;
}

.math-formula sup,
.description-paragraph sup,
.description-list li sup {
    top: -0.5em;
}

.math-formula sub,
.description-paragraph sub,
.description-list li sub {
    bottom: -0.25em;
}

/* Ensure proper rendering of subscripts and superscripts in all contexts */
.doc-content sup,
.doc-content sub {
    font-size: 0.75em;
    line-height: 0;
    position: relative;
    vertical-align: baseline;
}

.doc-content sup {
    top: -0.5em;
}

.doc-content sub {
    bottom: -0.25em;
}

.doc-content sub {
    font-size: 0.8em;
    vertical-align: sub;
}

.doc-content code {
    background: #f1f3f5;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

/* Related CVs */
.related-cvs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.related-cv-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: #e3f2fd;
    color: #1976d2;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    border: 1px solid #90caf9;
}

.related-cv-badge:hover {
    background: #1976d2;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(25, 118, 210, 0.3);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .plumed-container {
        flex-direction: column;
    }
    
    .plumed-sidebar {
        width: 100%;
        max-height: 300px;
    }
}

/* Scrollbar Styling */
.cv-list::-webkit-scrollbar,
.plumed-content::-webkit-scrollbar {
    width: 8px;
}

.cv-list::-webkit-scrollbar-track,
.plumed-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.cv-list::-webkit-scrollbar-thumb,
.plumed-content::-webkit-scrollbar-thumb {
    background: #bdc3c7;
    border-radius: 4px;
}

.cv-list::-webkit-scrollbar-thumb:hover,
.plumed-content::-webkit-scrollbar-thumb:hover {
    background: #95a5a6;
}

/* PLUMED Section Cards */
.plumed-section-card {
    margin-bottom: 1.5rem;
}

.plumed-section-card:last-child {
    margin-bottom: 0;
}

/* PLUMED Section Headers - Smaller font size */
.plumed-section-card h2 {
    font-size: 1.4rem !important;
}

/* Collapsed state - hide content but keep header visible */
.plumed-section-card.collapsed .section-description,
.plumed-section-card.collapsed .plumed-container,
.plumed-section-card.collapsed .plumed-generate-section,
.plumed-section-card.collapsed .generate-simulation-files-section {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.3s ease, margin 0.3s ease, padding 0.3s ease;
}

/* Keep header visible even when collapsed */
.plumed-section-card.collapsed .plumed-toggle-header {
    margin-bottom: 0;
}

/* Collapsible Header */
.plumed-toggle-header {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: color 0.3s ease;
    padding: 0.5rem;
    margin: -0.5rem;
    border-radius: 4px;
    text-align: left !important;
}

.plumed-toggle-header > i:first-of-type {
    margin-right: 0.5rem;
}

/* Ensure left alignment for custom PLUMED header */
#custom-plumed-card h2,
#custom-plumed-card .plumed-toggle-header {
    text-align: left !important;
    justify-content: flex-start !important;
}

#custom-plumed-card .plumed-toggle-header {
    display: flex !important;
    align-items: center;
}

#custom-plumed-card .plumed-toggle-header > *:first-child {
    margin-right: 0.5rem;
}

#custom-plumed-card .plumed-toggle-header .toggle-icon {
    margin-left: auto;
    margin-right: 0;
}

/* Generate Simulation Files Section - Left Aligned */
#generate-simulation-files-card h2,
#generate-simulation-files-card .plumed-toggle-header {
    text-align: left !important;
    justify-content: flex-start !important;
}

#generate-simulation-files-card .plumed-toggle-header {
    display: flex !important;
    align-items: center;
}

#generate-simulation-files-card .plumed-toggle-header > *:first-child {
    margin-right: 0.5rem;
}

#generate-simulation-files-card .plumed-toggle-header .toggle-icon {
    margin-left: auto;
    margin-right: 0;
}

.plumed-toggle-header:hover {
    background: rgba(52, 152, 219, 0.1);
    color: #3498db;
}

.toggle-icon {
    transition: transform 0.3s ease;
    font-size: 0.9em;
    color: #7f8c8d;
}

.plumed-toggle-header.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.plumed-container,
.plumed-generate-section {
    transition: max-height 0.4s ease, opacity 0.3s ease, margin 0.3s ease;
    overflow: hidden;
}

.section-description {
    transition: max-height 0.4s ease, opacity 0.3s ease, margin 0.3s ease, padding 0.3s ease;
    overflow: hidden;
}

/* Generate Files Section */
.plumed-generate-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
}

.generate-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.generate-options {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.generate-options .btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.generated-file-preview {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 1rem;
}

.generated-file-preview h4 {
    margin: 0 0 1rem 0;
    color: #2c3e50;
    font-size: 1.1rem;
}

.file-preview {
    background: #2c3e50;
    color: #ecf0f1;
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 0;
    max-height: 400px;
    overflow-y: auto;
}

/* Custom PLUMED File Section */
.custom-plumed-section {
    margin-top: 1.5rem;
    transition: max-height 0.4s ease, opacity 0.3s ease, margin 0.3s ease, padding 0.3s ease;
    overflow: hidden;
}

/* Collapsed state for custom PLUMED section */
#custom-plumed-card.collapsed .section-description,
#custom-plumed-card.collapsed .custom-plumed-section {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
}

/* Keep header visible even when collapsed */
#custom-plumed-card.collapsed .plumed-toggle-header {
    margin-bottom: 0;
}

.custom-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #dee2e6;
}

.custom-editor-header h4 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.custom-editor-header h4 i {
    color: #3498db;
}

.custom-plumed-editor {
    width: 100%;
    min-height: 400px;
    padding: 1rem;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    line-height: 1.6;
    resize: vertical;
    background: #ffffff;
    color: #2c3e50;
    transition: border-color 0.3s ease;
}

.custom-plumed-editor:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.custom-plumed-editor::placeholder {
    color: #95a5a6;
    font-style: italic;
}

