/* ================================================================== */
/* Layout                                                             */
/* ================================================================== */
.layout {
  display: flex;
  flex: 1;
  min-height: 0;
}
.layout__scoops {
  display: flex;
  flex-direction: column;
  width: var(--uxc-nav-rail-width);
  min-width: var(--uxc-nav-rail-width);
  max-width: var(--uxc-nav-rail-width);
  background: var(--s2-bg-layer-1);
  flex-shrink: 0;
  transition:
    width 200ms ease,
    min-width 200ms ease,
    max-width 200ms ease;
  overflow: visible;
}
.layout__scoops--expanded {
  width: 230px;
  min-width: 230px;
  max-width: 230px;
}
.layout__left {
  display: flex;
  flex-direction: column;
  min-width: 320px;
  flex: 1;
  background: var(--s2-bg-layer-1);
}
.layout__right {
  display: flex;
  flex-direction: column;
  min-width: 240px;
  overflow: hidden;
  background: var(--s2-gray-25);
  flex: 1;
}
.layout__divider {
  width: 1px;
  cursor: col-resize;
  background: var(--s2-border-subtle);
  flex-shrink: 0;
  transition: background var(--s2-transition-default);
  position: relative;
}
.layout__divider::after {
  content: '';
  position: absolute;
  inset: 0;
  left: -3px;
  right: -3px;
}
.layout__divider:hover,
.layout__divider.active {
  background: var(--s2-accent);
}

/* ── Thread Header (sub-header with scoop name) ─────────────── */
.thread-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--uxc-thread-header-height);
  min-height: var(--uxc-thread-header-height);
  padding: 0 16px;
  background: var(--s2-gray-25);
  border-bottom: none;
  border-top-left-radius: 12px;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}
/* Brand gradient accent line at bottom of thread header */
.thread-header::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--slicc-brand-gradient);
  opacity: 0.5;
}
/* Processing indicator — overlays the gradient line when active */
.thread-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--s2-accent);
  transform: scaleX(0);
  transform-origin: left;
  opacity: 0;
  transition: opacity 200ms ease;
}
.thread-header--processing::after {
  opacity: 1;
  animation: thread-progress 1.8s ease-in-out infinite;
}
@keyframes thread-progress {
  0% {
    transform: scaleX(0) translateX(0);
  }
  50% {
    transform: scaleX(0.4) translateX(125%);
  }
  100% {
    transform: scaleX(0) translateX(300%);
  }
}
.thread-header__title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.thread-header__name {
  font-size: 14px;
  font-weight: 700;
  line-height: 18px;
  letter-spacing: 0;
  color: var(--s2-gray-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.thread-header__icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--s2-content-default);
}
.thread-header__actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* Extension mode: the thread header hosts the scoop-switcher
   dropdown in place of the static chat icon + scoop name. The
   dropdown sets its own internal styles so we just need to make
   sure the title slot doesn't squeeze it. */
.thread-header--with-switcher {
  /* The dropdown menu lives inside .scoop-switcher inside the title
     slot — without overflow:visible the menu is clipped to the
     56px thread header. The gradient ::before/::after pseudos still
     render correctly because they're pinned to the header's box. */
  overflow: visible;
  /* Stack the header above chat content so the menu lands on top
     when it opens, even if a chat scroll container later introduces
     its own stacking context. */
  z-index: 12;
}
.thread-header--with-switcher .thread-header__title {
  gap: 0;
}
.thread-header--with-switcher .scoop-switcher {
  display: flex;
  align-items: center;
  margin-left: 0;
}

/* ── Horizontal divider ── */
.layout__right-divider {
  height: 1px;
  cursor: row-resize;
  background: var(--s2-border-subtle);
  flex-shrink: 0;
  transition: background var(--s2-transition-default);
  position: relative;
}
.layout__right-divider::after {
  content: '';
  position: absolute;
  inset: 0;
  top: -3px;
  bottom: -3px;
}
.layout__right-divider:hover,
.layout__right-divider.active {
  background: var(--s2-accent);
}

/* UXC: Right panel toggle button in thread header */
.thread-header__panel-toggle {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--s2-content-secondary);
  border-radius: var(--s2-radius-pill);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    background var(--s2-transition-default),
    color var(--s2-transition-default);
}
.thread-header__panel-toggle:hover {
  background: var(--s2-gray-200);
  color: var(--s2-content-default);
}
.thread-header__panel-toggle svg {
  width: 16px;
  height: 16px;
}

