/* ========================================
   Synapse Documentation - Unified Styles
   ======================================== */

:root {
    /* IBM Carbon Design System Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f4f4f4;
    --bg-code: #e0e0e0;
    --text-primary: #161616;
    --text-secondary: #525252;
    --text-muted: #8d8d8d;
    --border-color: #e0e0e0;
    --accent-primary: #00758f;
    --accent-secondary: #004d6b;
    --link-color: #00758f;
    --link-hover: #004d6b;
    --shadow: rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* No rounded corners across the site — but DO NOT affect embedded UXL.
   UXL rounding is defined by uxl.css + inline styles in uxl.js. */
*:not(.uxl-root):not(.uxl-root *) {
    border-radius: 0 !important;
}

body {
    font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-primary);
    transition: background 0.3s ease, color 0.3s ease;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    color: white;
    padding: 20px 0;
    box-shadow: 0 2px 10px var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 1.8em;
    font-weight: 600;
}

.header h1 a {
    color: white;
    text-decoration: none;
}

.header-nav {
    display: flex;
    gap: 20px;
    align-items: center;
}

.header-nav a {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    transition: background 0.3s ease;
}

.header-nav a:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Breadcrumbs */
.breadcrumbs {
    max-width: 1400px;
    margin: 20px auto;
    padding: 0 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    color: var(--text-secondary);
    font-size: 0.9em;
}

