/* Merge all CSS from the three XSLT files here. */
body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: #fff;
    margin: 0;
    padding: 0 0 40px 0;
    color: #222;
    line-height: 1.7;
}
.header {
    background: #fff;
    border-bottom: 2px solid #e5e5e5;
    padding: 24px 32px 16px 32px;
    margin-bottom: 32px;
}
.title {
    color: #222;
    font-size: 2.1em;
    font-weight: 700;
    margin-bottom: 6px;
}
.subtitle {
    color: #555;
    font-style: italic;
    font-size: 1.1em;
}
.section {
    margin: 12px 0 0 0;
    padding: 0 32px;
}
.section-title {
    color: #222;
    font-size: 1.25em;
    font-weight: 700;
    border-bottom: 1px solid #e5e5e5;
    padding-bottom: 4px;
    margin-bottom: 6px;
    margin-top: 0;
    letter-spacing: 0.01em;
    display: flex;
    align-items: center;
    user-select: none;
}
.section-title.clickable {
    cursor: pointer;
}
.section-title:hover {
    background-color: #f8f9fa;
}
.syntax-icon {
    font-size: 1.1em;
    margin-right: 8px;
}
.syntax-block {
    background: #f5f5f5;
    border: 1px solid #e5e5e5;
    padding: 8px 12px;
    font-family: 'Consolas', 'Menlo', 'Monaco', monospace;
    font-size: 1.08em;
    color: #222;
    overflow-x: auto;
    white-space: pre;
    margin-bottom: 4px;
    margin-top: 0;
}
.param-table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0 24px 0;
}
.param-table th, .param-table td {
    border: 1px solid #e5e5e5;
    padding: 10px 8px;
    text-align: left;
}
.param-table th {
    background: #f5f5f5;
    font-weight: 700;
    color: #222;
}
.param-name {
    font-family: 'Consolas', monospace;
    font-weight: 700;
    color: #1a237e;
}
.example {
    background: #fafbfc;
    border: 1px solid #e5e5e5;
    padding: 10px 14px 8px 14px;
    margin: 10px 0 10px 0;
}
.example-title {
    font-weight: 700;
    color: #222;
    margin-bottom: 7px;
}
.copy-btn {
    background: #1976d2;
    color: #fff;
    border: none;
    padding: 4px 7px 2px 7px;
    font-size: 1.1em;
    border-radius: 3px;
    cursor: pointer;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.copy-btn:hover {
    background: #145ea8;
}
.see-also-link {
    color: #1976d2;
    text-decoration: underline;
    margin-right: 18px;
    font-size: 1em;
}
.see-also-link:hover {
    text-decoration: underline;
    color: #0d47a1;
}
.history-item {
    margin: 5px 0;
}
.version {
    font-weight: 700;
    color: #1976d2;
}
.bibliography-link {
    color: #1976d2;
    text-decoration: underline;
}
.banner-image {
    margin: 0;
    text-align: center;
    padding: 16px 0;
    background-color: #f8f9fa;
    width: 100%;
}
.banner-image img {
    max-width: 90%;
    height: auto;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-radius: 4px;
}
ul.toc-list {
    list-style-type: none;
    padding-left: 20px;
    margin-top: 12px;
    display: block;
}
.toc-entry {
    margin-bottom: 8px;
}
a.toc-link {
    font-weight: 600;
    color: #1976d2;
    text-decoration: none;
    font-size: 1.08em;
}
a.toc-link:hover {
    text-decoration: underline;
    color: #0d47a1;
}
.arrow {
    margin-right: 8px;
    font-size: 1.1em;
    font-weight: bold;
    color: #666;
    transition: transform 0.2s ease;
    width: 16px;
    display: inline-block;
}
ul.toc-list {
    list-style-type: none;
    padding-left: 16px;
    display: block;
    margin-top: 8px;
    margin-bottom: 4px;
}
.toc-entry {
    margin-bottom: 2px;
    line-height: 1.3;
}
a.toc-link {
    font-weight: 500;
    color: #1976d2;
    text-decoration: none;
    font-size: 0.92em;
    padding: 1px 0;
    display: inline-block;
}
a.toc-link:hover {
    text-decoration: underline;
    color: #0d47a1;
}
p {
    margin-top: 4px;
    margin-bottom: 4px;
}
.search-results-body {
    padding: 2em;
    background: #f9f9f9;
}
.search-results-title {
    color: #333;
    margin-top: 0;
}
.home-summary-link {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 1000;
    text-decoration: none;
}
.home-summary-btn {
    background: #1976d2;
    color: #fff;
    border: none;
    padding: 8px 14px;
    font-size: 1.3em;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
}
.home-summary-btn:hover {
    background: #145ea8;
}
.search-results-panel {
    margin-top: 1em;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    padding: 1em;
}
.result-item {
    margin-bottom: 1em;
    padding-bottom: 1em;
    border-bottom: 1px solid #eee;
}
.result-item:last-child {
    border-bottom: none;
}
.keyword-title {
    font-weight: 700;
    color: #222;
}
.keyword-alias {
    font-weight: 400;
    color: #555;
}
/* Help viewer styles */
.help-viewer {
    margin: 0;
    display: flex;
    min-height: 100vh;
    background: #f1f3f5;
}
.help-viewer__sidebar {
    width: clamp(220px, 23vw, 320px);
    min-width: 200px;
    height: 100vh;
    border-right: none;
    background: #fafafa;
    transition: width 0.3s ease, min-width 0.3s ease, transform 0.3s ease, opacity 0.2s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}
.help-viewer__sidebar.collapsed {
    width: 0;
    min-width: 0;
    opacity: 0;
    pointer-events: none;
    border-right: none;
    box-shadow: none;
}
.help-viewer__sidebar iframe {
    flex: 1;
    width: 100%;
    border: none;
}
.help-viewer__main {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: #fff;
}
.help-viewer__toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #d0d7de;
    background: linear-gradient(90deg, #ffffff 0%, #f6f8fa 100%);
    position: sticky;
    top: 0;
    z-index: 10;
}
.help-viewer__toggle {
    width: 40px;
    height: 40px;
    border: 1px solid #c9d1d9;
    border-radius: 8px;
    background: #fff;
    color: #1f2933;
    font-size: 1.2em;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.help-viewer__toggle:hover,
.help-viewer__toggle:focus-visible {
    background: #f0f6ff;
    border-color: #84b5ff;
    box-shadow: 0 0 0 3px rgba(132, 181, 255, 0.35);
}
.help-viewer__search {
    margin-left: auto;
    display: flex;
    align-items: center;
}
.help-viewer__search-input {
    width: clamp(180px, 26vw, 280px);
    padding: 8px 10px;
    border: 1px solid #c9d1d9;
    border-right: none;
    border-radius: 6px 0 0 6px;
    font-size: 0.95em;
    outline: none;
    background: #ffffff;
}
.help-viewer__search-input:focus {
    border-color: #84b5ff;
    box-shadow: 0 0 0 3px rgba(132, 181, 255, 0.35);
}
.help-viewer__search-btn {
    padding: 8px 16px;
    border: 1px solid #1d6fd8;
    background: #1d6fd8;
    color: #fff;
    border-radius: 0 6px 6px 0;
    font-size: 0.95em;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}
.help-viewer__search-btn:hover,
.help-viewer__search-btn:focus-visible {
    background: #1558ad;
    border-color: #1558ad;
}
.help-viewer__content {
    flex: 1;
    width: 100%;
    border: none;
    display: block;
    background: #fff;
}
@media (max-width: 960px) {
    .help-viewer {
        position: relative;
        flex-direction: column;
    }
    .help-viewer__sidebar {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        width: min(80vw, 320px);
        max-width: 320px;
        box-shadow: 4px 0 18px rgba(15, 23, 42, 0.18);
        z-index: 20;
        opacity: 1;
        pointer-events: auto;
    }
    .help-viewer__sidebar.collapsed {
        transform: translateX(-100%);
        width: min(80vw, 320px);
        opacity: 0;
    }
    .help-viewer__main {
        height: 100vh;
    }
    .help-viewer__toolbar {
        background: linear-gradient(90deg, #ffffff 0%, #f0f4f8 100%);
    }
}
@media (max-width: 540px) {
    .help-viewer__toolbar {
        flex-wrap: wrap;
        gap: 8px;
    }
    .help-viewer__search {
        width: 100%;
    }
    .help-viewer__search-input {
        flex: 1;
        width: 100%;
        border-right: 1px solid #c9d1d9;
        border-radius: 6px 6px 0 0;
    }
    .help-viewer__search-btn {
        width: 100%;
        border-radius: 0 0 6px 6px;
    }
}
/* Dark theme overrides */
@media (prefers-color-scheme: dark) {
    body {
        background: #181a1b;
        color: #e0e0e0;
    }
    .header {
        background: #181a1b;
        border-bottom: 2px solid #333;
    }
    .title {
        color: #fff;
    }
    .subtitle {
        color: #b0b0b0;
    }
    .section {
        background: none;
    }
    .section-title {
        color: #fff;
        border-bottom: 1px solid #333;
    }
    .section-title:hover {
        background-color: #2a2d2e;
    }
    .syntax-block {
        background: #23272e;
        border: 1px solid #333;
        color: #e0e0e0;
    }
    .param-table th, .param-table td {
        border: 1px solid #333;
    }
    .param-table th {
        background: #23272e;
        color: #fff;
    }
    .param-name {
        color: #90caf9;
    }
    .example {
        background: #23272e;
        border: 1px solid #333;
        color: #e0e0e0;
    }
    .example-title {
        color: #fff;
    }
    .copy-btn {
        background: #1565c0;
        color: #fff;
    }
    .copy-btn:hover {
        background: #0d47a1;
    }
    .see-also-link {
        color: #90caf9;
    }
    .see-also-link:hover {
        color: #42a5f5;
    }
    .version {
        color: #90caf9;
    }
    .bibliography-link {
        color: #90caf9;
    }
    .arrow {
        color: #ccc;
    }
    a.toc-link {
        color: #90caf9;
    }
    a.toc-link:hover {
        color: #42a5f5;
    }
    .banner-image img {
        box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    }
    .brief-description {
        background: #252729;
        color: #e0e0e0;
        border-left: 4px solid #42a5f5;
        box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    }
    .search-results-body {
        background: #181a1b;
    }
    .search-results-title {
        color: #fff;
    }
    .home-summary-btn {
        background: #1565c0;
    }
    .home-summary-btn:hover {
        background: #0d47a1;
    }
    .search-results-panel {
        background: #23272e;
        box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    }
    .result-item {
        border-bottom: 1px solid #333;
    }
    .result-item:last-child {
        border-bottom: none;
    }
    .keyword-title {
        color: #fff;
    }
    .keyword-alias {
        color: #b0b0b0;
    }
    .help-viewer {
        background: #181a1b;
    }
    .help-viewer__main {
        background: #1f2123;
    }
    .help-viewer__sidebar {
        background: #1f2123;
        border-right: none;
        box-shadow: none;
    }
    .help-viewer__toolbar {
        background: linear-gradient(90deg, #1f2123 0%, #24272b 100%);
        border-bottom: 1px solid #333;
    }
    .help-viewer__toggle {
        background: #2a2d31;
        border-color: #3a3d41;
        color: #e0e0e0;
    }
    .help-viewer__toggle:hover,
    .help-viewer__toggle:focus-visible {
        background: #31363a;
        border-color: #4a90e2;
        box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.35);
    }
    .help-viewer__search-input {
        background: #26292d;
        border-color: #3a3d41;
        color: #e0e0e0;
    }
    .help-viewer__search-btn {
        background: #1565c0;
        border-color: #1565c0;
    }
    .help-viewer__search-btn:hover,
    .help-viewer__search-btn:focus-visible {
        background: #0d47a1;
        border-color: #0d47a1;
    }
    .help-viewer__content {
        background: #1f2123;
    }

    /* Ensure syntax sections and examples follow dark theme and override highlight.css if needed */
    .syntax-section .section-title {
        color: #ffffff;
        border-bottom: 1px solid #333;
        background: none;
    }

    .syntax-section .subtitle {
        color: #b0b0b0;
    }

    /* Force code/pre blocks used for syntax and examples to dark background and light text */
    .syntax-block,
    .syntax-section .syntax-block,
    .example .syntax-block,
    pre.syntax-block,
    pre.syntax-block code,
    code.language-matlab {
        background-color: #1b1f23 !important;
        border: 1px solid #333 !important;
        color: #e6edf3 !important;
    }

    /* Make inline code inside syntax blocks readable */
    .syntax-block code,
    .example .syntax-block code {
        color: #e6edf3 !important;
    }

    /* Copy button contrast on dark background */
    .copy-btn {
        background: #1565c0;
        color: #fff;
    }
    .copy-btn:hover {
        background: #0d47a1;
    }

    /* Small tweak for example container contrast */
    .example {
        background: #23272e;
        border: 1px solid #333;
        color: #e0e0e0;
    }
}
