/* =========================================================================
   Sidebar drawer (desktop only)
   ========================================================================= */

.sidebar {
  position: fixed;
  top: var(--header-height, 81px);
  right: 0;
  bottom: 0;
  width: 420px;
  max-width: 100%;
  background: var(--bg-card);
  border-left: 1px solid var(--border-color);
  box-shadow: -8px 0 24px var(--shadow-md);
  z-index: 900;
  transform: translateX(100%);
  transition: transform 200ms ease;
  pointer-events: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
}

.sidebar.is-open {
  transform: translateX(0);
  pointer-events: auto;
}

.sidebar-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 1.25rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: background 120ms ease;
}

.sidebar-close:hover {
  background: var(--bg-hover);
}

.sidebar-body {
  padding: 3rem 1.5rem 1.5rem;
  flex: 1;
}

.sidebar-body:empty::before {
  content: "Select a station to see details.";
  display: block;
  padding: 2rem 0;
  color: var(--text-secondary);
  text-align: center;
  font-size: 0.9rem;
}

.sidebar-body .station-head {
  margin-bottom: 1rem;
}

.sidebar-body .station-head h1 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin-bottom: 0.25rem;
}

.sidebar-body .station-shortcode {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-body .station-address {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* On mobile / narrow viewports the sidebar slides up from the bottom as a
   half-height bottom sheet rather than appearing as a side drawer. */
@media (max-width: 767px) {
  .sidebar {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 50dvh;
    border-left: none;
    border-top: 1px solid var(--border-color);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 24px var(--shadow-md);
    transform: translateY(100%);
    z-index: 1100;
  }

  .sidebar::before {
    content: "";
    position: sticky;
    top: 0;
    align-self: center;
    width: 36px;
    height: 4px;
    margin: 0.5rem 0 0.75rem;
    border-radius: 2px;
    background: var(--border-color);
    flex-shrink: 0;
    z-index: 2;
  }

  .sidebar.is-open {
    transform: translateY(0);
  }

  .sidebar-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    margin: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    color: var(--text-secondary);
    z-index: 2;
  }

  .sidebar-close:hover {
    background: transparent;
    color: var(--text-primary);
  }

  .sidebar-body {
    padding-top: 0.25rem;
  }
}
