.tooltip-auto-width .tooltip-inner {
    max-width: none;
    white-space: nowrap;
}

#main-menu {
    margin-right: 16px;
    position: sticky;
    top: 72px;
    align-self: flex-start;
    height: calc(100vh - 72px);
    overflow-y: auto;
    scrollbar-width: none;
}

#main-menu .scroll-indicator {
    position: sticky;
    bottom: -1rem;
    margin: auto 0 -1rem;
    padding: 10px 0 calc(6px + 1rem);
    text-align: center;
    pointer-events: none;
    color: rgba(255, 255, 255, 0.7);
    background: linear-gradient(to bottom, rgba(33, 37, 41, 0) 0%, rgba(33, 37, 41, 0.95) 70%);
    transition: opacity 0.2s ease;
    font-size: 0.9rem;
    line-height: 1;
}

#main-menu.at-bottom .scroll-indicator {
    opacity: 0;
}

@keyframes sidebar-scroll-hint {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(3px); }
}

#main-menu .scroll-indicator .bi {
    display: inline-block;
}

/* Bounce the scroll hint only as a brief, finite one-shot, not forever: this chevron sits inside
   a position:sticky element within an overflow:auto scroll container, which forces WebRender to
   composite the transform animation on the main thread every frame — a continuous infinite
   animation there costs several % CPU permanently. A finite count plays on load (and replays
   whenever the menu returns to a scrollable, not-at-bottom state) then settles static at ~0 cost. */
#main-menu:not(.at-bottom) .scroll-indicator .bi {
    animation: sidebar-scroll-hint 1.6s ease-in-out 5;
}

@media (prefers-reduced-motion: reduce) {
    #main-menu .scroll-indicator .bi {
        animation: none;
    }
}

#main-menu .nav-item li {
    display: flex;
    align-items: center;
}

#main-menu a.nav-link {
    padding: 4px 8px;
    margin: 1px 0;
    border-radius: 8px;
    color: #fff !important;
    white-space: nowrap;
}

#main-menu a.nav-link:hover, #main-menu a.nav-link-active {
    background: var(--bs-success);
}

#main-menu a.nav-link:hover .bi, #main-menu a.nav-link-active .bi {
    color: #fff !important;
}

[data-bs-toggle="collapse"][aria-expanded="false"] .collapse-header::after {
    content: "▾";
    margin-left: 5px;
}

[data-bs-toggle="collapse"][aria-expanded="true"] .collapse-header::after {
    content: "▴";
    margin-left: 5px;
}

#main-menu-toggle {
    position: absolute;
    right: 0;
    top: calc(50vh - 100px);
    height: 50px;
    color: #fff;
    background: var(--bs-dark);
    width: 16px;
    display: flex;
    align-items: center;
    padding-bottom: 3px;
}

#main-menu-toggle[data-bs-toggle="collapse"][aria-expanded="false"]::after {
    content: "›";
}

#main-menu-toggle[data-bs-toggle="collapse"][aria-expanded="true"]::after {
    content: "‹";
}

.fade-out {
    animation: fadeOut 1s ease-in 2s forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        visibility: hidden;
    }
}

.offcanvas-w50 {
    width: 50vw !important;
}

.offcanvas-notch {
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1046;
    padding: 1rem 0.6rem;
    margin-right: 0;
    visibility: visible;
}

.offcanvas-notch:hover {
    padding-right: 0.75rem;
}

.offcanvas .offcanvas-notch::after {
    content: "‹";
}

.offcanvas.show .offcanvas-notch::after {
    content: "›";
}

#logo-container {
    width: 266px;
    margin: 0 0 0 4px;
}

nav.top-nav .breadcrumb-item a {
    text-decoration: none;
    border-bottom: 3px dotted var(--bs-success);
}

.top-bar-container {
    height: 72px;
}

.top-bar-container .navbar {
    height: 72px;
}

.path-select-step {
    max-width: 200px;
}

.word-wrap-normal {
    word-wrap: normal;
}

.ellipsis {
    overflow: hidden;
    text-overflow: ellipsis;
}

.dots-menu-button i {
    width: 32px;
    height: 32px;
    color: var(--bs-gray-600);
    display: flex;
    align-items: center;
    justify-content: center;
}

.dots-menu-button > i:hover {
    border: 1px solid var(--bs-gray-400);
    border-radius: 100%;
}

.text-sm {
    font-size: 0.9em;
    display: inherit;
}

.text-xs {
    font-size: 0.8em;
    display: inherit;
    line-height: 1.5em;
}

/* actual tabs, stickily attached to the top of a card */
.card-header-tabs li button.nav-link {
    border-bottom: 0;
}

/* round-edged buttons "floating" on top over a card */
.card-header-tabs li button.nav-link.rounded {
    border-radius: var(--bs-border-radius) !important;
    border: 1px solid #C3CBD2;
}

