/* ---------------------------------------------------------------
   NeoChat — chat clásico, minimalista, con los colores reales de
   Neoretail (extraídos de neoretail.com.ar): azul acero #5d8eb9 y
   azul marino #2d3e50. Pensado para uso de escritorio.
   ----------------------------------------------------------------*/

:root {
  color-scheme: light dark;

  --bg: #eef1f4;
  --panel: #ffffff;
  --header-bg: #2d3e50;
  --header-text: #ffffff;
  --header-subtext: #b7c5d3;
  --text: #22303e;
  --text-dim: #6b7785;
  --border: #dfe4e9;
  --blue: #5d8eb9;
  --blue-deep: #3f6a8c;
  --error-bg: #fbecea;
  --error-text: #8a3324;
  --error-border: #eecdc6;
  --shadow: rgba(34, 48, 62, 0.12);

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1318;
    --panel: #161f27;
    --header-bg: #0c141b;
    --header-text: #eef2f5;
    --header-subtext: #8fa3b5;
    --text: #d6dde3;
    --text-dim: #8794a1;
    --border: #263241;
    --blue: #6fa0c9;
    --blue-deep: #4d7fa3;
    --error-bg: #3a2320;
    --error-text: #e59485;
    --error-border: #55302b;
    --shadow: rgba(0, 0, 0, 0.4);
  }
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
}

body {
  display: flex;
  justify-content: center;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
}

.app {
  width: 100%;
  max-width: 880px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  box-shadow: 0 0 60px -20px var(--shadow);
}

/* ---------- header ---------- */

.app-header {
  flex-shrink: 0;
  padding: 18px 28px;
  background: var(--header-bg);
  color: var(--header-text);
  border-bottom: 3px solid var(--blue);
}

.app-header__brand {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.app-header__subtitle {
  margin-top: 2px;
  font-size: 0.82rem;
  color: var(--header-subtext);
}

/* ---------- messages ---------- */

.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.msg {
  display: flex;
  animation: msg-in 200ms ease-out;
}

.msg--user {
  justify-content: flex-end;
}

.msg--bot,
.msg--error {
  justify-content: flex-start;
}

.msg__bubble {
  max-width: 70%;
  padding: 12px 16px;
  border-radius: 14px;
  line-height: 1.55;
  font-size: 0.95rem;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.msg--bot .msg__bubble {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.msg__bubble p,
.msg__bubble ul,
.msg__bubble ol {
  margin: 0 0 8px;
}

.msg__bubble p:last-child,
.msg__bubble ul:last-child,
.msg__bubble ol:last-child {
  margin-bottom: 0;
}

.msg__bubble ul,
.msg__bubble ol {
  padding-left: 20px;
}

.msg__bubble li {
  margin-bottom: 4px;
}

.msg__bubble strong {
  font-weight: 700;
}

.msg__bubble code {
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.87em;
  background: var(--border);
  padding: 1px 5px;
  border-radius: 4px;
}

.msg--user .msg__bubble {
  background: var(--blue-deep);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.msg--error .msg__bubble {
  background: var(--error-bg);
  color: var(--error-text);
  border: 1px solid var(--error-border);
}

/* ---------- typing indicator ---------- */

.typing {
  display: inline-flex;
  gap: 4px;
  padding: 4px 0;
}

.typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-dim);
  animation: typing-bounce 1.2s infinite ease-in-out;
}

.typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.typing span:nth-child(3) {
  animation-delay: 0.3s;
}

/* ---------- composer ---------- */

.composer {
  flex-shrink: 0;
  display: flex;
  gap: 10px;
  padding: 16px 28px;
  border-top: 1px solid var(--border);
  background: var(--panel);
}

#chat-input {
  flex: 1;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.95rem;
}

#chat-input::placeholder {
  color: var(--text-dim);
}

.composer button {
  flex-shrink: 0;
  padding: 12px 22px;
  border: none;
  border-radius: 10px;
  background: var(--blue-deep);
  color: #ffffff;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
}

.composer button:hover:not(:disabled) {
  background: var(--blue);
}

.composer button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

#chat-input:focus-visible,
.composer button:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* ---------- animations ---------- */

@keyframes msg-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .msg {
    animation: none;
  }
  .typing span {
    animation: none;
    opacity: 0.8;
  }
}

/* ---------- mobile ---------- */

@media (max-width: 600px) {
  .app-header,
  .messages,
  .composer {
    padding-left: 16px;
    padding-right: 16px;
  }
  .msg__bubble {
    max-width: 85%;
  }
}
