/* ============================================
   GenCat Connect · Conversa
   Chat + visualización del grafo
   ============================================ */

.conv-screen {
  min-height: calc(100vh - 80px);
  background: var(--cream);
}

.conv-screen[hidden] { display: none !important; }

.conv-form {
  display: flex;
  flex-direction: column;
}

.conv-label {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-soft);
  margin-bottom: 8px;
  display: block;
}

.conv-input {
  width: 100%;
  padding: 14px 16px;
  font-family: var(--sans);
  font-size: 1rem;
  color: var(--navy);
  background: white;
  border: 1px solid var(--cream-soft);
  border-radius: 4px;
  outline: none;
  transition: border-color 0.2s;
}

.conv-input:focus {
  border-color: var(--gold);
}

.conv-error {
  margin-top: 16px;
  padding: 12px 16px;
  background: #fee;
  border: 1px solid var(--senyera);
  border-radius: 4px;
  color: var(--senyera-soft);
  font-size: 0.92rem;
}

.conv-lang-choice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.conv-radio {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: white;
  border: 1px solid var(--cream-soft);
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--sans);
  transition: all 0.2s;
}

.conv-radio:has(input:checked) {
  border-color: var(--gold);
  background: var(--white-off);
}

.conv-radio input { accent-color: var(--gold); }

/* ============================================
   APP · CHAT + GRAFO LAYOUT
   ============================================ */

.conv-app {
  background: var(--navy);
  padding: 0;
}

.conv-app-grid {
  display: grid;
  grid-template-columns: 460px 1fr;
  height: calc(100vh - 80px);
}

@media (max-width: 900px) {
  .conv-app-grid {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
  }
}

/* ─── CHAT PANE ─────────────────────────────── */

.conv-chat-pane {
  display: flex;
  flex-direction: column;
  background: var(--navy-soft);
  border-right: 1px solid var(--navy-light);
  height: 100%;
  overflow: hidden;
}

.conv-chat-header {
  padding: 20px 24px;
  background: var(--navy);
  border-bottom: 1px solid var(--navy-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.conv-chat-title {
  font-family: var(--serif);
  color: var(--gold);
  font-size: 1.1rem;
  font-weight: 600;
}

.conv-chat-sub {
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--grey-300);
  letter-spacing: 0.06em;
  margin-top: 4px;
}

.conv-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--grey-300);
  letter-spacing: 0.12em;
}

.conv-status .dot {
  width: 8px; height: 8px;
  background: #4ade80;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

.conv-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--navy-light) transparent;
}

.conv-msg {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  animation: msgIn 0.3s ease;
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.conv-msg-user {
  align-self: flex-end;
  align-items: flex-end;
}

.conv-msg-bot {
  align-self: flex-start;
  align-items: flex-start;
}

.conv-msg-author {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.conv-msg-user .conv-msg-author { color: var(--gold-light); }
.conv-msg-bot .conv-msg-author  { color: var(--grey-300); }

.conv-msg-bubble {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.95rem;
  line-height: 1.45;
  word-wrap: break-word;
}

.conv-msg-user .conv-msg-bubble {
  background: var(--gold);
  color: var(--navy);
  border-bottom-right-radius: 3px;
}

.conv-msg-bot .conv-msg-bubble {
  background: var(--navy-light);
  color: var(--cream);
  border-bottom-left-radius: 3px;
}

.conv-msg-typing .conv-msg-bubble {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 16px;
}

.conv-msg-typing .conv-msg-bubble span {
  width: 6px; height: 6px;
  background: var(--gold);
  border-radius: 50%;
  animation: typingDot 1.2s infinite;
}

.conv-msg-typing .conv-msg-bubble span:nth-child(2) { animation-delay: 0.2s; }
.conv-msg-typing .conv-msg-bubble span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDot {
  0%, 100% { opacity: 0.3; transform: translateY(0); }
  50%      { opacity: 1; transform: translateY(-3px); }
}

.conv-chat-input {
  padding: 16px;
  background: var(--navy);
  border-top: 1px solid var(--navy-light);
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.conv-chat-input .conv-input {
  background: var(--navy-soft);
  border-color: var(--navy-light);
  color: var(--cream);
  flex: 1;
}

.conv-chat-input .conv-input:focus {
  border-color: var(--gold);
}

.conv-send-btn {
  width: 48px;
  height: 48px;
  background: var(--gold);
  color: var(--navy);
  border: none;
  border-radius: 4px;
  font-size: 1.4rem;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
}

.conv-send-btn:hover {
  background: var(--gold-light);
  transform: translateX(2px);
}

.conv-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ─── GRAPH PANE ────────────────────────────── */

.conv-graph-pane {
  display: flex;
  flex-direction: column;
  background: var(--navy);
  height: 100%;
  position: relative;
  overflow: hidden;
}

.conv-graph-header {
  padding: 20px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--navy-light);
  flex-shrink: 0;
}

.conv-graph-title {
  font-family: var(--serif);
  color: var(--cream);
  font-size: 1.1rem;
  font-weight: 600;
}

.conv-graph-sub {
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--grey-300);
  letter-spacing: 0.06em;
  margin-top: 4px;
}

.conv-graph-source {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--gold);
  letter-spacing: 0.14em;
  letter-spacing: 0.14em;
}

.conv-graph-svg {
  flex: 1;
  width: 100%;
  background: var(--navy);
}

.conv-graph-legend {
  position: absolute;
  bottom: 16px;
  right: 16px;
  display: flex;
  gap: 16px;
  padding: 10px 14px;
  background: rgba(12, 20, 32, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid var(--navy-light);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--grey-300);
  letter-spacing: 0.06em;
}

.conv-graph-legend .legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.conv-graph-legend .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
}

/* ─── D3 nodes & edges ──────────────────────── */

.node-circle {
  stroke: var(--cream);
  stroke-width: 1.5;
  cursor: pointer;
  transition: all 0.3s;
}

.node-circle.entity   { fill: var(--gold); }
.node-circle.location { fill: #e88a4a; }
.node-circle.intent   { fill: #6db58c; }

.node-circle:hover {
  stroke: var(--gold-light);
  stroke-width: 3;
}

.node-circle.is-new {
  animation: nodePulse 1.2s ease;
}

@keyframes nodePulse {
  0%   { r: 4; opacity: 0.4; }
  50%  { r: 18; opacity: 1; }
  100% { opacity: 1; }
}

.node-label {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  fill: var(--cream);
  pointer-events: none;
  text-anchor: middle;
}

.edge-line {
  stroke: var(--navy-light);
  stroke-width: 1.2;
  fill: none;
  opacity: 0.6;
}

.edge-label {
  font-family: var(--mono);
  font-size: 9px;
  fill: var(--grey-500);
  pointer-events: none;
  text-anchor: middle;
}

/* Empty state */
.graph-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  color: var(--grey-500);
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-align: center;
  padding: 40px;
}

.graph-empty .icon {
  font-size: 2.5rem;
  color: var(--navy-light);
  margin-bottom: 16px;
}
