:root {
  --chat-primary: #1e63ff;
  --chat-bg: #f5f7fb;
}

body {
  min-height: 100vh;
  margin: 0;
  background: radial-gradient(circle at top left, #e3f0ff, #f5f7fb);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.chat-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.chat-card {
  width: 100%;
  max-width: 768px; /*420px*/
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 14px 35px rgba(15, 23, 42, 0.14);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 90vh; /* altura relativa */ /*80vh editado*/
  /*max-height: 720px; tope en pantallas grandes */
}

/* ===== HEADER ===== */
/* === NUEVO: Header en tres columnas === */
.chat-header {
  position: relative;
  background-image: url("https://img.freepik.com/fotos-premium/ai-office-worker_992642-922.jpg");
  background-size: cover;
  background-position: center;
  height: 80px;
  min-height: 80px;
  color: #fff;
  display: flex;
  align-items: center;
}

.chat-header::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(15, 23, 42, 0.85), rgba(15, 23, 42, 0.5));
}

.chat-header-inner {
  position: relative;
  z-index: 10;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
}

/* IZQUIERDA */
.header-left {
  flex: 0 0 auto;
}

.header-logo {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 3px solid #fff;
  background: #fff;
  object-fit: cover;
  box-shadow: 0 6px 14px rgba(0,0,0,0.25);
}

/* CENTRO */
.header-center {
  flex: 1;
  text-align: center;
  margin: 0 10px;
}

.header-center .chat-company-name {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
}

.header-center .chat-company-email {
  font-size: 0.8rem;
  opacity: 0.9;
}

/* DERECHA */
.header-right {
  flex: 0 0 auto;
}

.header-menu-btn {
  background: transparent;
  border: none;
  font-size: 1.45rem;
  color: #fff;
  cursor: pointer;
  padding: 5px;
  opacity: 0.9;
}

.header-menu-btn:hover {
  opacity: 1;
}
/* ===== //HEADER ===== */
/* === DROPDOWN (estilo WhatsApp) === */
.chat-dropdown {
  position: absolute;
  top: 65px;
  right: 12px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
  overflow: hidden;
  display: none;
  z-index: 999;
  min-width: 170px;
  animation: fadeMenu 0.15s ease-out;
}

.chat-dropdown a,
.chat-dropdown button {
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  font-size: 0.9rem;
  border: none;
  background: #ffffff;
  color: #333;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease;
}

.chat-dropdown a:hover,
.chat-dropdown button:hover {
  background: #f0f0f0;
}

/* Animación de aparición */
@keyframes fadeMenu {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
/* === //DROPDOWN (estilo WhatsApp) === */

/* ===== CUERPO DEL CHAT ===== */
.chat-body {
  flex: 1 1 auto;
  background: var(--chat-bg);
  padding: 3.5rem 0.75rem 0.75rem; /* espacio para el avatar */
  overflow-y: auto;
}

.chat-messages {
  padding: 0 0.25rem;
}

.msg-row {
  display: flex;
  margin-bottom: 0.75rem;
}

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

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

.msg-bubble {
  max-width: 95%; /*85%*/
  padding: 0.6rem 0.85rem;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.4;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.06);
}

.msg-bubble img{
  max-width: 80%;
}

.msg-bubble.bot {
  background: #ffffff;
  color: #111827;
  border-bottom-left-radius: 4px;
}

.msg-bubble.user {
  background: var(--chat-primary);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.msg-meta {
  font-size: 0.7rem;
  opacity: 0.65;
  margin-top: 0.2rem;
}

/* Botones tipo menú dentro del mensaje del bot */
.bot-menu {
  margin-top: 0.55rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.bot-menu button {
  border-radius: 999px;
  border: 1px solid var(--chat-primary);
  background: #ffffff;
  color: var(--chat-primary);
  font-size: 0.8rem;
  padding: 0.3rem 0.5rem; /*0.3rem 0.75rem*//*editado*/
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.05s ease;
}

.bot-menu button:hover {
  background: var(--chat-primary);
  color: #ffffff;
  transform: translateY(-1px);
}

.bot-menu button:disabled {
  opacity: 0.45;
  cursor: default;
  background: #e5e7eb;
  color: #9ca3af;
  border-color: #d1d5db;
  transform: none;
}

/* ===== INPUT ===== */
.chat-footer {
  flex: 0 0 auto;
  border-top: 1px solid rgba(148, 163, 184, 0.35);
  background: #ffffff;
  padding: 0.55rem 0.75rem 0.7rem;
}

.chat-footer .form-control {
  border-radius: 999px;
  font-size: 0.9rem;
  border-color: transparent;
  background-color: #f3f4f6;
}

.chat-footer .form-control:focus {
  box-shadow: none;
  border-color: var(--chat-primary);
  background-color: #ffffff;
}

.chat-send-btn {
  border-radius: 999px;
  border: none;
  background: var(--chat-primary);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  margin-left: 0.35rem;
  flex-shrink: 0;
}

.chat-send-btn i {
  font-size: 1rem;
}

/* Scrollbar más discreto (solo desktop) */
@media (min-width: 768px) {
  .chat-body::-webkit-scrollbar {
    width: 6px;
  }
  .chat-body::-webkit-scrollbar-track {
    background: transparent;
  }
  .chat-body::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.8);
    border-radius: 999px;
  }
}

/* Ajustes en pantallas muy pequeñas 576px */
@media (max-width: 768px) {
  html, body {
    overflow: hidden;
  }
  .chat-card {
    /*height: 100vh;*/ /*agregado*/
    /*height: 100dvh;*/ /*88vh / 90vh*/ /*editado*/
    height: calc(var(--vh) * 100);
    max-height: calc(var(--vh) * 100); /*none*/ /*editado*/
    max-width: none; /*agregado*/
    box-shadow:none; /*agregado*/
    border-radius:0px; /*agregado*/
    display: flex; /*agregado*/
    flex-direction: column; /*agregado*/
  }
  .chat-wrapper{
    align-items: start;
    padding: 0px; /*agregado*/
  }
  /*agregado*/
  .chat-header {
    flex-shrink: 0;
  }
  .chat-footer{
    padding: 1rem 1rem 2rem; 
    flex-shrink: 0; /*agregado*/
  }
  .msg-bubble img{
    max-width: 90%;
  }
  /*agregado*/

}