.breadcrumbs a {
    color: var(--link-color);
    text-decoration: none;
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

.breadcrumbs span {
    color: var(--text-muted);
}

/* Main Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 30px;
}

/* Sidebar */
.sidebar {
    padding: 20px;
    padding-bottom: 100px; /* Extra large bottom padding to ensure all items including last ones are visible */
    width: 300px;
    position: sticky;
    top: 90px;
    max-height: calc(100vh - 110px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

/* Hide scrollbar for sidebar (Chrome, Safari) */
.sidebar::-webkit-scrollbar {
    display: none;
}

.sidebar[style*="display: none"] ~ .content {
    grid-column: 1 / -1;
}

.sidebar h3 {
    color: var(--accent-primary);
    margin-bottom: 15px;
    font-size: 1em;
}

.sidebar ul {
    list-style: none;
}

.sidebar ul li {
    margin: 5px 0;
}

.sidebar ul li a {
    color: var(--text-primary);
    text-decoration: none;
    display: block;
    padding: 5px 10px;
    transition: background 0.3s ease;
}

.sidebar ul li a:hover {
    background: var(--bg-primary);
}

.sidebar ul li.active a {
    background: var(--accent-primary);
    color: white;
}

/* Content */
.content {
    padding: 0;
    max-width: 100%;
    overflow-x: hidden;
    word-wrap: break-word;
}

.content h2 {
    color: #555555;
    font-size: 1.8em;
    margin: 30px 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    scroll-margin-top: 100px;
}

.content h3 {
    color: var(--accent-secondary);
    font-size: 1.35em;
    margin: 25px 0 12px 0;
    scroll-margin-top: 100px;
    clear: both;
}

.content h4 {
    color: var(--text-primary);
    font-size: 1.08em;
    margin: 20px 0 10px 0;
}

.content p {
    margin: 15px 0;
    line-height: 1.5;
}

.content ul, .content ol {
    margin: 15px 0;
    padding-left: 30px;
}

.content li {
    margin: 8px 0;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.content li code {
    word-break: break-all;
    overflow-wrap: anywhere;
}

.content a {
    color: var(--link-color);
    text-decoration: none;
    border-bottom: 1px dotted var(--link-color);
}

.content a:hover {
    color: var(--link-hover);
    border-bottom: 1px solid var(--link-hover);
}

/* Scroll-to-top button */
.scroll-to-top {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-primary);
    color: white;
    border: none;
    cursor: pointer;
    z-index: 2000;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
    font-size: 22px;
    line-height: 1;
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.scroll-to-top:hover {
    background: var(--accent-secondary);
}

.scroll-to-top.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

@media (max-width: 768px) {
    .scroll-to-top {
        right: 14px;
        bottom: 14px;
        width: 42px;
        height: 42px;
    }
}

/* Code Blocks */
.content code {
    background: var(--bg-code);
    padding: 2px 6px;
    font-family: 'Courier New', Consolas, monospace;
    font-size: 0.9em;
    color: var(--accent-secondary);
    word-break: break-all !important;
    overflow-wrap: anywhere !important;
    white-space: pre-wrap !important;
    max-width: 100%;
}

.content pre {
    background: var(--bg-code);
    padding: 20px;
    overflow-x: auto;
    margin: 20px 0;
    border-left: 4px solid var(--accent-primary);
    max-width: 100%;
}

.content pre code {
    background: none;
    padding: 0;
    color: var(--text-primary);
    word-break: normal;
    overflow-wrap: normal;
    white-space: pre;
}

/* Tables */
.content table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: var(--bg-primary);
    overflow: hidden;
}

.content th {
    background: var(--accent-primary);
    color: white;
    padding: 12px;
    text-align: left;
    font-weight: 600;
}

.content td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

.content tr:hover {
    background: var(--bg-secondary);
}

/* Blockquotes */
.content blockquote {
    border-left: 4px solid var(--accent-primary);
    padding: 15px 20px;
    margin: 20px 0;
    background: var(--bg-primary);
    font-style: italic;
    color: var(--text-secondary);
}

/* Info Box */
.info-box {
    background: var(--bg-primary);
    border-left: 4px solid var(--accent-primary);
    padding: 20px;
    margin: 20px 0;
}

.info-box h3 {
    color: var(--accent-primary);
    margin-top: 0;
}

/* Prototype Frames (Phone Screens) */
.prototype-frame {
    border: 1px solid #1a1a1a;
    border-radius: 16px !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    margin: 0 20px 20px 0;
    float: left;
    display: block;
    background: #000;
    overflow: hidden !important;
    -webkit-border-radius: 16px !important;
    -moz-border-radius: 16px !important;
    clip-path: inset(0 round 16px);
}

.prototype-frame::-webkit-scrollbar {
    display: none;
}

/* Mermaid Diagrams */
.mermaid {
    background: var(--bg-primary);
    padding: 20px;
    margin: 20px 0;
    display: flex;
    justify-content: center;
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
}

.mermaid *,
.mermaid svg,
.mermaid svg * {
    outline: none !important;
    -webkit-tap-highlight-color: transparent !important;
    box-shadow: none !important;
}

.mermaid:focus,
.mermaid:active,
.mermaid svg:focus,
.mermaid svg:active {
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
}

.mermaid svg {
    filter: none !important;
    box-shadow: none !important;
}


/* Footer */
.footer {
    max-width: 1400px;
    margin: 40px auto 20px;
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
}

.footer a {
    color: var(--link-color);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* Source Link */
.source-link {
    display: inline-block;
    margin: 20px 0;
    padding: 10px 20px;
    background: var(--bg-primary);
    border: 2px solid var(--accent-primary);
    color: var(--accent-primary);
    text-decoration: none;
    transition: all 0.3s ease;
}

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

/* Responsive */
/* Desktop - keep header sticky */
@media (min-width: 769px) {
    .header {
        position: sticky !important;
        top: 0;
    }
}

@media (max-width: 768px) {
    body {
        line-height: 1.3;
    }
    
    .content p {
        line-height: 1.3;
    }
    
    .content li {
        line-height: 1.3;
        word-break: break-word;
        overflow-wrap: break-word;
    }
    
    .content li code,
    .content p code,
    .content code {
        word-break: break-all !important;
        overflow-wrap: anywhere !important;
        white-space: pre-wrap !important;
        max-width: 100% !important;
    }
    
    .container {
        grid-template-columns: 1fr;
        padding: 0 20px 40px 20px !important;
    }
    
    .main-container {
        padding: 20px 20px 40px 20px !important;
    }
    
    .page-title-container {
        padding: 20px 20px 10px 20px !important;
    }
    
    .logo-bar-container {
        padding: 0 10px !important;
    }
    
    .sidebar {
        position: static;
        padding: 20px;
        max-height: none !important;
        overflow-y: visible !important;
    }
    
    .content {
        padding: 0;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .header {
        position: relative;
    }
    
    .header-container {
        padding: 0 10px !important;
    }
    
    .header-nav {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    /* Mindmap mobile styles */
    #mindmap-diagram {
        margin: 20px 0 !important;
    }
}

