/* =========================================================
   NexaAI — AI chat & generator UI
   ========================================================= */

.chat-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: calc(100vh - var(--header-height));
}
@media (max-width: 992px) {
  .chat-shell { grid-template-columns: 1fr; }
  .chat-conv-list { display: none; }
}

.chat-conv-list {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: var(--surface);
}
[dir="rtl"] .chat-conv-list { border-right: none; border-left: 1px solid var(--border); }

.chat-conv-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin: 0 8px 2px;
  color: var(--text);
}
.chat-conv-item:hover { background: var(--surface-2); text-decoration: none; }
.chat-conv-item.active { background: var(--primary-soft); }
.chat-conv-item .conv-title { font-size: 0.86rem; font-weight: 600; }
.chat-conv-item .conv-preview { font-size: 0.78rem; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chat-main { display: flex; flex-direction: column; height: 100%; }
.chat-messages { flex: 1; overflow-y: auto; padding: 28px; display: flex; flex-direction: column; gap: 20px; }

.chat-msg { display: flex; gap: 12px; max-width: 720px; }
.chat-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.chat-msg .bubble {
  background: var(--surface-2);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 0.9rem;
}
.chat-msg.user .bubble { background: var(--primary); color: var(--primary-ink); }
.chat-msg .msg-tools { display: flex; gap: 4px; margin-top: 6px; }

.typing-indicator { display: inline-flex; gap: 4px; padding: 4px 0; }
.typing-indicator span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--text-faint);
  animation: nexa-bounce 1.2s infinite ease-in-out;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.15s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.3s; }
@keyframes nexa-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.chat-composer {
  border-top: 1px solid var(--border);
  padding: 16px 24px 20px;
}
.chat-composer-inner {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 10px 10px 10px 16px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.chat-composer textarea {
  border: none;
  resize: none;
  flex: 1;
  max-height: 160px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  background: transparent;
  color: var(--text);
}
.chat-composer textarea:focus { outline: none; }
.chat-composer-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 0.76rem;
  color: var(--text-faint);
}

.model-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 5px 12px;
  font-size: 0.8rem;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
}

/* Image generator */
.gen-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  background: var(--surface);
}
.style-chip {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  text-align: center;
  font-size: 0.78rem;
  cursor: pointer;
  background: var(--surface);
}
.style-chip.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-soft-ink); }

.gen-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}
.gen-tile {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface-2);
}
.gen-tile img { width: 100%; height: 100%; object-fit: cover; }
.gen-tile-actions {
  position: absolute;
  inset: auto 0 0 0;
  padding: 8px;
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  background: linear-gradient(transparent, rgba(0,0,0,0.55));
  opacity: 0;
  transition: opacity var(--dur-fast);
}
.gen-tile:hover .gen-tile-actions { opacity: 1; }
