/* =================================================================
   Copilot — chat panels (sidebar + sheet) and variants picker
   ================================================================= */

.cp-panel {
  display: flex; flex-direction: column;
  width: 100%; height: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  position: relative;
  /* Violet edge on the left as per brief */
  box-shadow: -1px 0 0 oklch(0.71 0.16 295 / 0.35),
              0 24px 60px -20px oklch(0 0 0 / 0.5),
              0 0 60px -10px var(--violet-glow);
}
.cp-panel::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(180deg,
    transparent 0%,
    oklch(0.71 0.16 295 / 0.7) 20%,
    oklch(0.71 0.16 295 / 0.7) 80%,
    transparent 100%);
  pointer-events: none;
}

/* Sheet (bottom slide-up for mobile) */
.cp-sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: 0 -20px 60px -20px oklch(0 0 0 / 0.6),
              0 0 50px -10px var(--violet-glow);
  max-height: 86%;
  overflow: hidden;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.cp-sheet-handle {
  width: 38px; height: 4px; border-radius: 999px;
  background: var(--border-strong);
  margin: 8px auto 4px;
  flex: 0 0 auto;
}

/* Head */
.cp-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}
.cp-head-title {
  display: flex; align-items: baseline; gap: 8px;
  font-size: 14px; font-weight: 600; letter-spacing: -0.01em;
}
.cp-head-sub {
  font-size: 11.5px; color: var(--text-muted); font-weight: 400;
  margin-left: 4px;
}

/* Thread */
.cp-thread {
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto;
  padding: 16px 16px 6px;
  display: flex; flex-direction: column; gap: 12px;
}

.cp-msg {
  display: flex; align-items: flex-start; gap: 10px;
  max-width: 100%;
}
.cp-msg-user { justify-content: flex-end; }

.cp-avatar {
  width: 24px; height: 24px; border-radius: 50%;
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: var(--violet-bg-2);
  border: 1px solid oklch(0.71 0.16 295 / 0.4);
  color: var(--violet);
  margin-top: 2px;
}

.cp-bubble {
  max-width: 78%;
  padding: 10px 13px;
  font-size: 13.5px; line-height: 1.5;
  color: var(--text);
  border-radius: var(--r);
  background: var(--bg-soft);
  border: 1px solid var(--border);
}
.cp-msg-user .cp-bubble {
  background: var(--violet-bg);
  border-color: oklch(0.71 0.16 295 / 0.3);
  color: var(--text);
  border-top-right-radius: 4px;
}
.cp-msg-ai .cp-bubble {
  border-top-left-radius: 4px;
}

.cp-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 10px;
}
.cp-chip {
  padding: 6px 11px;
  font-size: 12px; color: var(--text-soft);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  transition: all .12s ease;
}
.cp-chip:hover {
  border-color: oklch(0.71 0.16 295 / 0.5);
  color: var(--violet);
  background: var(--violet-bg);
}

/* Typing indicator */
.cp-bubble-typing {
  display: inline-flex; gap: 4px; align-items: center;
  padding: 12px 14px;
}
.cp-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--text-muted);
  animation: cp-blink 1.2s ease-in-out infinite;
}
.cp-dot:nth-child(2) { animation-delay: 0.15s; }
.cp-dot:nth-child(3) { animation-delay: 0.30s; }
@keyframes cp-blink {
  0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
  30%           { opacity: 1;    transform: translateY(-2px); }
}

/* Input */
.cp-input-shell {
  flex: 0 0 auto;
  padding: 10px 14px 14px;
  border-top: 1px solid var(--border);
  background: oklch(0.17 0.005 60);
}
.cp-input-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 6px 6px 6px 14px;
  transition: border-color .15s ease;
}
.cp-input-row:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--violet-bg);
}
.cp-input {
  flex: 1; font-size: 14px; padding: 6px 0;
  color: var(--text);
}
.cp-input::placeholder { color: var(--text-dim); }
.cp-send {
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, oklch(0.74 0.16 295), oklch(0.62 0.16 295));
  color: white;
  box-shadow: 0 0 14px var(--violet-glow);
}
.cp-send:hover { box-shadow: 0 0 22px var(--violet-glow); }

