/* === MOBILE: SIDEBAR TOGGLE === */
@media (max-width: 768px) {
  #sidebar-toggle {
    padding: 3px 7px;
    margin: 3px;
    display: inline-block;
  }

  /* Sidebar off-canvas */
  #sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 220px;
    transform: translateX(-100%);
    z-index: 9999;
    transition: transform 0.3s ease;
    padding-bottom: 4rem;
    box-sizing: border-box;
  }

  #sidebar.active {
    transform: translateX(0);
  }

  /* Background dim */
  body.sidebar-open::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9998;
  }

  /* Theme selector inside sidebar */
  #sidebar .theme-selector-mobile {
    display: block;
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    min-width: auto;
  }

  /* Header wrapping */
  #header > div:nth-child(2) {
    flex-wrap: wrap;
    gap: 0.5em;
  }

  .title-block {
    flex-direction: column;
    align-items: flex-start;
  }

  .title-block > * {
    margin-bottom: 0.15em;
  }

  .filter-container {
    flex-basis: 100%;
    margin-left: 0;
    margin-bottom: 0.5em;
  }

  .filter-input {
    width: 100%;
  }

  .theme-selector {
    display: none;
  }
}

/* Desktop: hide mobile selector */
@media (min-width: 769px) {
  .theme-selector-mobile {
    display: none;
  }
}
