.page-main-outer {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
}

#settings {
  align-items: center;
  display: flex;
  gap: 0.5rem;
}

#nav-control-panel {
  align-items: flex-start;
  border-right: 1px solid var(--bs-border-color);
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 1.5rem;
  overflow: auto;
  padding: 20px 20px 0;
  width: 280px;
}

#left-side {
  background-color: var(--left-side-bg);
  display: flex;
  flex-direction: row;
  height: 100%;
}

#right-side {
  background: var(--right-side-bg);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  overflow: auto;
  padding: 20px;
  width: 100%;
}

#page-header {
  align-items: baseline;
  display: flex;
  flex-direction: row;
  height: 32px;
  justify-content: space-between;
}

#header {
  background-color: var(--left-side-bg);
  display: flex;
  height: 60px;
  justify-content: space-between;
  min-height: 0;
  padding: 0 20px;
}

#header:not(:empty) {
  border-bottom: 1px solid var(--border-subtleAlpha01);
}

#header.no-left {
  justify-content: flex-end;
}

#header-right,
#header-left,
#header-custom {
  align-items: center;
  display: flex;
  gap: 8px;
  height: 100%;
}

#page-components {
  flex: 1;
  overflow: auto;
}

.grid-layout {
  display: grid;
  height: 100%;
  width: 100%;
}

#nav-panel {
  margin-top: -4px;
  width: 100%;
}

#control-panel {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding-bottom: 1.5rem;
  padding-top: 0.5rem;
}

#control-panel:not(:empty) {
  border-bottom: 1px solid var(--border-subtleAlpha01);
}

.dashboard_title {
  display: flex;
  flex-direction: column;
  width: 100%;
}

#nav-bar {
  border-right: 1px solid var(--bs-border-color);
  display: flex;
  justify-content: flex-start;
  width: 60px;
}

#dashboard-container div[hidden] {
  display: none;
}

#page-main {
  display: flex;
  flex: 1 1 0;
  flex-direction: row;
  height: calc(100vh - 64px);
}

#dashboard-title,
#page-title {
  margin: 0;
}

#logo,
#logo-light,
#logo-dark {
  height: 100%;
}

#logo-dark,
#logo-light {
  display: none;
}

[data-bs-theme="dark"] #logo-dark {
  display: inline;
}

[data-bs-theme="light"] #logo-light {
  display: inline;
}

#collapse-icon.material-symbols-outlined {
  background-color: var(--left-side-bg);
  border: 1px solid var(--border-subtleAlpha01);
  border-radius: 50%;
  color: var(--text-disabled);
  cursor: pointer;
  position: absolute;
}

#collapse-icon.material-symbols-outlined:hover {
  color: var(--text-primaryHover);
}

#collapse-icon-outer {
  display: flex;
  justify-content: center;
  padding-top: 22px;
  width: 0;
}

/*
Note: This is a temporary quick-fix to improve the mobile layout experience.
In the long run, we should refactor our CSS and component structure to support proper responsive design.

Current logic:
1. Applies a flex layout with column direction to:
   - Extra-small, small, and medium screen widths (≤ 768px)
   - Large screen widths (≤ 1028px) *only when* the collapsible left panel is open

2. Applies a zoom-out effect for very small screen widths and heights (≤ 576px)
*/

/* Apply flex layout for screens smaller than 768px */
@media screen and (width <= 768px) {
  .grid-layout {
    display: flex;
    flex: 1;
    flex-direction: column;
  }
}

/* Apply flex layout for screens up to 1028px if collapse-left-side is shown */
@media screen and (width <= 1028px) {
  #page-main:has(#collapse-left-side.show) .grid-layout {
    display: flex;
    flex: 1;
    flex-direction: column;
  }
}

/* Apply zoom-out on small screen sizes */
@media screen and (width <= 576px), screen and (height <= 576px) {
  #collapse-icon-outer {
    padding-top: 16px;
  }

  #nav-control-panel {
    padding-top: 16px;
  }

  #nav-bar {
    padding-top: 4px;
  }

  #header,
  #right-side {
    zoom: 80%;
  }
}

/* Apply specific styles for landscape orientation on small screen heights */
@media screen and (height <= 576px) and (orientation: landscape) {
  #nav-control-panel {
    font-size: 12px;
    width: 260px;
  }

  #nav-control-panel .accordion-button,
  #nav-control-panel .form-label,
  #nav-control-panel .form-check-label,
  #nav-control-panel .mantine-DatePickerInput-input,
  #nav-control-panel .slider-text-input-field,
  #nav-control-panel div.Select--multi .Select-value {
    font-size: 12px;
  }

  #nav-control-panel .rc-slider-tooltip-inner,
  #nav-control-panel .rc-slider-mark-text {
    font-size: 10px;
  }

  #nav-control-panel .mantine-DatePickerInput-input {
    min-height: 40px;
  }
}

@media screen and (width <= 576px) and (orientation: portrait) {
  body:has(#collapse-left-side.show) {
    overflow: hidden;
  }

  #nav-control-panel {
    padding-top: 12px;
    width: 280px;
  }

  #collapse-left-side.show:has(#nav-control-panel:not([hidden]))
    ~ #collapse-icon-outer
    #collapse-icon {
    right: -7px;
    z-index: 10;
  }

  #nav-bar {
    padding-top: 0;
  }

  #left-side:has(#nav-control-panel:not([hidden])) {
    height: calc(100vh - 40px);
    position: absolute;
    width: 100vw;
    z-index: 5;
    zoom: 100%;
  }

  /* If #nav-control-panel is NOT hidden, apply this rule */
  #nav-control-panel:not([hidden]) {
    flex: 1;
  }
}

/* Hide Loading... text on loading page */
._dash-loading {
  display: none;
}

.checklist-inline {
  align-items: baseline;
  display: flex;
  flex-direction: row;
  gap: 12px;
}