.cp-input-foot {
  display: flex; align-items: center; gap: 8px;
  margin-top: 8px;
  font-size: 11px; color: var(--text-muted);
  font-family: var(--font-mono);
}
.cp-input-foot .sep { color: var(--text-dim); }

/* =================================================================
   Variants picker — modal + sheet
   ================================================================= */
.cp-modal-backdrop {
  position: absolute; inset: 0;
  background: oklch(0.10 0.005 60 / 0.62);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 32px;
  z-index: 5;
}

.cp-modal {
  width: 100%; max-width: 980px; max-height: 88%;
  display: flex; flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: 0 40px 100px -30px oklch(0 0 0 / 0.7),
              0 0 80px -20px var(--violet-glow);
  overflow: hidden;
}

.cp-modal-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--border);
}
.cp-modal-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 16px; font-weight: 600; letter-spacing: -0.01em;
}
.cp-modal-sub {
  font-size: 12.5px; color: var(--text-muted); margin-top: 4px;
  max-width: 540px;
}

.cp-variants {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding: 18px;
  overflow-y: auto;
}

.cp-variant {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: all .18s ease;
  position: relative;
}
.cp-variant:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.cp-variant.is-active {
  border-color: oklch(0.71 0.16 295 / 0.55);
  box-shadow: 0 0 0 1px oklch(0.71 0.16 295 / 0.35),
              0 0 30px -6px var(--violet-glow);
}

.cp-variant-thumb {
  position: relative;
  aspect-ratio: 16/9;
  background: oklch(0.1 0.005 60);
  overflow: hidden;
}
.cp-variant-rec {
  position: absolute; top: 10px; left: 10px;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 9px 4px 7px;
  background: oklch(0.71 0.16 295 / 0.85);
  backdrop-filter: blur(6px);
  border-radius: var(--r-pill);
  font-size: 11px; font-weight: 500;
  color: white;
}

.cp-variant-body {
  padding: 14px 14px 14px;
  display: flex; flex-direction: column; gap: 10px;
  flex: 1;
}
.cp-variant-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 10px;
}
.cp-variant-title {
  font-size: 14px; font-weight: 600; letter-spacing: -0.01em;
}
.cp-variant-sub {
  font-size: 11.5px; color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 2px;
}
.cp-variant-cost {
  font-family: var(--font-mono);
  font-size: 14px; font-weight: 500;
  color: var(--violet);
  white-space: nowrap;
}
.cp-variant-cost .unit { color: var(--text-muted); font-size: 11px; }

.cp-variant-prompt {
  font-size: 12px; line-height: 1.5;
  color: var(--text-soft);
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical;
  overflow: hidden;
}

.cp-variant-chips {
  display: flex; flex-wrap: wrap; gap: 5px;
  margin-top: auto;
}
.cp-vc {
  padding: 3px 8px;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  font-family: var(--font-mono);
}
.cp-vc.on {
  background: var(--violet-bg);
  border-color: oklch(0.71 0.16 295 / 0.4);
  color: var(--violet);
}

.cp-variant-actions {
  display: flex; gap: 6px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  margin-top: 4px;
}
.cp-variant-actions .ai-btn { flex: 1; font-size: 12px; padding: 7px 10px; }

.cp-modal-foot {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}

/* Mobile sheet of variants — 3 cards stacked vertically */
.cp-sheet-variants {
  max-height: 92%;
}
.cp-sheet-sub {
  padding: 0 18px 8px;
  font-size: 12px; color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.cp-vstack {
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column;
  gap: 12px;
}
.cp-vstack .cp-variant-thumb {
  aspect-ratio: 16/9;
}

/* =================================================================
   Icons compare strip
   ================================================================= */
.ic-compare {
  display: flex; flex-direction: column; gap: 22px;
  padding: 26px 32px;
  background: var(--bg);
  height: 100%;
}
.ic-row {
  display: flex; flex-direction: column; gap: 8px;
}
.ic-row .ic-label {
  font-size: 11px; font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.08em; text-transform: uppercase;
}
.ic-row .ic-hint {
  font-size: 11.5px; color: var(--text-dim);
  font-family: var(--font-mono);
}
