/* ============================================
   TOOLSLAB — BOTTOM SHEETS & MODALS
   Used for: "+" add-to-chat, tool selector (2-level)
   ============================================ */

.sheet-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  z-index: var(--z-overlay);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur-base) var(--ease);
}
.sheet-overlay.is-open { opacity: 1; pointer-events: auto; }

@media (min-width: 640px) {
  .sheet-overlay { align-items: center; }
}

.sheet {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 82vh;
  display: flex; flex-direction: column;
  box-shadow: var(--sh-xl);
  transform: translateY(24px);
  opacity: 0;
  transition: transform var(--dur-slow) var(--ease), opacity var(--dur-slow) var(--ease);
}
.sheet-overlay.is-open .sheet { transform: translateY(0); opacity: 1; }

@media (min-width: 640px) {
  .sheet { border-radius: var(--r-xl); max-height: 70vh; }
}

/* drag handle affordance (mobile) */
.sheet-handle {
  width: 36px; height: 4px;
  border-radius: var(--r-full);
  background: var(--border-med);
  margin: var(--sp-3) auto var(--sp-1);
  flex-shrink: 0;
}
@media (min-width: 640px) { .sheet-handle { display: none; } }

.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-3) var(--sp-4) var(--sp-4);
  flex-shrink: 0;
  position: relative;
}
.sheet-title {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text-primary);
  position: absolute;
  left: 50%; transform: translateX(-50%);
}
.sheet-back-btn { display: none; }
.sheet.has-back .sheet-back-btn { display: inline-flex; }

.sheet-body {
  overflow-y: auto;
  padding: 0 var(--sp-3) var(--sp-5);
  flex: 1;
}

/* ---------- TOOL SELECTOR: 2-LEVEL SLIDE ---------- */
.tool-levels {
  display: flex;
  width: 200%;
  transition: transform var(--dur-slow) var(--ease);
}
.tool-levels.level-2 { transform: translateX(-50%); }
.tool-level {
  width: 50%;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.category-card {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-4);
  border-radius: var(--r-lg);
  transition: background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.category-card:hover { background: var(--bg-surface-2); }
.category-card:active { transform: scale(0.98); }
.category-icon {
  width: 44px; height: 44px;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.category-icon svg { width: 22px; height: 22px; }
.category-body { flex: 1; min-width: 0; }
.category-title { font-size: var(--fs-base); font-weight: 600; color: var(--text-primary); }
.category-sub { font-size: var(--fs-sm); color: var(--text-muted); margin-top: 1px; }

.tool-card {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-lg);
  transition: background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.tool-card:hover { background: var(--bg-surface-2); }
.tool-card:active { transform: scale(0.98); }
.tool-card.is-selected { background: var(--accent-soft); }
.tool-icon {
  width: 36px; height: 36px;
  border-radius: var(--r-md);
  background: var(--bg-surface-3);
  color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.tool-icon svg { width: 18px; height: 18px; }
.tool-body { flex: 1; min-width: 0; }
.tool-title { font-size: var(--fs-base); font-weight: 500; color: var(--text-primary); }
.tool-sub { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 1px; }
.tool-check { width: 18px; height: 18px; color: var(--accent); flex-shrink: 0; }

/* ---------- "+" SHEET SPECIFIC ---------- */
.addchat-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: var(--sp-2) var(--sp-2);
}
