/* Session view + sidebar */
.session-view {
  @apply flex flex-1 min-h-0 flex-col;
  background-color: var(--surface-base);
  color: inherit;
  overflow: hidden;
}

.session-list-container {
  @apply flex flex-col flex-1 min-h-0 relative;
  background-color: var(--surface-secondary);
  min-width: 200px;
  max-width: 500px;
}

.session-sidebar {
  @apply flex flex-col min-h-0;
  background-color: var(--surface-secondary);
}

.session-layout-compact {
  position: relative;
}

.session-sidebar-overlay {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: min(90vw, 360px);
  max-width: 360px;
  border-right: 1px solid var(--border-base);
  box-shadow: var(--folder-card-shadow);
  transform: translateX(0);
  transition: transform 0.25s ease, opacity 0.2s ease;
  z-index: 40;
}

.session-sidebar-collapsed {
  transform: translateX(-100%);
  opacity: 0;
  pointer-events: none;
}

.session-sidebar-backdrop {
  @apply absolute inset-0;
  border: none;
  padding: 0;
  background-color: var(--overlay-scrim);
  cursor: pointer;
  z-index: 30;
}

.session-sidebar-menu-button--floating {
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 20;
}

.session-sidebar-header {
  @apply flex flex-col gap-2 w-full;
}

.session-sidebar-header-row {
  @apply flex items-center justify-between gap-2;
}

.session-sidebar-close {
  @apply inline-flex items-center gap-1 text-xs font-medium px-2 py-1 rounded-md border transition-colors;
  border-color: var(--border-base);
  background-color: var(--surface-base);
  color: var(--text-primary);
}

.session-sidebar-close:hover {
  background-color: var(--surface-hover);
}

.session-sidebar-close:focus-visible {
  @apply ring-2 ring-offset-1;
  ring-color: var(--accent-primary);
  ring-offset-color: var(--surface-secondary);
}

.session-sidebar-title {
  color: var(--text-primary);
}

.session-sidebar-shortcuts {
  @apply flex flex-col gap-1;
}

.session-sidebar-new {
  @apply w-full;
}

.session-sidebar-controls {
  @apply flex flex-col gap-3;
  background-color: var(--surface-secondary);
}

.session-sidebar-controls > * {
  @apply w-full;
}

.session-sidebar-controls .selector-trigger,
.session-sidebar-controls [data-model-selector-control],
.session-sidebar-controls .selector-trigger-label,
session-sidebar-controls .selector-trigger-primary {
  @apply w-full;
}

.sidebar-selector {
  @apply flex flex-col gap-1 w-full;
}

.sidebar-selector-hint {
  @apply flex justify-center text-xs w-full;
  color: var(--text-muted);
}

.sidebar-selector-hints {
  @apply flex items-center gap-2 w-full;
  justify-content: space-between;
}

.sidebar-selector-hint--left,
.sidebar-selector-hint--right {
  @apply flex-1;
}

.sidebar-selector-hint--left {
  justify-content: flex-start;
}

.sidebar-selector-hint--right {
  justify-content: flex-end;
}

.session-header-hints {
  @apply flex-shrink-0;
}

.session-sidebar-separator {
  background-color: var(--border-base);
  height: 1px;
  width: 100%;
}

.session-resize-handle {
  @apply absolute top-0 w-1 h-full cursor-col-resize bg-transparent transition-colors;
  z-index: 10;
}

.session-resize-handle--left {
  right: 0;
}

.session-resize-handle--right {
  left: 0;
}

.session-resize-handle:hover {
  background-color: var(--accent-primary);
}

.session-resize-handle::before {
  content: "";
  @apply absolute top-0 h-full w-2;
}

.session-resize-handle--left::before {
  right: 0;
  transform: translateX(50%);
}

.session-resize-handle--right::before {
  left: 0;
  transform: translateX(-50%);
}

.session-list-header {
  @apply border-b relative;
  border-color: var(--border-base);
}

.session-list-header h3 {
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
}

.session-list {
  @apply flex-1;
}

.session-list-item {
  @apply border-b last:border-b-0;
  border-color: var(--border-base);
}

.session-item-base {
  @apply w-full flex flex-col gap-1 px-3 py-2.5 text-left transition-colors outline-none;
  font-family: var(--font-family-sans);
  font-size: var(--font-size-sm);
}


.session-item-base.session-item-child {
  padding-left: 2.25rem;
  position: relative;
}

.session-item-base.session-item-child::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 1.125rem;
  width: 1px;
  background-color: var(--text-secondary);
  opacity: 0.95;
  pointer-events: none;
}

.session-item-base.session-item-child.session-item-child-last::before {
  bottom: 50%;
}

.session-item-base.session-item-child::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 1.125rem;
  width: 0.875rem;
  height: 1px;
  background-color: var(--text-secondary);
  opacity: 0.95;
  transform: translateY(-0.5px);
  pointer-events: none;
}

.session-item-base.session-item-border-user {
  border-left: 4px solid var(--message-user-border);
}

