/* Section sidebar.
 *
 * Same rule as base.css: every colour is a custom property emitted from
 * config/styles.py, so this cannot drift from the Reflex app while both are
 * live.
 */

.lc-shell {
  display: flex;
  align-items: stretch;
  min-height: calc(100vh - 60px);
}

.lc-page { flex: 1; min-width: 0; }

/* .lc-visually-hidden moved to base.css — pages outside the sidebar layout
   use it too, and without the rule their "hidden" labels simply show. */

/* --- The rail ----------------------------------------------------------- */

.lc-sidebar {
  position: relative;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  width: 300px;
  height: calc(100vh - 60px);
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--bg-sidebar, var(--bg-card));
  border-right: 1px solid var(--border-light);
  transition: width 0.2s ease;
}

/* Collapsed to an icon rail. The width is the whole mechanism — everything
   below just hides the text that no longer fits. */
.lc-sidebar.is-collapsed { width: 60px; }
.lc-sidebar.is-collapsed .lc-view-label,
.lc-sidebar.is-collapsed .lc-sidebar-title,
.lc-sidebar.is-collapsed .lc-sidebar-filters { display: none; }
.lc-sidebar.is-collapsed .lc-view { justify-content: center; padding: 10px 0; }
.lc-sidebar.is-collapsed .lc-sidebar-toggle-icon { transform: rotate(180deg); }

.lc-sidebar-toggle {
  position: absolute;
  top: 10px;
  right: 8px;
  z-index: 2;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--border-light);
  border-radius: 50%;
  background: var(--bg-dark);
  color: var(--text-secondary);
  line-height: 1;
  cursor: pointer;
}
.lc-sidebar-toggle:hover { color: var(--text-primary); }
.lc-sidebar-toggle-icon { display: inline-block; transition: transform 0.2s ease; }

/* --- View list ----------------------------------------------------------- */

.lc-sidebar-views {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 44px 8px 8px;
}

.lc-sidebar-title {
  margin: 0 0 8px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.lc-view {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  white-space: nowrap;
}
.lc-view:hover { background: var(--bg-dark); color: var(--text-primary); text-decoration: none; }

.lc-view.is-active {
  background: var(--accent-blue);
  color: var(--text-primary);
}
.lc-view.is-active:hover { text-decoration: none; }

.lc-view-emoji { flex-shrink: 0; font-size: 1.05rem; line-height: 1; }

.lc-sidebar-filters {
  padding: 0 8px 16px;
  border-top: 1px solid var(--border-light);
  margin-top: 8px;
  padding-top: 12px;
}
.lc-sidebar-filters:empty { display: none; }

/* --- Mobile drawer -------------------------------------------------------- */

.lc-sidebar-open { display: none; }
.lc-sidebar-backdrop { display: none; }

@media (max-width: 900px) {
  .lc-shell { display: block; }

  /* Off-canvas rather than hidden: the filters have to stay reachable, and a
     drawer keeps the page full-width when they are not needed. */
  .lc-sidebar {
    position: fixed;
    top: 60px;
    left: 0;
    z-index: 60;
    width: min(320px, 88vw);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }
  .lc-sidebar.is-open { transform: translateX(0); }

  /* The collapse toggle is a desktop affordance; on a phone the drawer is
     either open or shut. */
  .lc-sidebar.is-collapsed { width: min(320px, 88vw); }
  .lc-sidebar.is-collapsed .lc-view-label,
  .lc-sidebar.is-collapsed .lc-sidebar-title,
  .lc-sidebar.is-collapsed .lc-sidebar-filters { display: revert; }
  .lc-sidebar-toggle { display: none; }

  .lc-sidebar-backdrop {
    position: fixed;
    inset: 60px 0 0;
    z-index: 55;
    display: block;
    background: rgb(0 0 0 / 55%);
  }
  .lc-sidebar-backdrop[hidden] { display: none; }

  .lc-sidebar-open {
    display: inline-block;
    margin: 12px 0 0 16px;
    padding: 7px 14px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.82rem;
    cursor: pointer;
  }
}

/* Someone who asked for less motion should not get a sliding drawer. */
@media (prefers-reduced-motion: reduce) {
  .lc-sidebar, .lc-sidebar-toggle-icon { transition: none; }
}
