/* =========================
   BASE / FONDO HOME
   ========================= */
:root{
  --green-900:#0b3d2c;
  --green-800:#0f5a40;
  --green-700:#137a56;
  --green-500:#18a06f;
  --shadow: 0 18px 50px rgba(0,0,0,.28);
  --radius: 22px;
}

.home-root{
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  position: relative;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;

  background-image: url("/assets/fondo_home.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.home-root::before{
  content:"";
  position:absolute;
  inset:0;
  background: linear-gradient(90deg, rgba(8,46,32,.78), rgba(8,46,32,.58));
}

.home-layout{
  position: relative;
  z-index: 1;
  height: 100%;
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 28px;
  padding: 28px;
}

/* =========================
   PANEL IZQUIERDO (modelo 2)
   ========================= */
.left-panel{
  background: rgba(0,0,0,.18);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  display:flex;
  flex-direction:column;
  gap: 18px;
  backdrop-filter: blur(10px);
}

/* Brand centrado como tu imagen */
.brand.brand-centered{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap: 10px;
  padding: 18px 8px 6px 8px;
}

.brand-logo.big{
  height: 100px;   /* ajusta a gusto */
  width: auto;
  filter: drop-shadow(0 10px 22px rgba(0,0,0,.25));
}

.brand-home.big{
  color: #18a06f;            /* verde como en tu ejemplo */
  font-size: 50px;           /* tamaño grande */
  font-weight: 900;
  line-height: 1;
  margin-top: -6px;          /* acerca “Home” al logo */
  text-shadow: 0 6px 18px rgba(0,0,0,.25);
}
.menu{
  display:flex;
  flex-direction:column;
  gap: 16px;
  margin-top: 6px;
}

.menu-card{
  width:100%;
  text-decoration:none;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(19,122,86,.62);
  border-radius: 18px;
  padding: 18px 16px;
  display:flex;
  align-items:center;
  gap: 14px;
  cursor:pointer;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}

.menu-card:hover{
  transform: translateY(-1px);
  background: rgba(19,122,86,.76);
  border-color: rgba(255,255,255,.22);
}

.menu-icon{
  width:44px;
  height:44px;
  border-radius: 14px;
  background: rgba(255,255,255,.16);
  display:grid;
  place-items:center;
  font-size: 20px;
}

.menu-text{
  color:#fff;
  font-size: 18px;
  font-weight: 900;
}

.social{
  margin-top: auto;
  display: flex;
  justify-content: center;   /* 👈 centra horizontalmente */
  gap: 14px;
  margin-top: auto;
  padding-bottom: 10px;
}

.social-btn{
  width:40px;
  height:40px;
  border-radius: 14px;
  display:grid;
  place-items:center;
  text-decoration:none;
  color: rgba(255,255,255,.90);
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.14);
  transition: transform .12s ease, background .12s ease;
}
.social-btn:hover{
  transform: translateY(-1px);
  background: rgba(255,255,255,.16);
}

/* =========================
   PANEL DERECHO (chat embebido)
   ========================= */
.right-panel{
  position:relative;
  display:flex;
  justify-content:center;
  align-items:center;
}

.chat-card.embedded{
  width: min(760px, 100%);
  height: min(640px, calc(100vh - 56px));
  background: rgba(255,255,255,.94);
  color: #0b1f16;
  border-radius: 28px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(0,0,0,.06);
  display:flex;
  flex-direction:column;
  overflow:hidden;
}

.chat-header{
  padding: 22px 24px 14px 24px;
  border-bottom: 1px solid rgba(0,0,0,.08);
}

.chat-title{
  margin:0;
  font-size: 34px;
  line-height: 1.1;
  font-weight: 900;
}
.chat-subtitle{
  margin: 8px 0 0 0;
  color: rgba(0,0,0,.62);
  font-size: 14px;
}
.accent{ color: var(--green-700); }

/* =========================
   MENSAJES (reusando tu estilo)
   ========================= */
.chat-messages{
  flex: 1;
  padding: 16px 18px;
  overflow-y: auto;
  background: linear-gradient(180deg, rgba(24,160,111,.06), rgba(0,0,0,0));
}