.session-item-base.session-item-border-assistant {
  border-left: 4px solid var(--message-assistant-border);
}

.session-item-expander {
  @apply flex-shrink-0 p-0.5 rounded transition-colors;
}

.session-item-expander--spacer {
  width: calc(0.875rem + 0.25rem);
  height: calc(0.875rem + 0.25rem);
}

.session-item-base:focus-visible {
  @apply ring-2 ring-offset-1;
  ring-color: var(--accent-primary);
  ring-offset-color: var(--surface-secondary);
}

.session-item-row {
  @apply flex items-center gap-2 w-full;
}

.session-item-header {
  @apply justify-between;
}

.session-item-title-row {
  @apply flex items-start gap-2 min-w-0 flex-1;
}

.session-item-meta {
  @apply justify-between items-center;
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  margin-top: 0.125rem;
}

.session-item-active .session-item-meta {
  color: var(--text-secondary);
  opacity: 1;
}

.session-item-actions {
  @apply flex items-center gap-1;
}

.session-item-active {
  background-color: var(--list-item-highlight-bg);
  color: var(--text-primary);
  font-weight: var(--font-weight-medium);
  box-shadow: inset 0 0 0 1px var(--list-item-highlight-border);
}

.session-item-base.session-item-kind-user.session-item-active {
  background-color: var(--session-user-active-bg);
}

.session-item-base.session-item-kind-assistant.session-item-active {
  background-color: var(--session-assistant-active-bg);
}



.session-item-inactive {
  color: var(--text-secondary);
}

.session-item-inactive:hover {
  background-color: var(--surface-hover);
  color: var(--text-primary);
}



.session-item-active .session-item-close:hover {
  background-color: var(--surface-hover);
  color: var(--text-primary);
}

.session-item-title {
  @apply flex-1 min-w-0;
  font-weight: inherit;
}

.session-item-title--clamp {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  word-break: break-word;
}

.session-item-close {
  @apply flex-shrink-0 p-0.5 rounded transition-all;
}

.session-item-close:focus-visible {
  @apply ring-2 ring-offset-1;
  ring-color: var(--accent-primary);
  ring-offset-color: inherit;
}

.session-list-footer {
  @apply border-t;
  border-color: var(--border-base);
}

.session-new-button {
  background-color: var(--surface-base);
  color: var(--text-primary);
  border: 1px solid var(--border-base);
}

.session-new-button:hover {
  background-color: var(--surface-hover);
}

.session-new-button:focus-visible {
  @apply ring-2 ring-offset-1;
  ring-color: var(--accent-primary);
  ring-offset-color: var(--surface-secondary);
}

.status-indicator {
  @apply flex items-center gap-1.5 text-xs;
  color: var(--text-muted);
}

.status-indicator .status-dot {
  @apply w-2 h-2 rounded-full;
}

.status-indicator.connected .status-dot {
  background-color: var(--status-success);
}

.status-indicator.connecting .status-dot {
  background-color: var(--status-warning);
  animation: pulse 1.5s ease-in-out infinite;
}

.status-indicator.disconnected .status-dot {
  background-color: var(--status-error);
}

.status-indicator.session-status {
  --session-status-dot: var(--text-muted);
}

.status-indicator.session-status.session-working,
.status-indicator.session-status.session-compacting,
.status-indicator.session-status.session-idle {
  font-weight: var(--font-weight-medium);
}

.status-indicator.session-status.session-working {
  color: var(--session-status-working-fg);
  --session-status-dot: var(--session-status-working-fg);
}

.status-indicator.session-status.session-compacting {
  color: var(--session-status-compacting-fg);
  --session-status-dot: var(--session-status-compacting-fg);
}

.status-indicator.session-status.session-idle {
  color: var(--session-status-idle-fg);
  --session-status-dot: var(--session-status-idle-fg);
}

.status-indicator.session-status.session-permission {
  color: var(--session-status-permission-fg);
  --session-status-dot: var(--session-status-permission-fg);
}

.status-indicator.session-status .status-dot {
  background-color: var(--session-status-dot);
}

.status-indicator.session-status.session-working .status-dot,
.status-indicator.session-status.session-compacting .status-dot {
  animation: pulse 1.5s ease-in-out infinite;
}

.status-indicator.session-status.session-working.session-status-list {
  background-color: var(--session-status-working-bg);
}

.status-indicator.session-status.session-compacting.session-status-list {
  background-color: var(--session-status-compacting-bg);
}

.status-indicator.session-status.session-idle.session-status-list {
  background-color: var(--session-status-idle-bg);
}

.status-indicator.session-status.session-permission.session-status-list {
  background-color: var(--session-status-permission-bg);
}

.status-indicator.session-status-list {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: var(--font-weight-medium);
  color: inherit;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  border: 1px solid transparent;
}

@media (max-width: 768px) {
  .session-list-container {
    min-width: 200px;
  }

  .session-item-base {
    @apply px-2 py-2;
  }
}
