/* Vera · Posventa — Chat web
   Paleta: Consorcio JGL Casatua — Navy #22264D + Rojo #BF1818 + Gris #D3D3D3 */

:root {
  --color-bg: #f4f4f6;
  --color-card: #ffffff;
  --color-text: #22264D;
  --color-muted: #666666;
  --color-accent: #22264D;
  --color-accent-dark: #1a1a2e;
  --color-border: #d3d3d3;
  --color-user-bubble: #22264D;
  --color-user-text: #ffffff;
  --color-assistant-bubble: #eeeef4;
  --color-assistant-text: #22264D;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 8px 30px rgba(0,0,0,.08);
  --font: "DM Sans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--color-bg);
  font-family: var(--font);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.chat-shell {
  display: flex;
  flex-direction: column;
  max-width: 720px;
  height: 100vh;
  margin: 0 auto;
  background: var(--color-card);
  box-shadow: var(--shadow-md);
}

/* Header */
.chat-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--color-border);
  background: #fff;
  display: flex;
  align-items: center;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo {
  width: 40px; height: 40px; border-radius: 50%;
  object-fit: contain;
}
.brand-mark {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--color-accent); color: #fff;
  display: none; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; letter-spacing: 0.5px;
}
.brand-title { font-weight: 600; font-size: 15px; line-height: 1.2; }
.brand-sub { color: var(--color-muted); font-size: 12px; }

/* Body */
.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--color-bg);
}

.message {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 14.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
  box-shadow: var(--shadow-sm);
  animation: fade-in 160ms ease-out;
}
.message.user {
  align-self: flex-end;
  background: var(--color-user-bubble);
  color: var(--color-user-text);
  border-bottom-right-radius: 4px;
}
.message.assistant {
  align-self: flex-start;
  background: var(--color-assistant-bubble);
  color: var(--color-assistant-text);
  border-bottom-left-radius: 4px;
}
.message.system {
  align-self: center;
  background: transparent;
  color: var(--color-muted);
  font-size: 12px;
  box-shadow: none;
  text-align: center;
}

.ticket-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 4px 10px;
  background: var(--color-accent-dark);
  color: #fff;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.3px;
  font-weight: 600;
}

.typing-indicator {
  display: inline-flex; gap: 4px; padding: 6px 0;
}
.typing-indicator span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--color-muted);
  animation: blink 1.2s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

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

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

/* Footer / input */
.chat-footer {
  border-top: 1px solid var(--color-border);
  background: #fff;
  padding: 10px 14px 12px;
}
.chat-form {
  display: flex; align-items: center; gap: 8px;
}
.icon-btn {
  background: transparent; border: none; cursor: pointer;
  font-size: 20px; padding: 6px; color: var(--color-muted);
  transition: color 150ms;
}
.icon-btn:hover { color: var(--color-accent-dark); }

#chat-input {
  flex: 1;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 14.5px;
  font-family: inherit;
  outline: none;
  background: var(--color-bg);
  transition: border-color 150ms;
}
#chat-input:focus { border-color: var(--color-accent); }

.send-btn {
  padding: 10px 18px;
  background: var(--color-accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 150ms;
}
.send-btn:hover { background: var(--color-accent-dark); }
.send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.chat-hint {
  margin-top: 8px;
  text-align: center;
  color: var(--color-muted);
  font-size: 11.5px;
}

@media (max-width: 640px) {
  .chat-shell { height: 100svh; max-width: 100%; }
  .message { max-width: 85%; font-size: 14px; }
}