.info-card h5 {
    margin: 0;
}

.info-card h5 svg {
    margin-top: -1px;
}

.info-card .card-body {
    font-size: 0.9em;
    padding: 0.75em 0.9em;
}

.info-card .card-header {
    display: flex;
    cursor: pointer;
}

.info-card .card-header .bi-chevron-down {
    display: none !important;
}

.info-card .card-header .bi-chevron-up {
    display: inline-block !important;
}

.info-card .card-header.collapsed .bi-chevron-down {
    display: inline-block !important;
}

.info-card .card-header.collapsed .bi-chevron-up {
    display: none !important;
}

.no-decoration {
    text-decoration: none;
}

/* table of two columns, each consisting of two columns internally */
.table-split-2 td:nth-child(2) {
    padding-right: 28px;
}

.stats-table td, .stats-table th {
    padding: 4px 12px 4px 0;
}

button[type="submit"].htmx-request {
    opacity: 0.5;
    pointer-events: none;
    cursor: default;
}

.htmx-request span.spinner-border {
    display: inline-block !important;
}

.live-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    animation: pulse 2s infinite;
    background-color: var(--bs-secondary);
}

.live-indicator + span {
    font-weight: 500;
    color: var(--bs-secondary-text-emphasis);
}

.live-indicator.success {
    background-color: var(--bs-success);
}

.live-indicator.warning {
    background-color: var(--bs-warning);
}

.live-indicator.danger {
    background-color: var(--bs-danger);
}

.live-indicator.nopulse {
    animation: none;
}

@keyframes pulse {
    0% {
        opacity: 0.5;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0.5;
    }
}

/* Witty rotating loading messages (long-running plot generation).
   The PTZ logo loader is built from HTML bars (not animated SVG paths) so the opacity
   pulse is GPU-composited rather than repainted on the main thread every frame. */
.ptz-loader {
    display: inline-flex;
    align-items: flex-end;
    gap: 0.17em;
    height: 1.5em;
    vertical-align: middle;
}

.ptz-loader .ptzbar {
    width: 0.14em;
    background-color: #002060;
    border-radius: 0.07em;
    opacity: 0.25;
    animation: ptzpulse 2s ease-in-out infinite;
}

.ptz-loader .b1 {
    height: 100%;
}

.ptz-loader .b2 {
    height: 61%;
    animation-delay: 0.2s;
}

.ptz-loader .b3 {
    height: 37%;
    animation-delay: 0.4s;
}

.ptz-loader .b4 {
    height: 22%;
    animation-delay: 0.6s;
}

.ptz-loader .b5 {
    height: 12%;
    animation-delay: 0.8s;
}

@keyframes ptzpulse {
    0%, 70%, 100% {
        opacity: 0.25;
    }
    20%, 45% {
        opacity: 1;
    }
}

/* Respect reduced-motion: show a static logo instead of the pulsing animation */
@media (prefers-reduced-motion: reduce) {
    .ptz-loader .ptzbar {
        animation: none;
        opacity: 1;
    }
}

.witty-spinner-message {
    transition: opacity 0.35s ease;
}

.witty-spinner-message.fading {
    opacity: 0;
}

#alert-messages li {
    list-style: inside;
}

#alert-messages li a {
    color: inherit;
}

.menu-section {
    padding: 0 1rem;
}

.menu-section div:nth-child(1) {
    margin-bottom: 12px;
    cursor: pointer;
    padding: 8px 12px;
}

.menu-section div h5 {
    display: inline;
    margin: 0;
}

.menu-section div.collapsed .bi-chevron-down {
    display: inline-block !important;
}

.menu-section div.collapsed .bi-chevron-up {
    display: none !important;
}

[hidden="true"] {
    display: none !important;
}

.pointer {
    cursor: pointer;
}

/* Data catalog-specific CSS */
.htmx-request .htmx-content-container > *:not(.loading-spinner),
.htmx-content-container.htmx-request > *:not(.loading-spinner) {
    display: none;
}

.loading-spinner {
    display: none !important;
}

.htmx-request .htmx-content-container .loading-spinner,
.htmx-content-container.htmx-request .loading-spinner {
    display: flex !important;
}

.hover-danger:hover {
    color: var(--bs-danger) !important;
}

.hover-body:hover {
    color: var(--bs-body-color) !important;
}

.btn-no-border {
    border: none !important;
}

*:has(> .hide-parent) {
    display: none;
}

.selection-form label {
    font-weight: 500;
}

.badge-heat {
    color: #212529;
    background-color: #f7b6d2;
}

.badge-electric-power {
    color: #212529;
    background-color: #c7c7c7;
}

.badge-fuel {
    color: #212529;
    background-color: #9edae5;
}

.btn-schema-button:not(:hover) {
    background: #fff;
    color: var(--bs-btn-color);
}

.popover {
    --bs-popover-max-width: 400px;
}
