/* qrcopilot.css — Copiloto IA del Generador de QR (panel flotante a la derecha).
   Coherente con E-scale (.qrt-*): tarjeta blanca, hairline, --ink/--paper, fuentes
   Fraunces/Inter/JetBrains. Scope con .qrc-panel; z-index por encima del overlay QR. */

.qrc-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(400px, 92vw);
  z-index: 360; /* por encima de .qrtool-overlay (310) y su panel de stats */
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-left: 1px solid var(--hairline, rgba(10, 10, 11, 0.12));
  box-shadow: -16px 0 48px rgba(10, 10, 11, 0.14);
  font-family: var(--brand-body-font, 'Inter Tight', system-ui, sans-serif);
  color: var(--ink, #0a0a0b);
  transition: transform 0.22s ease, opacity 0.22s ease;
}
.qrc-panel.qrc-hidden {
  transform: translateX(105%);
  opacity: 0;
  pointer-events: none;
}

/* Cabecera */
.qrc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--hairline, rgba(10, 10, 11, 0.12));
}
.qrc-head-brand { display: flex; align-items: center; gap: 10px; }
.qrc-spark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--ink, #0a0a0b);
  color: var(--paper, #f5f3ee);
}
.qrc-spark i { width: 16px; height: 16px; }
.qrc-title {
  font-family: var(--brand-display-font, 'Fraunces', serif);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.1;
}
.qrc-sub {
  font-size: 11px;
  color: var(--muted, #6a6a6e);
}
.qrc-icbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--hairline, rgba(10, 10, 11, 0.12));
  border-radius: 8px;
  background: transparent;
  color: var(--ink, #0a0a0b);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.qrc-icbtn:hover { background: var(--paper, #f5f3ee); border-color: var(--ink, #0a0a0b); }
.qrc-icbtn i { width: 15px; height: 15px; }

/* Lista de mensajes */
.qrc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.qrc-msg {
  max-width: 90%;
  padding: 10px 13px;
  border-radius: 13px;
  font-size: 13.5px;
  line-height: 1.45;
  word-break: break-word;
}
.qrc-msg p { margin: 0 0 6px; }
.qrc-msg p:last-child { margin-bottom: 0; }
.qrc-msg code {
  font-family: var(--brand-mono-font, 'JetBrains Mono', monospace);
  font-size: 11.5px;
  background: rgba(10, 10, 11, 0.06);
  padding: 1px 5px;
  border-radius: 5px;
}
.qrc-msg-user {
  align-self: flex-end;
  background: var(--ink, #0a0a0b);
  color: var(--paper, #f5f3ee);
  border-bottom-right-radius: 4px;
}
.qrc-msg-assistant {
  align-self: flex-start;
  background: var(--paper, #f5f3ee);
  border: 1px solid var(--hairline, rgba(10, 10, 11, 0.10));
  border-bottom-left-radius: 4px;
}
.qrc-error { color: #b42318; font-weight: 500; }

/* Indicador "escribiendo" */
.qrc-dots { display: inline-flex; gap: 4px; align-items: center; }
.qrc-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted, #6a6a6e);
  animation: qrc-bounce 1.1s infinite ease-in-out;
}
.qrc-dots span:nth-child(2) { animation-delay: 0.15s; }
.qrc-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes qrc-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
  40% { transform: translateY(-4px); opacity: 1; }
}

/* Formulario de entrada */
.qrc-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--hairline, rgba(10, 10, 11, 0.12));
}
.qrc-input {
  flex: 1;
  resize: none;
  max-height: 120px;
  padding: 9px 12px;
  border: 1px solid var(--hairline, rgba(10, 10, 11, 0.12));
  border-radius: 11px;
  background: var(--paper, #f5f3ee);
  color: var(--ink, #0a0a0b);
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.4;
  outline: none;
  transition: border-color 0.15s;
}
.qrc-input:focus { border-color: var(--ink, #0a0a0b); }
.qrc-input:disabled { opacity: 0.6; }
.qrc-send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex: none;
  border: none;
  border-radius: 11px;
  background: var(--ink, #0a0a0b);
  color: var(--paper, #f5f3ee);
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}
.qrc-send:hover { opacity: 0.88; }
.qrc-send:active { transform: scale(0.95); }
.qrc-send:disabled { opacity: 0.4; cursor: default; }
.qrc-send i { width: 16px; height: 16px; }

/* Botón IA del header activo cuando el panel está abierto */
#btn-tool-ai.is-active { background: var(--ink, #0a0a0b); color: var(--paper, #f5f3ee); }

@media (max-width: 480px) {
  .qrc-panel { width: 100vw; border-left: none; }
}