/* Contenedor general */
.msg {
  padding: 10px 14px;
  border-radius: 14px;
  margin-bottom: 10px;
  max-width: 85%;
  word-wrap: break-word;
  font-size: 14px;
  line-height: 1.35;
  animation: pop 0.12s ease-out;
}
@keyframes pop {
  from { transform: scale(0.96); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* MENSAJE DEL USUARIO */
.msg.user {
  background-color: #dff0ff;
  margin-left: auto;
  border-radius: 14px 14px 2px 14px;
  color: #003b5c;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

/* MENSAJE DEL BOT */
.msg.bot {
  background-color: #ffffff;
  margin-right: auto;
  border-radius: 14px 14px 14px 2px;
  color: #222222;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

/* =========================
   INPUT BAR
   ========================= */
.chat-form{
  display:flex;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid rgba(0,0,0,.08);
  background: #fff;
}

.chat-attach{
  width: 42px;
  height: 42px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius: 999px;
  border: 1px solid #cccccc;
  cursor: pointer;
  user-select: none;
  background:#fff;
  font-size: 18px;
}

.chat-input{
  flex:1;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.18);
  padding: 12px 14px;
  font-size: 15px;
  outline:none;
  background-color: #ffffff;
}
.chat-input:focus{
  border-color: rgba(19,122,86,.55);
  box-shadow: 0 0 0 4px rgba(19,122,86,.12);
}

.chat-send{
  border:0;
  border-radius: 999px;
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 900;
  background-color: var(--green-700);
  color: #ffffff;
  cursor: pointer;
}

.mascot{
  position:absolute;
  right: 18px;
  bottom: 18px;
  height: 130px;
  width: auto;
  filter: drop-shadow(0 12px 22px rgba(0,0,0,.35));
  user-select:none;
  pointer-events:none;
  opacity: .95;
}

/* Responsive */
@media (max-width: 980px){
  .home-layout{ grid-template-columns: 1fr; }
  .left-panel{ flex-direction:row; align-items:center; justify-content:space-between; }
  .menu{ flex-direction:row; margin-top:0; }
  .menu-card{ width:auto; }
  .mascot{ display:none; }
}

@media (max-width: 680px){
  .left-panel{ flex-direction:column; align-items:stretch; }
  .menu{ flex-direction:column; }
  .chat-title{ font-size: 26px; }
}

/* =========================
   RANA CON MENSAJES (panel izquierdo)
   ========================= */

.frog-container{
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
}

.frog-img{
  height: 120px;
  width: auto;
  filter: drop-shadow(0 10px 20px rgba(0,0,0,.35));
  animation: frog-bounce 3.5s ease-in-out infinite;
}

/* Animación suave */
@keyframes frog-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* Burbuja de pensamiento */
.frog-thought{
  max-width: 200px;
  background: rgba(255,255,255,.95);
  color: #0b3d2c;
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 18px;
  text-align: center;
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
  position: relative;
  animation: fade-in 0.4s ease;
}

/* “nubecita” de pensamiento */
.frog-thought::after{
  content: "";
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 14px;
  background: white;
  border-radius: 50%;
}

/* Animación aparición */
@keyframes fade-in {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* =========================
   MEJORAS FORMATO MENSAJES (sin cambiar tu estilo)
   ========================= */

/* 1) Respetar saltos de línea y espacios */
.msg{
  white-space: pre-wrap;      /* respeta \n */
  overflow-wrap: anywhere;    /* evita desbordes por palabras largas */
  line-height: 1.5;           /* más legible */
}

/* 2) Separación visual cuando el bot envía texto con líneas */
.msg.bot{
  padding-top: 12px;          /* un poquito más de aire */
  padding-bottom: 12px;
}

/* 3) Si el texto incluye viñetas manuales (•) o saltos, que no se “aplane” */
.chat-messages{
  scroll-behavior: smooth;
}

/* =========================
   AJUSTE: reducir separación en respuestas (más compacto)
   ========================= */

/* Si estás usando white-space: pre-wrap, baja un poco el interlineado */
.msg{
  line-height: 1.1; /* antes 1.5, más compacto */
}

/* Si tu chat ya renderiza Markdown (p/ul/ol), controla sus márgenes */
.msg p{
  margin: 2px 0;     /* reduce separación entre párrafos */
}

.msg ul, .msg ol{
  margin: 4px 0 4px 15px;  /* menos aire en listas */
  padding: 0;
}

.msg li{
  margin: 1px 0;     /* menos separación entre items */
}

/* =========================
   RESPONSIVE MEJORADO (móvil/tablet)
   Pegar al FINAL del CSS
   ========================= */

/* 1) Mejor manejo de altura en móvil (evita cortes por barra del navegador) */
.home-root{
  min-height: 100svh; /* usa viewport dinámico en móviles modernos */
  height: auto;
}

/* 2) Tablets: reduce padding y gap */
@media (max-width: 980px){
  .home-layout{
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 16px;
  }

  .left-panel{
    padding: 14px;
  }

  .right-panel{
    align-items: stretch; /* que el chat ocupe el alto disponible */
  }

  .chat-card.embedded{
    width: 100%;
    height: min(680px, calc(100svh - 32px)); /* más alto, pero sin pasarse */
    border-radius: 22px;
  }
}

/* 3) Móvil: layout en columna + chat a pantalla completa */
@media (max-width: 680px){
  .home-layout{
    padding: 12px;
    gap: 12px;
  }

  /* Panel izquierdo arriba, en “tarjeta compacta” */
  .left-panel{
    flex-direction: column;
    gap: 12px;
  }

  .brand-home.big{
    font-size: 38px; /* baja un poco el título */
  }

  .brand-logo.big{
    height: 78px;
  }

  .menu{
    gap: 10px;
  }

  .menu-card{
    padding: 14px 14px;
    border-radius: 16px;
  }

  .menu-text{
    font-size: 16px;
  }

  /* Chat: ocupar todo el ancho/alto posible */
  .chat-card.embedded{
    width: 100%;
    height: calc(100svh - 24px); /* casi full pantalla */
    border-radius: 18px;
  }

  .chat-header{
    padding: 16px 16px 10px 16px;
  }

  .chat-title{
    font-size: 24px;
  }

  .chat-subtitle{
    font-size: 13px;
  }

  .chat-messages{
    padding: 12px 12px;
  }

  /* Input: más cómodo en móvil */
  .chat-form{
    padding: 10px;
    gap: 8px;
  }

  .chat-input{
    font-size: 16px; /* evita zoom automático en iOS */
    padding: 12px 14px;
  }

  .chat-send{
    padding: 12px 14px;
    font-size: 15px;
  }
}

/* 4) Móvil muy pequeño */
@media (max-width: 420px){
  .chat-title{ font-size: 22px; }
  .menu-text{ font-size: 15px; }
  .msg{ max-width: 92%; }
}

.chat-new{
  margin-top: 10px;
  border: 1px solid rgba(0,0,0,.14);
  background: rgba(255,255,255,.9);
  color: rgba(0,0,0,.72);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.chat-new:hover{
  background: rgba(0,0,0,.04);
}