/* "Context getting full" affordance on the New Session button. Two
   tiers — warm glow at ~50% of the active model's context window,
   stronger glow + slow pulse past ~85% (compaction imminent). The
   button keeps its hover/click affordances on top of the glow. */
.thread-header__new-session.glow {
  color: var(--s2-notice, #c97a00);
  box-shadow:
    0 0 0 1px rgba(201, 122, 0, 0.25),
    0 0 12px rgba(201, 122, 0, 0.45);
  background: rgba(201, 122, 0, 0.08);
}
.thread-header__new-session.glow--hot {
  color: var(--s2-negative, #d73220);
  box-shadow:
    0 0 0 1px rgba(215, 50, 32, 0.35),
    0 0 16px rgba(215, 50, 32, 0.55);
  background: rgba(215, 50, 32, 0.1);
  animation: new-session-pulse 2.4s ease-in-out infinite;
}
@keyframes new-session-pulse {
  0%,
  100% {
    box-shadow:
      0 0 0 1px rgba(215, 50, 32, 0.35),
      0 0 16px rgba(215, 50, 32, 0.55);
  }
  50% {
    box-shadow:
      0 0 0 1px rgba(215, 50, 32, 0.55),
      0 0 22px rgba(215, 50, 32, 0.85);
  }
}

/* UXC: Chat gradient overlay at top */
.chat__gradient-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: linear-gradient(to bottom, var(--s2-bg-base) 0%, transparent 100%);
  pointer-events: none;
  z-index: 1;
}

/* ── Full-page mode (expand active panel to full width) ── */
.layout__left--fullpage-hidden,
.layout__divider--fullpage-hidden,
.layout__scoops--fullpage-hidden {
  display: none !important;
}
.layout__right--fullpage {
  flex: 1;
  min-width: 0;
  /* Override overlay mode positioning so fullpage works at all breakpoints */
  position: static !important;
  width: auto !important;
  transform: none !important;
  box-shadow: none !important;
}

/* Desktop ≥1024px: right panel is always visible, hide its toggle */
@media (min-width: 1024px) {
  .thread-header__panel-toggle--right {
    display: none;
  }
}

/* ================================================================== */
/* UXC Responsive Breakpoints                                         */
/* ================================================================== */

/* Tablet/small: <1024px — hide right panel by default, overlay */
@media (max-width: 1023px) {
  .layout__right {
    position: fixed;
    right: 0;
    top: var(--s2-header-height);
    bottom: 0;
    width: 50vw;
    min-width: 400px;
    z-index: 50;
    transform: translateX(100%);
    transition: transform 250ms ease;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.1);
  }
  .layout__right--open {
    transform: translateX(0);
  }
  /* Hide the vertical divider between chat and right panel */
  .layout__divider--vertical {
    display: none;
  }
  .layout__left {
    flex: 1;
    min-width: 0;
  }
}

/* Mobile: <768px — hide nav rail by default */
@media (max-width: 767px) {
  .layout__scoops {
    position: fixed;
    left: 0;
    top: var(--s2-header-height);
    bottom: 0;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform 250ms ease;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.1);
    border-right: 1px solid var(--s2-border-subtle);
    width: var(--uxc-nav-rail-width);
    min-width: var(--uxc-nav-rail-width);
    max-width: var(--uxc-nav-rail-width);
  }
  .layout__scoops--expanded {
    transform: translateX(0);
    width: 200px;
    min-width: 200px;
    max-width: 200px;
  }
  /* Hide the scoops divider */
  .layout__divider--scoops {
    display: none;
  }
}

/* Mobile: <768px — everything full-screen */
@media (max-width: 767px) {
  .layout__right {
    width: 100vw;
    min-width: 100vw;
  }
  .thread-header {
    padding: 0 var(--s2-spacing-200);
  }
  .chat__input-area {
    padding: var(--s2-spacing-200);
  }
}

/* Desktop ≥1440px — nav rail visible */
@media (min-width: 1440px) {
  .layout__left {
    flex: 1;
  }
  .layout__right {
    flex: 1;
  }
}

/* Legacy header hamburger — no longer used, hamburger is in nav rail */
