/* DESTINO -- pantalla del chat (chat.html) */

@keyframes pulse {
  0%,
  100% {
    opacity: 0.4;
  }
  50% {
    opacity: 1;
  }
}

/* En escritorio el fondo cubre toda la pantalla y la columna queda centrada */
.chat-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  background: #06130e;
}

.chat {
  position: relative;
  width: 100%;
  max-width: 460px;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: #06130e;
  color: #f4e9cf;
  font-family: 'Manrope', system-ui, sans-serif;
  overflow: hidden;
}

.chat-hero {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 320px;
  object-fit: cover;
  object-position: 50% 25%;
  opacity: 0.22;
  pointer-events: none;
}

.chat-hero-shade {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 320px;
  background: linear-gradient(180deg, rgba(6, 19, 14, 0.2), #06130e);
  pointer-events: none;
}

/* ---------- Encabezado ---------- */
.chat-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(232, 185, 80, 0.25);
  background: rgba(6, 19, 14, 0.85);
}

.back-btn {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid rgba(232, 185, 80, 0.35);
}

.chat-brand {
  flex-grow: 1;
  min-width: 0;
}
.chat-logo {
  height: 30px;
  width: auto;
  display: block;
}
.chat-brand .status {
  margin-top: 4px;
}

/* ---------- Mensajes ---------- */
.chat-list {
  display: contents;
}

.chat-messages {
  position: relative;
  z-index: 2;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(232, 185, 80, 0.4) transparent;
}

.msg {
  max-width: 86%;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.msg-narrow {
  max-width: 82%;
}

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

.msg-player {
  align-self: flex-end;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  max-width: 82%;
  background: linear-gradient(180deg, #f3cf70, #d29a2a);
  color: #2a1600;
  border-radius: 18px 18px 4px 18px;
  padding: 11px 14px;
  font-size: 14px;
  line-height: 1.4;
  font-weight: 600;
}

/* Imágenes (del jugador o del cajero) */
.msg-image {
  padding: 6px;
  white-space: normal;
}
.msg-image img {
  display: block;
  max-width: 100%;
  max-height: 280px;
  border-radius: 12px;
  object-fit: contain;
}
.msg-player.msg-image {
  background: linear-gradient(180deg, #f3cf70, #d29a2a);
}

/* Link que manda el bot (p. ej. para jugar): botón dorado dentro de la burbuja */
.msg-link {
  display: flex;
  width: fit-content;
  max-width: 100%;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  margin-top: 10px;
  padding: 0 18px;
  border-radius: 12px;
  font-size: 15px;
  letter-spacing: 0.04em;
  text-decoration: none;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.1;
  text-align: center;
}

/* Botón "Transferí" */
.btn-transfer {
  align-self: flex-start;
  gap: 8px;
  height: 48px;
  padding: 0 22px;
  border-radius: 14px;
  font-size: 15px;
  letter-spacing: 0.04em;
  text-decoration: none;
}

/* Formulario inline de "Transferí" (titular + monto) */
.pay-form {
  align-self: flex-start;
  width: 86%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(14, 59, 44, 0.9);
  border: 1px solid rgba(232, 185, 80, 0.35);
  border-radius: 4px 18px 18px 18px;
  padding: 14px;
}
.pay-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pay-input {
  width: 100%;
  min-width: 0;
  height: 46px;
  border-radius: 12px;
  border: 1px solid rgba(232, 185, 80, 0.45);
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  font-size: 15px;
  padding: 0 12px;
  font-family: inherit;
}
.pay-error {
  font-size: 12px;
  color: #ffb4a8;
}
.pay-actions {
  display: flex;
  gap: 8px;
}
.pay-btn {
  flex: 1 1 0;
  height: 44px;
  border-radius: 12px;
  font-family: inherit;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.pay-btn:disabled {
  opacity: 0.6;
  cursor: default;
}
.pay-btn-ghost {
  background: transparent;
  color: #ffd978;
  border: 1px solid rgba(232, 185, 80, 0.5);
}
.pay-btn-gold {
  border: 0;
  color: #2a1600;
  background: linear-gradient(180deg, #ffe58a, #c98a1b);
}

/* "Escribiendo…" */
.typing {
  align-self: flex-start;
  background: rgba(14, 59, 44, 0.9);
  border: 1px solid rgba(232, 185, 80, 0.25);
  border-radius: 4px 18px 18px 18px;
  padding: 12px 16px;
  display: flex;
  gap: 5px;
}
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ffd978;
  animation: pulse 1.2s ease-in-out infinite;
}
.dot:nth-child(2) {
  animation-delay: 0.2s;
}
.dot:nth-child(3) {
  animation-delay: 0.4s;
}

/* ---------- Barra de entrada ---------- */
.chat-bar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 12px 22px;
  padding-bottom: max(22px, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(232, 185, 80, 0.25);
  background: rgba(6, 19, 14, 0.95);
}

.chat-input {
  flex-grow: 1;
  min-width: 0;
  height: 48px;
  border-radius: 14px;
  border: 1px solid rgba(232, 185, 80, 0.45);
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  font-size: 15px;
  padding: 0 14px;
  font-family: inherit;
}

.send-btn {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  border: 0;
  background: linear-gradient(180deg, #ffe58a, #c98a1b);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.send-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

/* ---------- Escritorio: fondo que cubre la pantalla, columna centrada ---------- */
@media (min-width: 521px) {
  .chat-shell {
    background: radial-gradient(1100px 620px at 50% -8%, rgba(14, 59, 44, 0.7), #06130e 70%);
  }
  .chat {
    box-shadow: 0 0 0 1px rgba(232, 185, 80, 0.15), 0 24px 80px rgba(0, 0, 0, 0.6);
  }
}

@media (prefers-reduced-motion: reduce) {
  .dot {
    animation: none !important;
  }
}
