/* drawer.css — vertical tab handles on right edge + slide-in panel. */

:root {
  --drawer-w: 480px;
  --drawer-tab-w: 30px;
  --drawer-tab-h: 110px;
}

/* the vertical strip of handles, mid-right by default */
.drawer-strip {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 40;
  /* Only animate the strip's right edge for the open/close transition.
     While the user is actively dragging the grip we DROP the transition
     so the strip sticks to the drawer's left edge frame-perfect — no
     0.25s chase as --drawer-w updates on every pointermove. */
  transition: right 0.25s ease;
  pointer-events: none; /* re-enabled per-button */
  /* sits left of however many panels are open (0 → flush right). drawer.js
     sets --open-w = (open count) * --drawer-w. */
  right: var(--open-w, 0px);
}
body.drawer-resizing .drawer-strip {
  transition: none;
}

.drawer-tab {
  width: var(--drawer-tab-w);
  height: var(--drawer-tab-h);
  background: var(--panel);
  color: var(--muted);
  border: 1px solid var(--line);
  border-right: none;
  border-radius: var(--r2) 0 0 var(--r2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 600 11px var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0;
  pointer-events: auto;
  transition:
    background 0.12s,
    color 0.12s,
    border-color 0.12s;
}
.drawer-tab:hover {
  color: var(--ink);
  background: var(--accent-soft);
  border-color: var(--ink);
}
.drawer-tab.on {
  color: var(--ink);
  background: var(--bg);
  border-color: var(--ink);
}
.drawer-tab-text {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  white-space: nowrap;
}

/* the slide-in panel itself */
.drawer-host {
  position: fixed;
  top: 53px; /* topbar height */
  right: 0;
  bottom: 0;
  width: var(--drawer-w);
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.25);
  z-index: 35;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
}
.drawer-host.open {
  transform: translateX(0);
}

.drawer-grip {
  position: absolute;
  left: -3px;
  top: 0;
  bottom: 0;
  width: 6px;
  cursor: col-resize;
  z-index: 1;
  user-select: none;
  touch-action: none;
}
.drawer-grip::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 2px;
  width: 2px;
  background: transparent;
  transition: background 0.12s;
}
.drawer-grip:hover::after,
.drawer-grip.dragging::after {
  background: var(--accent);
}
body.drawer-resizing {
  cursor: col-resize;
  user-select: none;
}
body.drawer-resizing * {
  cursor: col-resize !important;
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.drawer-title {
  font: 600 12px var(--mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink);
  flex: none;
}
/* Module-controlled buttons sit between the title and × close. */
.drawer-head-extras {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  margin-right: 4px;
}
.drawer-x {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 2px 8px;
  border-radius: var(--r1);
}
.drawer-x:hover {
  color: var(--ink);
  background: var(--accent-soft);
}

.drawer-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.drawer-err {
  color: var(--ink);
  font: 500 12px var(--mono);
  background: var(--accent-soft);
  border: 1px solid var(--ink);
  padding: 8px 12px;
  border-radius: var(--r2);
}

/* ---- chat-module head buttons + history view ---- */
.chat-head-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: var(--r1);
  cursor: pointer;
  font: 600 14px var(--mono);
  line-height: 1;
  padding: 0;
  transition:
    border-color 0.12s,
    color 0.12s,
    background 0.12s;
}
.chat-head-btn:hover {
  border-color: var(--ink);
  color: var(--ink);
  background: var(--accent-soft);
}
.chat-head-btn[disabled] {
  opacity: 0.5;
  cursor: progress;
}

/* context strip — sits above deep-chat, updates live on route change.
   Tells the user (and visually, the agent) what they're currently
   viewing. Survives chat ↔ history view swaps inside the module. */
.chat-ctx-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  font: 500 11px var(--mono);
  letter-spacing: 0.03em;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r1);
  margin-bottom: 10px;
}
.chat-ctx-dot {
  color: var(--live);
  font-size: 9px;
  line-height: 1;
}
.chat-ctx-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
/* Thinking-level + model pickers at the right of the strip. Plain native
   <select> so the chrome matches the OS — we just monochrome it. */
.chat-think,
.chat-model {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font: 500 11px var(--mono);
  letter-spacing: 0.04em;
  color: var(--faint);
}
.chat-think-lbl,
.chat-model-lbl {
  color: var(--faint);
}
.chat-think-sel,
.chat-model-sel {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--r1);
  padding: 2px 4px;
  font: 600 11px var(--mono);
  cursor: pointer;
}
.chat-think-sel:hover,
.chat-model-sel:hover {
  border-color: var(--ink);
}
.chat-think-sel:focus,
.chat-model-sel:focus {
  outline: none;
  border-color: var(--ink);
}
.chat-inner {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.chat-history {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chat-history-h {
  font: 600 11px var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 0;
}
.chat-history-back {
  align-self: flex-start;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font: 500 12px var(--mono);
  padding: 2px 6px;
  border-radius: var(--r1);
}
.chat-history-back:hover {
  color: var(--ink);
  background: var(--accent-soft);
}
.chat-thread-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.chat-thread-item {
  display: grid;
  grid-template-columns: 16px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r2);
  background: var(--panel);
}
.chat-thread-item.active {
  border-color: var(--live);
}
.chat-thread-dot {
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
}
.chat-thread-item.active .chat-thread-dot {
  color: var(--live);
}
.chat-thread-title {
  font-size: 13px;
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.chat-thread-sub {
  font: 500 10px var(--mono);
  color: var(--faint);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.chat-thread-resume {
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: var(--r1);
  padding: 4px 9px;
  cursor: pointer;
  font: 500 11px var(--mono);
}
.chat-thread-resume:hover {
  border-color: var(--ink);
  color: var(--ink);
  background: var(--accent-soft);
}
.chat-thread-resume[disabled] {
  opacity: 0.5;
  cursor: progress;
}

/* placeholder body for Module 1 / Module 2 etc. */
.drawer-placeholder {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.drawer-placeholder h3 {
  color: var(--ink);
  font-size: 14px;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}
.drawer-placeholder code {
  background: var(--bg);
  padding: 1px 5px;
  border-radius: var(--r1);
  font-family: var(--mono);
  font-size: 11.5px;
}
