/* GLMP Viewer Styles - Clean, Modern, Responsive */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --accent-color: #f093fb;
    --text-color: #333;
    --text-light: #666;
    --bg-color: #f8f9fa;
    --white: #ffffff;
    --border-color: #dee2e6;
    --success-color: #51cf66;
    --warning-color: #ffd43b;
    --error-color: #ff6b6b;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: var(--bg-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* Back to Table Button */
.back-to-table-btn {
    background: var(--primary-color);
    color: var(--white) !important;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin: 20px 0;
    display: block !important;
    text-decoration: none;
    transition: background 0.2s;
    width: auto;
    visibility: visible !important;
    opacity: 1 !important;
}

.back-to-table-btn:hover {
    background: var(--secondary-color);
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--white);
    padding: 2rem 0;
    text-align: center;
    box-shadow: var(--shadow);
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.tagline {
    font-size: 1.1rem;
    opacity: 0.95;
    font-weight: 300;
}

/* Navigation */
.nav {
    background: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav .container {
    display: flex;
    gap: 1rem;
    padding: 1rem 20px;
    flex-wrap: wrap;
}

.nav-btn {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0.5rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    background: var(--primary-color);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

/* Main Content */
.main {
    flex: 1;
    padding: 2rem 0;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 3rem 0;
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.hero h2 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.hero-text {
    font-size: 1.2rem;
    color: var(--text-light);
    max-width: 800px;
    margin: 0 auto;
}

/* Feature Grid */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.feature-card {
    background: var(--white);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.feature-card h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.feature-card p {
    color: var(--text-light);
}

/* CTA Section */
.cta-section {
    text-align: center;
    padding: 3rem 0;
}

.cta-button {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    border: none;
    padding: 1rem 3rem;
    font-size: 1.2rem;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Process List */
.organism-group {
    margin: 2rem 0;
}

.organism-group h3 {
    color: var(--primary-color);
    font-size: 1.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.process-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.process-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-left: 4px solid var(--primary-color);
}

.process-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.process-card h4 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.card-category {
    display: inline-block;
    background: var(--bg-color);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.card-desc {
    color: var(--text-light);
    font-size: 0.95rem;
}

/* Process Detail View */
.process-header {
    background: var(--white);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.back-btn {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 1rem;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: var(--primary-color);
    color: var(--white);
}

.process-meta {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.meta-tag {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

.process-description {
    background: var(--bg-color);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    border-left: 4px solid var(--primary-color);
}

/* Detail Level Selector */
.detail-selector {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    text-align: center;
}

.detail-selector label {
    font-weight: 600;
    margin-right: 1rem;
}

#detail-level {
    width: 300px;
    max-width: 100%;
    margin: 0 1rem;
    cursor: pointer;
}

#detail-label {
    font-weight: 600;
    color: var(--primary-color);
}

/* Diagram Container */
.diagram-container {
    background: var(--white);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    overflow-x: auto;
}

.mermaid {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    width: 100%;
}

/* Make Mermaid SVG larger and more readable */
.mermaid svg {
    max-width: 100% !important;
    height: auto !important;
    font-size: 14px !important;
    min-width: 800px;  /* Ensure minimum readable size */
}

/* Scale up text in Mermaid nodes - ensure labels are visible */
.mermaid .nodeLabel,
.mermaid .edgeLabel,
.mermaid .label,
.mermaid .node text,
.mermaid text,
.mermaid tspan {
    font-size: 13px !important;
    font-weight: 500;
    fill: #333 !important;  /* Ensure text is visible */
    color: #333 !important;
    stroke: none !important;
}

/* Ensure node shapes are visible and clickable */
.mermaid .node {
    cursor: pointer;
    transition: opacity 0.2s ease;
    position: relative;  /* For tooltip positioning */
}

.mermaid .node:hover {
    opacity: 0.8;
}

/* Ensure tooltips work on all node elements */
.mermaid .node rect,
.mermaid .node circle,
.mermaid .node ellipse,
.mermaid .node polygon,
.mermaid .node path {
    cursor: pointer;
    pointer-events: auto;  /* Ensure hover events work */
}

/* Citations Section */
.citations-section {
    background: var(--white);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.citations-section h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.citations {
    list-style-position: outside;
    padding-left: 1.5rem;
}

.citations-empty-hint {
    margin-top: 0.75rem;
    font-size: 0.92rem;
    color: var(--text-light);
    line-height: 1.55;
}

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

.citation-link {
    display: inline-block;
    margin: 0 0.5rem;
    color: var(--primary-color);
    text-decoration: none;
    padding: 0.25rem 0.75rem;
    background: var(--bg-color);
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.citation-link:hover {
    background: var(--primary-color);
    color: var(--white);
}

/* Metadata Section */
.metadata-section {
    background: var(--bg-color);
    padding: 2rem;
    border-radius: 12px;
}

.metadata-section h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.metadata-list {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.5rem 1rem;
}

.metadata-list dt {
    font-weight: 600;
}

.metadata-list dd {
    color: var(--text-light);
}

/* About View */
.about-content {
    background: var(--white);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.about-content h3 {
    color: var(--primary-color);
    margin: 2rem 0 1rem 0;
}

.about-content h3:first-child {
    margin-top: 0;
}

.about-content ul {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

.about-content li {
    margin-bottom: 0.5rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.empty-state p {
    font-size: 1.1rem;
    color: var(--text-light);
}

/* Loading Spinner */
.loading-spinner {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.spinner {
    border: 4px solid var(--bg-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner p {
    font-size: 1.1rem;
    color: var(--text-light);
    margin: 0;
}

/* Error Message */
.error-message {
    background: #ffe0e0;
    border-left: 4px solid var(--error-color);
    padding: 2rem;
    border-radius: 12px;
    margin: 2rem 0;
    text-align: center;
    box-shadow: var(--shadow);
}

.error-message h3 {
    color: var(--error-color);
    margin-bottom: 1rem;
}

.error-message p {
    color: var(--text-color);
    margin: 0.5rem 0;
}

.retry-btn {
    background: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    margin-top: 1rem;
    transition: all 0.3s ease;
}

.retry-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

/* Footer */
.footer {
    background: var(--white);
    padding: 2rem 0;
    text-align: center;
    margin-top: auto;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
}

.footer p {
    color: var(--text-light);
    margin: 0.25rem 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header h1 {
        font-size: 1.8rem;
    }
    
    .tagline {
        font-size: 0.95rem;
    }
    
    .feature-grid {
        grid-template-columns: 1fr;
    }
    
    .process-cards {
        grid-template-columns: 1fr;
    }
    
    .nav .container {
        justify-content: center;
    }
    
    #detail-level {
        width: 200px;
    }
}

/* Scientific Accuracy Statement */
.scientific-accuracy {
    background-color: #e7f5ff;
    border-left: 4px solid #339af0;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.scientific-accuracy h4 {
    margin: 0 0 0.75rem 0;
    color: #1971c2;
    font-size: 1.1rem;
}

.scientific-accuracy p {
    margin: 0;
    line-height: 1.7;
    color: #495057;
}

/* Color Legend */
.color-legend {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.color-legend h4 {
    margin: 0 0 1rem 0;
    color: #495057;
    font-size: 1.1rem;
}

.color-key-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.color-key-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background-color: white;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    transition: all 0.2s ease;
}

.color-key-item:hover {
    border-color: #adb5bd;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.color-badge {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,0.15);
}

.color-info {
    flex: 1;
}

.color-info strong {
    display: block;
    color: #212529;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.color-info small {
    display: block;
    color: #6c757d;
    font-size: 0.8rem;
    line-height: 1.4;
}

/* Print Styles */
@media print {
    .header, .nav, .footer, .back-btn, .detail-selector {
        display: none;
    }
    
    .main {
        padding: 0;
    }
    
    .diagram-container {
        box-shadow: none;
    }
}

/* Process Table - Simple List Layout */
.process-list-container {
    margin-top: 1rem;
}

.process-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    font-size: 0.9rem;
}

.process-table thead {
    background: #ecf0f1;
    position: sticky;
    top: 0;
}

.process-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 2px solid #bdc3c7;
}

.process-table tbody tr {
    border-bottom: 1px solid #ddd;
    transition: background-color 0.2s;
}

.process-table tbody tr:hover {
    background-color: #f8f9fa;
}

.process-table td {
    padding: 12px 16px;
}

.process-table .process-name {
    font-weight: 600;
}

.process-table .process-name a {
    color: #2c3e50;
    text-decoration: none;
}

.process-table .process-name a:hover {
    color: #3498db;
    text-decoration: underline;
}

.process-table .organism {
    font-style: italic;
    color: #7f8c8d;
}

.category-badge {
    display: inline-block;
    padding: 4px 10px;
    background: #e8f4f8;
    color: #2980b9;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* Database Link Box */
.database-link-box {
    margin: 30px 0;
    padding: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    text-align: center;
    color: white;
    box-shadow: var(--shadow-lg);
}

.database-link-box h3 {
    margin-top: 0;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.database-link-box p {
    margin-bottom: 1.5rem;
    opacity: 0.95;
    font-size: 1rem;
}

.button-primary {
    display: inline-block;
    padding: 12px 30px;
    background: white;
    color: #667eea;
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.button-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    color: #764ba2;
}

/* Resource Links */
.resource-links {
    background: var(--bg-color);
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.resource-links ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.resource-links li {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.resource-links li:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.resource-links a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    display: block;
    padding: 0.5rem;
    border-radius: 6px;
}

.resource-links a:hover {
    background: var(--white);
    color: var(--secondary-color);
    padding-left: 1rem;
}

/* Expandable Sections (Optimized for Clean UX) */
.expandable-section {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin: 1rem 0;
    padding: 0;
    box-shadow: var(--shadow);
}

.expandable-section summary {
    padding: 1rem 1.5rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--primary-color);
    user-select: none;
    transition: all 0.2s ease;
    border-radius: 8px;
}

.expandable-section summary:hover {
    background: var(--bg-color);
}

.expandable-section[open] summary {
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.expandable-section .scientific-accuracy-content,
.expandable-section .citations-section,
.expandable-section .metadata-section {
    padding: 0 1.5rem 1rem;
}

/* Compact Description */
.process-description-short {
    margin: 1rem 0;
    padding: 1rem;
    background: var(--bg-color);
    border-left: 4px solid var(--primary-color);
    border-radius: 4px;
    font-size: 1rem;
    line-height: 1.5;
}

.process-description-short p {
    margin: 0;
}

/* Compact Feedback Panel */
.feedback-panel {
    margin: 1.5rem 0 2.5rem;
    padding: 1.25rem 1.5rem;
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.feedback-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.feedback-intro {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 0.75rem;
}

.feedback-context {
    background: var(--bg-color);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    display: block !important;  /* Force visibility */
    visibility: visible !important;
}

.feedback-context-line {
    display: flex !important;
    justify-content: space-between;
    gap: 0.5rem;
    visibility: visible !important;
}

.feedback-context-label {
    font-weight: 600;
    color: var(--text-light);
    visibility: visible !important;
}

.feedback-context-value {
    font-weight: 500;
    color: var(--text-color) !important;
    text-align: right;
    min-width: 100px;  /* Ensure it has space to display */
    display: inline-block !important;  /* Ensure it's a block element */
    word-break: break-word;  /* Allow long IDs to wrap */
    visibility: visible !important;
    opacity: 1 !important;
}

/* Specifically target the process ID */
#feedback-process-id {
    font-weight: 600 !important;
    color: var(--primary-color) !important;
    font-size: 0.9rem !important;
    min-width: 150px !important;
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    background-color: transparent !important;
}

.feedback-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-top: 0.5rem;
    margin-bottom: 0.25rem;
}

.feedback-input {
    width: 100%;
    padding: 0.45rem 0.6rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: #fff;
}

.feedback-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.feedback-textarea {
    resize: vertical;
    min-height: 60px;
}

.feedback-row {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.feedback-col {
    flex: 1;
}

.feedback-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-light);
}

.feedback-checkbox input[type="checkbox"] {
    margin-top: 0.1rem;
}

.feedback-consent {
    margin-top: 0.35rem;
}

.feedback-submit-btn {
    margin-top: 0.75rem;
    width: 100%;
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.feedback-submit-btn:active {
    transform: translateY(1px);
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.feedback-status {
    margin-top: 0.4rem;
    font-size: 0.8rem;
    color: var(--text-light);
}

.feedback-hint {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.8rem;
    color: var(--text-light);
}

@media (max-width: 768px) {
    .feedback-panel {
        padding: 1rem 1rem;
        margin: 1rem 0 2rem;
    }
    .feedback-row {
        flex-direction: column;
    }
}

/* Compact Color Legend */
.color-legend-compact {
    margin: 1.5rem 0;
}

.color-legend-compact details {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0;
    box-shadow: var(--shadow);
}

.color-legend-compact summary {
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    color: var(--primary-color);
    user-select: none;
    transition: all 0.2s ease;
}

.color-legend-compact summary:hover {
    background: var(--bg-color);
}

.color-legend-compact[open] summary {
    border-bottom: 1px solid var(--border-color);
}

.color-legend-compact .color-key-grid {
    padding: 1rem 1.5rem;
}

/* Diagram Container - Make it prominent! */
.diagram-container {
    margin: 1.5rem 0;
    padding: 2rem;
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    min-height: 400px;
    overflow: auto;  /* Allow scrolling for large diagrams */
    -webkit-overflow-scrolling: touch;  /* Smooth scrolling on iOS */
}

/* Process Header - Make it compact */
.process-header {
    margin-bottom: 0.5rem;
}

.process-header-top {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem 1rem;
}

.process-header-titles {
    flex: 1;
    min-width: 0;
}

.process-header h2 {
    margin: 0.5rem 0;
}

.process-meta {
    margin: 0.5rem 0 1rem;
}

.process-cite-btn {
    flex-shrink: 0;
    margin-top: 0.35rem;
    padding: 0.45rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff;
    background: #8e44ad;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
}

.process-cite-btn:hover {
    filter: brightness(1.06);
}

/* Process view - Cite modal */
.process-cite-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.45);
}

.process-cite-panel {
    background: var(--white);
    border-radius: 12px;
    max-width: 36rem;
    width: 100%;
    max-height: 90vh;
    overflow: auto;
    box-shadow: var(--shadow-lg);
    padding: 1.25rem 1.5rem;
}

.process-cite-close-row {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.35rem;
}

.process-cite-close {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
}

.process-cite-heading {
    margin: 0 0 0.5rem;
    font-size: 1.25rem;
    color: var(--primary-color);
}

.process-cite-lead {
    margin: 0 0 1rem;
    font-size: 0.92rem;
    line-height: 1.55;
    color: var(--text-color);
}

.process-cite-sub {
    margin: 1rem 0 0.4rem;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.process-cite-pre {
    margin: 0;
    padding: 0.85rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.78rem;
    line-height: 1.45;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.process-cite-actions {
    margin-top: 0.4rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.process-cite-copy {
    background: var(--primary-color);
    color: #fff;
    border: none;
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
}

.process-cite-links {
    margin: 0;
    padding-left: 1.25rem;
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--text-color);
}

.process-cite-links a {
    color: var(--primary-color);
}

/* Graph stats + arXiv frontier (aligned with mathematics process pages) */
.process-statistics {
    margin: 0 0 1.25rem;
    padding: 0.85rem 1.15rem;
    background: linear-gradient(135deg, #f8fafc 0%, #eef2f7 100%);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    border-left: 4px solid var(--primary-color);
    box-shadow: var(--shadow);
}

.process-statistics-title {
    margin: 0 0 0.6rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary-color);
    letter-spacing: 0.02em;
}

.process-statistics-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.35rem 1.25rem;
    margin: 0;
    font-size: 0.9rem;
    align-items: baseline;
}

.process-statistics-grid dt {
    margin: 0;
    font-weight: 600;
    color: var(--text-secondary);
}

.process-statistics-grid dd {
    margin: 0;
    color: var(--text-color);
}

.process-statistics .frontier-link {
    font-weight: 600;
    color: var(--primary-color);
    text-decoration: none;
}

.process-statistics .frontier-link:hover {
    text-decoration: underline;
}

.process-statistics .frontier-hint {
    margin-left: 0.35rem;
    font-size: 0.85em;
    color: var(--text-light);
    font-weight: normal;
}

/* Loading Spinner for Process View */
.diagram-container .loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.diagram-container .loading-spinner .spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--bg-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.diagram-container .loading-spinner p {
    margin-top: 1rem;
    color: var(--text-light);
    font-size: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Comments Section */
.comments-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
}

.comments-title {
    margin: 0 0 1.5rem 0;
    font-size: 1.5rem;
    color: var(--text-color);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.75rem;
}

.comments-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.comment-item {
    padding: 1rem;
    background: var(--bg-color);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.comment-author {
    font-weight: 600;
    color: var(--primary-color);
}

.comment-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--text-light);
    flex-wrap: wrap;
}

.comment-status {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.comment-status.pending {
    background: #fff3cd;
    color: #856404;
}

.comment-status.applied {
    background: #d4edda;
    color: #155724;
}

.comment-status.under_review {
    background: #d1ecf1;
    color: #0c5460;
}

.comment-status.rejected {
    background: #f8d7da;
    color: #721c24;
}

.comment-content {
    margin: 0.75rem 0;
}

.comment-suggestion {
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.comment-rationale {
    font-size: 0.9rem;
    color: var(--text-light);
    font-style: italic;
    margin-top: 0.5rem;
}

.comment-node-ref {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: var(--primary-color);
    color: white;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 600;
    margin-right: 0.5rem;
}

.comment-replies {
    margin-top: 1rem;
    padding-left: 1.5rem;
    border-left: 2px solid var(--border-color);
}

.comment-reply {
    padding: 0.75rem;
    background: var(--white);
    border-radius: 6px;
    margin-top: 0.75rem;
}

.comment-reply-author {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.9rem;
}

.comment-reply-message {
    margin-top: 0.5rem;
    color: var(--text-color);
    font-size: 0.9rem;
}

.comments-loading,
.comments-empty {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
    font-style: italic;
}

.comments-empty {
    padding: 3rem;
}

/* Process Suggestion Modal Chat */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-chat-container {
    background: var(--white);
    border-radius: 12px;
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-chat-header {
    padding: 1.5rem;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--primary-color);
    color: white;
    border-radius: 12px 12px 0 0;
}

.modal-chat-header h3 {
    margin: 0;
    color: white;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    color: white;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 400px;
    max-height: 60vh;
}

.chat-message {
    padding: 1rem;
    border-radius: 8px;
    max-width: 80%;
    word-wrap: break-word;
}

.chat-message.user {
    background: var(--primary-color);
    color: white;
    align-self: flex-end;
    margin-left: auto;
}

.chat-message.bot {
    background: var(--bg-color);
    color: var(--text-color);
    align-self: flex-start;
    border-left: 4px solid var(--primary-color);
}

.chat-message.system {
    background: #fff3cd;
    color: #856404;
    align-self: center;
    text-align: center;
    font-style: italic;
    max-width: 90%;
}

.chat-message.loading {
    background: var(--bg-color);
    color: var(--text-light);
    align-self: flex-start;
    font-style: italic;
}

.chat-input-area {
    padding: 1rem 1.5rem;
    border-top: 2px solid var(--border-color);
    display: flex;
    gap: 0.75rem;
    background: var(--bg-color);
}

.chat-input {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.chat-send-btn {
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.chat-send-btn:hover:not(:disabled) {
    background: var(--primary-dark);
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.approval-buttons {
    padding: 1rem 1.5rem;
    border-top: 2px solid var(--border-color);
    display: flex;
    gap: 1rem;
    justify-content: center;
    background: var(--bg-color);
}

.approval-buttons button {
    flex: 1;
    max-width: 200px;
}

.button-secondary {
    background: var(--text-light);
    color: white;
}

.button-secondary:hover {
    background: #666;
}
