/* =========================================================
   AegisIQ Governance Copilot — Panel Styles
   Dark glass, blue/purple neon accents
   ========================================================= */

/* ---- Toggle Button ---- */
.copilot-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9998;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 24px rgba(99, 102, 241, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
  color: #fff;
  font-size: 24px;
}
.copilot-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 32px rgba(99, 102, 241, 0.6);
}
.copilot-toggle.active {
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
}
.copilot-toggle svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---- Panel ---- */
.copilot-panel {
  position: fixed;
  top: 0;
  right: -480px;
  width: 460px;
  max-width: 100vw;
  height: 100vh;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  background: rgba(15, 17, 30, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-left: 1px solid rgba(99, 102, 241, 0.25);
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.5);
  transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: 'Inter', system-ui, sans-serif;
}
.copilot-panel.open {
  right: 0;
}

/* ---- Header ---- */
.copilot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(99, 102, 241, 0.2);
  background: rgba(15, 17, 30, 0.6);
  flex-shrink: 0;
}
.copilot-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.copilot-header-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.copilot-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #e2e8f0;
  letter-spacing: -0.01em;
}
.copilot-header .copilot-mode-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 12px;
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.copilot-close {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
  font-size: 20px;
  line-height: 1;
}
.copilot-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
}

/* ---- Mode Tabs ---- */
.copilot-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 20px;
  border-bottom: 1px solid rgba(99, 102, 241, 0.12);
  flex-shrink: 0;
  background: rgba(15, 17, 30, 0.4);
}
.copilot-tab {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: 8px;
  background: transparent;
  color: #94a3b8;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.copilot-tab:hover {
  background: rgba(99, 102, 241, 0.08);
  color: #c7d2fe;
}
.copilot-tab.active {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.4);
  color: #a5b4fc;
}

/* ---- Chat Area ---- */
.copilot-chat {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.copilot-chat::-webkit-scrollbar {
  width: 5px;
}
.copilot-chat::-webkit-scrollbar-track {
  background: transparent;
}
.copilot-chat::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.25);
  border-radius: 10px;
}

/* Messages */
.copilot-msg {
  display: flex;
  flex-direction: column;
  max-width: 92%;
  animation: copilotFadeIn 0.25s ease;
}
.copilot-msg.user {
  align-self: flex-end;
}
.copilot-msg.assistant {
  align-self: flex-start;
}
.copilot-msg-bubble {
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.6;
  color: #e2e8f0;
}
.copilot-msg.user .copilot-msg-bubble {
  background: rgba(99, 102, 241, 0.2);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-bottom-right-radius: 4px;
}
.copilot-msg.assistant .copilot-msg-bubble {
  background: rgba(30, 32, 48, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom-left-radius: 4px;
}
.copilot-msg-bubble p { margin: 0 0 8px; }
.copilot-msg-bubble p:last-child { margin-bottom: 0; }
.copilot-msg-bubble ul, .copilot-msg-bubble ol { margin: 4px 0; padding-left: 20px; }
.copilot-msg-bubble li { margin-bottom: 4px; }
.copilot-msg-bubble strong { color: #c7d2fe; }
.copilot-msg-bubble code {
  background: rgba(99, 102, 241, 0.12);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
}
.copilot-msg-bubble table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0;
  font-size: 12.5px;
}
.copilot-msg-bubble th, .copilot-msg-bubble td {
  padding: 6px 10px;
  border: 1px solid rgba(99, 102, 241, 0.15);
  text-align: left;
}
.copilot-msg-bubble th {
  background: rgba(99, 102, 241, 0.1);
  color: #a5b4fc;
  font-weight: 600;
}
.copilot-msg-time {
  font-size: 10px;
  color: #64748b;
  margin-top: 4px;
  padding: 0 4px;
}
.copilot-msg.user .copilot-msg-time { text-align: right; }

/* Warning banner */
.copilot-warning {
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  color: #fbbf24;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Proposal card */
.copilot-proposal {
  margin-top: 12px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 10px;
  padding: 14px;
}
.copilot-proposal-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.copilot-proposal-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
  font-weight: 600;
  text-transform: uppercase;
}
.copilot-proposal-title {
  font-size: 13px;
  font-weight: 600;
  color: #c7d2fe;
}
.copilot-proposal-body {
  font-size: 12.5px;
  color: #94a3b8;
  white-space: pre-wrap;
  line-height: 1.5;
  max-height: 200px;
  overflow-y: auto;
}

/* Loading */
.copilot-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  color: #94a3b8;
  font-size: 13px;
}
.copilot-loading-dots {
  display: flex;
  gap: 4px;
}
.copilot-loading-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #6366f1;
  animation: copilotBounce 1.4s infinite;
}
.copilot-loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.copilot-loading-dots span:nth-child(3) { animation-delay: 0.4s; }

/* ---- Welcome ---- */
.copilot-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
  gap: 16px;
  flex: 1;
}
.copilot-welcome-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.15));
  border: 1px solid rgba(99, 102, 241, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}
.copilot-welcome h4 {
  margin: 0;
  font-size: 16px;
  color: #e2e8f0;
}
.copilot-welcome p {
  margin: 0;
  font-size: 13px;
  color: #64748b;
  max-width: 300px;
  line-height: 1.5;
}

/* Suggested prompts */
.copilot-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 8px;
}
.copilot-suggestion-chip {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid rgba(99, 102, 241, 0.2);
  background: rgba(99, 102, 241, 0.06);
  color: #a5b4fc;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.copilot-suggestion-chip:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.4);
}

/* ---- Composer ---- */
.copilot-composer {
  padding: 12px 16px 16px;
  border-top: 1px solid rgba(99, 102, 241, 0.15);
  background: rgba(15, 17, 30, 0.6);
  flex-shrink: 0;
}
.copilot-composer-inner {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.copilot-input {
  flex: 1;
  background: rgba(30, 32, 48, 0.7);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 12px;
  padding: 10px 14px;
  color: #e2e8f0;
  font-size: 13.5px;
  font-family: 'Inter', system-ui, sans-serif;
  resize: none;
  min-height: 40px;
  max-height: 120px;
  outline: none;
  transition: border-color 0.2s;
  line-height: 1.5;
}
.copilot-input::placeholder {
  color: #475569;
}
.copilot-input:focus {
  border-color: rgba(99, 102, 241, 0.5);
}
.copilot-send {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: opacity 0.15s, transform 0.15s;
  flex-shrink: 0;
}
.copilot-send:hover {
  opacity: 0.9;
  transform: scale(1.04);
}
.copilot-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}
.copilot-send svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---- Animations ---- */
@keyframes copilotFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes copilotBounce {
  0%, 80%, 100% { transform: scale(0); }
  40%           { transform: scale(1); }
}

/* ---- Responsive ---- */
@media (max-width: 520px) {
  .copilot-panel {
    width: 100vw;
    right: -100vw;
  }
  .copilot-panel.open {
    right: 0;
  }
}
