/* Page-Aware Chat Panel — slide-over styles */

.pc-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.pc-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(59, 130, 246, 0.5);
}
.pc-toggle svg { width: 24px; height: 24px; color: white; }
.pc-toggle-pulse {
  animation: pc-pulse 2s ease-in-out infinite;
}
@keyframes pc-pulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4); }
  50% { box-shadow: 0 4px 30px rgba(59, 130, 246, 0.7); }
}

/* Overlay */
.pc-overlay {
  position: fixed;
  inset: 0;
  z-index: 1001;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(2px);
  transition: opacity 0.2s ease;
}

/* Panel */
.pc-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 1002;
  width: 440px;
  max-width: 90vw;
  background: var(--bg-primary);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.4);
  transition: transform 0.25s ease;
}

/* Header */
.pc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  flex-shrink: 0;
}
.pc-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pc-header-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
}
.pc-header-icon svg { width: 18px; height: 18px; color: white; }
.pc-header-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.pc-header-sub {
  font-size: 11px;
  color: var(--text-muted);
}
.pc-header-actions {
  display: flex;
  gap: 8px;
}
.pc-header-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px;
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition);
}
.pc-header-btn:hover { border-color: var(--accent); color: var(--accent); }
.pc-header-btn svg { width: 16px; height: 16px; }

/* Prompts */
.pc-prompts {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
}
.pc-prompt {
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 5px 12px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pc-prompt:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(59, 130, 246, 0.08);
}

/* Messages area */
.pc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.pc-messages::-webkit-scrollbar { width: 4px; }
.pc-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Welcome state */
.pc-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  flex: 1;
  padding: 40px 20px;
  color: var(--text-muted);
}
.pc-welcome-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(59,130,246,0.15), rgba(124,58,237,0.15));
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.pc-welcome-icon svg { width: 28px; height: 28px; color: var(--accent); }
.pc-welcome h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.pc-welcome p {
  font-size: 12px;
  line-height: 1.6;
  max-width: 280px;
}

/* User message */
.pc-msg-user {
  display: flex;
  justify-content: flex-end;
}
.pc-msg-user-bubble {
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: white;
  max-width: 80%;
  border-radius: 14px 14px 4px 14px;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}

/* Assistant message */
.pc-msg-assistant {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Reasoning steps (collapsible) */
.pc-reasoning {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  font-size: 12px;
}
.pc-reasoning-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  cursor: pointer;
  user-select: none;
}
.pc-reasoning-header:hover { background: var(--bg-card); }
.pc-reasoning-chevron {
  width: 12px;
  height: 12px;
  color: var(--text-muted);
  transition: transform 0.2s;
}
.pc-reasoning-chevron.expanded { transform: rotate(90deg); }
.pc-reasoning-label { color: var(--text-secondary); font-weight: 500; }
.pc-reasoning-badge {
  margin-left: auto;
  background: var(--accent);
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
}
.pc-reasoning-steps {
  display: none;
  border-top: 1px solid var(--border);
}
.pc-reasoning-steps.show { display: block; }
.pc-step {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
}
.pc-step:first-child { border-top: none; }
.pc-step-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
  background: var(--accent);
}
.pc-step-icon.call { background: #7c3aed; }
.pc-step-icon.result { background: var(--success); }
.pc-step-icon.synth { background: var(--warning); }
.pc-step-content { flex: 1; min-width: 0; }
.pc-step-title { font-weight: 600; color: var(--text-primary); word-break: break-word; }
.pc-step-detail { color: var(--text-muted); margin-top: 2px; word-break: break-word; }

/* Response bubble */
.pc-msg-bubble {
  background: var(--bg-secondary);
  max-width: 90%;
  border-radius: 14px 14px 14px 4px;
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-primary);
  word-break: break-word;
}
.pc-msg-bubble h3, .pc-msg-bubble h4 { color: var(--text-primary); }
.pc-msg-bubble strong { color: var(--text-primary); }
.pc-msg-bubble table { margin: 8px 0; }
.pc-msg-bubble .chat-data-table { font-size: 11px; }
.pc-msg-bubble code { font-family: 'JetBrains Mono', monospace; }
.pc-msg-bubble .deep-link { color: var(--accent-light); text-decoration: underline; }

/* Typing indicator */
.pc-typing {
  display: flex;
  gap: 4px;
  padding: 8px 0;
}
.pc-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: pc-bounce 1.4s ease-in-out infinite;
}
.pc-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.pc-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes pc-bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-6px); }
}

/* Input bar */
.pc-input-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
  flex-shrink: 0;
}
.pc-input {
  flex: 1;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}
.pc-input:focus { border-color: var(--accent); }
.pc-input::placeholder { color: var(--text-muted); }
.pc-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--accent);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}
.pc-send-btn:hover { background: var(--accent-dark); }
.pc-send-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.pc-send-btn svg { width: 18px; height: 18px; color: white; }

@media (max-width: 640px) {
  .pc-panel { width: 100vw; }
}
