/* BioSim CZ Architecture Documentation Styles */

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    color: #333;
    background: #fff;
}

.page-layout {
    display: flex;
    gap: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem 2rem;
    align-items: flex-start;
}

.sidebar-nav {
    width: 280px;
    flex-shrink: 0;
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 1rem;
    font-size: 0.9rem;
    box-sizing: border-box;
}

.sidebar-nav h2 {
    margin-top: 0;
    margin-bottom: 0.8rem;
    font-size: 1rem;
    color: #2c3e50;
    border-bottom: none;
    padding-bottom: 0;
}

.sidebar-nav ul {
    list-style: none;
    padding-left: 0.8rem;
    margin: 0;
}

.sidebar-nav > ul {
    padding-left: 0;
}

.sidebar-nav li {
    margin: 0.15rem 0;
}

.sidebar-nav a {
    display: block;
    padding: 0.15rem 0;
    color: #555;
    text-decoration: none;
    border-radius: 3px;
}

.sidebar-nav a:hover {
    color: #3498db;
    background: #eef5fc;
}

.sidebar-nav a .header-section-number {
    color: #888;
    font-weight: 600;
    margin-right: 0.3rem;
}

.main-content {
    flex: 1;
    min-width: 0;
    max-width: 1050px;
    overflow-wrap: break-word;
}

.toc-toggle {
    display: none;
    width: 100%;
    margin-bottom: 1rem;
    padding: 0.6rem 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: #2c3e50;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    text-align: left;
}

.toc-toggle:hover {
    background: #eef5fc;
    border-color: #3498db;
}

@media (max-width: 960px) {
    .page-layout {
        flex-direction: column;
        padding: 1rem;
        gap: 1rem;
    }

    .sidebar-nav {
        display: none;
        position: relative;
        width: 100%;
        max-height: 60vh;
        top: 0;
        margin-bottom: 1rem;
    }

    .sidebar-nav.is-open {
        display: block;
    }

    .main-content {
        max-width: none;
    }

    .toc-toggle {
        display: block;
    }
}

@media (max-width: 600px) {
    .page-layout {
        padding: 0.5rem;
    }

    h1 {
        font-size: 1.6rem;
    }

    h2 {
        font-size: 1.3rem;
    }
}

h1, h2, h3, h4, h5, h6 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: #2c3e50;
}

h1 {
    border-bottom: 2px solid #3498db;
    padding-bottom: 0.5rem;
}

h2 {
    border-bottom: 1px solid #bdc3c7;
    padding-bottom: 0.3rem;
}



table {
    border-collapse: collapse;
    width: 100%;
    margin: 1rem 0;
}

th, td {
    border: 1px solid #dee2e6;
    padding: 0.5rem 1rem;
    text-align: left;
}

th {
    background: #f1f3f5;
    font-weight: 600;
}

tr:nth-child(even) {
    background: #f8f9fa;
}

tr:hover {
    background: #e9ecef;
}

code {
    background: #f1f3f5;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.9em;
}

pre {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 1rem;
    overflow-x: auto;
}

pre code {
    background: none;
    padding: 0;
}

a {
    color: #3498db;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

a.yaml-link {
    color: #d35400;
    cursor: pointer;
    font-weight: 500;
}

a.yaml-link:hover {
    color: #e67e22;
    text-decoration: underline;
}

blockquote {
    border-left: 4px solid #3498db;
    margin: 1rem 0;
    padding-left: 1rem;
    color: #666;
}

.yaml-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    backdrop-filter: blur(2px);
}

.yaml-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 85%;
    max-width: 1000px;
    max-height: 85vh;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 1001;
    overflow: hidden;
}

.yaml-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: #2c3e50;
    color: #fff;
}

.yaml-modal-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

.yaml-modal-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.yaml-modal-close:hover {
    opacity: 1;
}

.yaml-modal-content {
    padding: 0;
    max-height: calc(85vh - 60px);
    overflow: auto;
    background: #f8f9fa;
}

.yaml-modal-content pre {
    margin: 0;
    padding: 1.5rem;
    border: none;
    border-radius: 0;
    background: #f8f9fa;
}

.yaml-modal-content code {
    display: block;
    font-size: 0.85rem;
    line-height: 1.5;
    white-space: pre;
}

.token.yaml-key,
.token.property {
    color: #0066cc;
    font-weight: 600;
}

.token.yaml-string,
.token.string {
    color: #008000;
}

.token.yaml-number,
.token.number {
    color: #ff6600;
}

.token.yaml-comment,
.token.comment {
    color: #998;
    font-style: italic;
}

.token.yaml-boolean,
.token.boolean {
    color: #e67e22;
}

.token.yaml-anchor,
.token.anchor,
.token.yaml-alias,
.token.alias,
.token.yaml-tag,
.token.tag {
    color: #905;
}

.main-content img,
.main-content figure img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1rem auto;
    cursor: zoom-in;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
    border-radius: 6px;
}

.main-content img:hover,
.main-content figure img:hover {
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
}

.mermaid {
    margin: 1.5rem 0;
    padding: 1rem;
    text-align: center;
    background: #fff;
    border: 1px solid #cfe3a7;
    border-radius: 10px;
    overflow-x: auto;
}

.mermaid svg {
    max-width: 100%;
    height: auto;
}

.mermaid-clickable {
    cursor: zoom-in;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.mermaid-clickable:hover,
.mermaid-clickable:focus {
    box-shadow: 0 4px 18px rgba(143, 167, 122, 0.28);
    outline: none;
    transform: translateY(-1px);
}

.mermaid-error {
    text-align: left;
    white-space: pre-wrap;
    color: #8a1f11;
    background: #fff5f5;
    border-color: #f5c2c7;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

.diagram-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.65);
    z-index: 1100;
    backdrop-filter: blur(2px);
}

.diagram-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 92vw;
    height: 88vh;
    max-width: 1400px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
    z-index: 1101;
    overflow: hidden;
}

.diagram-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.25rem;
    background: #2c3e50;
    color: #fff;
}

.diagram-modal-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.diagram-modal-controls {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.diagram-modal-controls button {
    min-width: 2.2rem;
    padding: 0.35rem 0.65rem;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
    font: inherit;
    line-height: 1.1;
}

.diagram-modal-controls button:hover {
    background: rgba(255, 255, 255, 0.22);
}

.diagram-modal-close {
    font-size: 1.35rem;
}

.diagram-modal-help {
    padding: 0.45rem 1.25rem;
    color: #555;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    font-size: 0.9rem;
}

.diagram-modal-viewport {
    width: 100%;
    height: calc(88vh - 101px);
    overflow: hidden;
    background:
        linear-gradient(45deg, #f8f9fa 25%, transparent 25%),
        linear-gradient(-45deg, #f8f9fa 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #f8f9fa 75%),
        linear-gradient(-45deg, transparent 75%, #f8f9fa 75%);
    background-size: 24px 24px;
    background-position: 0 0, 0 12px, 12px -12px, -12px 0;
}

.diagram-modal-svg {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    cursor: grab;
    user-select: none;
    touch-action: none;
}

.diagram-modal-svg.is-panning {
    cursor: grabbing;
}

.img-lightbox-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    z-index: 1200;
    backdrop-filter: blur(2px);
}

.img-lightbox {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1201;
    max-width: 95vw;
    max-height: 90vh;
    align-items: center;
    justify-content: center;
}

.img-lightbox img {
    max-width: 95vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    cursor: default;
}

.img-lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.85;
    transition: opacity 0.2s;
}

.img-lightbox-close:hover {
    opacity: 1;
}
