/*
 * SPDX-FileCopyrightText: Copyright (c) <2025> NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 *
 * SPDX-License-Identifier: Apache-2.0
 */

/* Dark/Light Mode Image Switching */

/* Hide dark images in light mode */
html[data-theme="light"] .only-dark {
  display: none !important;
}

/* Hide light images in dark mode */
html[data-theme="dark"] .only-light {
  display: none !important;
}

/* Add compact table styling */
table.compact-table {
    border-collapse: collapse;
    margin-bottom: 1em;
}

table.compact-table td,
table.compact-table th {
    padding: 2px 4px !important;  /* Minimal padding */
    font-size: 0.9em;
}

table.compact-table th {
    font-weight: bold;
}

/* No extra space between cells */
table.compact-table,
table.compact-table th,
table.compact-table td {
    border-spacing: 0;
}

/* Custom styling for the global TOC sidebar */
.bd-toc-item li.toctree-l1 {
    position: relative;
    margin-bottom: 0.3rem;
    padding: 0.15rem 2rem 0.15rem 0.75rem;
    border-radius: 0.25rem;
}

/* Style for the link in each TOC item */
.bd-toc-item li.toctree-l1 > a {
    display: block;
    color: var(--pst-color-text-base);
    text-decoration: none;
    width: calc(100% - 2rem); /* Leave space for the toggle button */
    padding-left: 0.4rem;
}

/* Style for TOC items when collapsed */
.bd-toc-item li.toctree-l1:not(.current) > ul {
    display: none;
}

/* Style for TOC items when expanded */
.bd-toc-item li.toctree-l1.current > ul {
    display: block;
    margin-top: 0.5rem;
    padding-left: 1.25rem;
}

/* Highlight the active page */
.bd-toc-item li.toctree-l1.active > a {
    font-weight: bold;
    color: var(--pst-color-primary);
}

/* Style for level 2 items */
.bd-toc-item li.toctree-l2 {
    padding: 0.1rem 0.5rem;
    margin-bottom: 0.1rem;
    font-size: 0.95em;
}

.bd-toc-item li.toctree-l2 > a {
    color: var(--pst-color-text-base);
    text-decoration: none;
}

/* Hover effect for TOC items */
.bd-toc-item li.toctree-l1:hover {
    background-color: var(--pst-color-background-hover);
}

/* Remove default list styling */
.bd-toc-item ul {
    list-style-type: none;
    padding-left: 0;
    margin: 0;
}

/* Global TOC styling to match NVIDIA theme */
.bd-links {
    overflow-y: auto;
    max-height: calc(100vh - 13rem);
}

.bd-links__title {
    font-size: 1rem;
    font-weight: 600;
    margin: 1rem 0 0.5rem 0;
    color: var(--pst-color-text-base);
}

/* Toctree list items structure */
.bd-toc-item .toctree-l1 {
    position: relative;  /* For absolute positioning of the expand icon */
    margin-bottom: 0.25rem;
    font-size: 1rem;
    padding-right: 1.5rem;  /* Space for the icon */
}

.bd-toc-item .toctree-l1 > a {
    display: block;
    padding: 0.25rem 0;
    font-weight: 500;
    text-decoration: none;
    color: var(--pst-color-text-base);
}

.bd-toc-item .toctree-l1.current > a {
    font-weight: 600;
    color: var(--pst-color-primary);
}

.bd-toc-item .toctree-l1 > a:hover {
    color: var(--pst-color-primary);
    text-decoration: none;
}

.bd-toc-item .toctree-l2 {
    margin-bottom: 0.125rem;
    font-size: 0.95rem;
}

.bd-toc-item .toctree-l2 > a {
    display: block;
    padding: 0.125rem 0;
    text-decoration: none;
    color: var(--pst-color-text-base);
}

.bd-toc-item .toctree-l2 > a:hover {
    color: var(--pst-color-primary);
    text-decoration: none;
}

/* Arrow styling for the TOC toggle buttons */
.arrow-icon {
  display: inline-block;
  font-size: 0.8rem;
  transition: transform 0.2s;
}

/* Positioning and styling for the toggle button */
.toc-toggle-btn {
  position: absolute;
  right: 0.5rem;
  top: 0.15rem;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Special styling for the chevron arrows */
.expander {
    font-size: 0.7rem;
    transition: transform 0.15s ease;
}

.toctree-l1.expanded > .toc-toggle-btn .expander,
.toctree-l1.current > .toc-toggle-btn .expander {
    transform: rotate(90deg);
    color: var(--pst-color-primary);
}
