/* ---------- RESET SIMPLE ---------- */

body { 
  outline: 8px solid red !important; 
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  background: #e9edf3;
  min-height: 100vh;

  display: flex;
  align-items: stretch;
  justify-content: flex-start;

  padding-top: env(safe-area-inset-top);
}



/* ---------- CONTENEDOR PRINCIPAL ---------- */
.app {
  background: #ffffff;
  width: 100%;
  max-width: 1100px;
  height: 650px;       /* altura fija como antes */
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.13),
    0 0 0 1px rgba(148, 163, 184, 0.15);
  display: flex;
  flex-direction: column;
}

/* ---------- HEADER SUPERIOR ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;

  padding: 16px 22px;
  padding-top: calc(16px + env(safe-area-inset-top));

  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
}



.logo {
  font-weight: 800;
  letter-spacing: 0.12em;
  font-size: 18px;
  color: #111827;
}

.top-tabs {
  display: flex;
  gap: 10px;
  flex: 1;
  justify-content: center;
}

.top-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: #f1f5f9;
  font-size: 13px;
  color: #475569;
  cursor: pointer;
  transition: 0.2s;
  white-space: nowrap;
}

.top-tab:hover {
  background: #e5eaf0;
}

.top-tab.active {
  background: #e3f2ff;
  border-color: #bfdbfe;
  color: #2563eb;
  font-weight: 600;
}

/* Idioma */
.lang-wrapper {
  display: flex;
  align-items: center;
}

.lang-select {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #f9fafb;
  font-size: 13px;
  color: #374151;
}

/* ---------- LAYOUT: IZQ / DER ---------- */
.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 260px 1fr;
  height: 100%;
  min-height: 0;     /* 👈 SUPER IMPORTANTE */
}
/* ---------- BARRA IZQUIERDA ---------- */
.sidebar {
  background: #ffffff;
  border-right: 1px solid #e2e8f0;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
}

.section h3 {
  font-size: 14px;
  margin-bottom: 10px;
  color: #334155;
  font-weight: 600;
}

/* Lista lateral */
.chip-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chip {
  padding: 8px 12px;
  border-radius: 14px;
  background: #f1f5f9;
  color: #374151;
  font-size: 13px;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  text-align: left;
}

.chip:hover {
  background: #e5eaf0;
}

.chip--active {
  background: #e3f2ff;
  border-color: #bfdbfe;
  color: #2563eb;
  font-weight: 600;
}

/* ---------- CHAT AREA DERECHA ---------- */
.chat-area {
  display: flex;
  flex-direction: column;
  background: #f7f7f7;
  min-height: 0;     /* 👈 SIN ESTO EL CHAT SE COME EL INPUT */
}


/* Cabecera del chat */
.chat-header {
  padding: 20px 22px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Flecha volver (solo móvil) */
.back-btn {
  display: none;
  border: none;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  color: #4b5563;
  padding: 4px;
  border-radius: 999px;
}

.chat-header-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-title {
  font-size: 18px;
  font-weight: 700;
  color: #111827;
}

.chat-subtitle {
  font-size: 13px;
  color: #6b7280;
}

/* Mensajes */
.messages {
  flex: 1;
  overflow-y: auto; 
  min-height: 0;     /* 👈 Asegura que la zona se comprima bien */
}

.message {
  max-width: 70%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.35;
  white-space: pre-wrap;
}

.message--sent {
  margin-left: auto;
  background: #dbeafe;
  color: #1e3a8a;
  border-bottom-right-radius: 6px;
}

.message--received {
  margin-right: auto;
  background: #ffffff;
  color: #1f2937;
  border-bottom-left-radius: 6px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.message-meta {
  margin-top: 4px;
  font-size: 10px;
  color: #94a3b8;
}

/* Input abajo */
.chat-input {
  padding: 10px 16px;
  background: #f9fafb;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;        /* 👈 evita que desaparezca */
}

#userInput {
  flex: 1;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  font-size: 14px;
  outline: none;
  background: #ffffff;
}

#userInput:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.2);
}

/* Contenedor de los dos botones (Enviar + Mic) */
.chat-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Botón ENVIAR */
.btn-send {
  height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  border: none;
  background: #2563eb;
  color: #ffffff;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.35);
  font-size: 14px;
  white-space: nowrap;
}

.btn-send:hover {
  transform: translateY(-2px);
}

/* Botón MIC */
.btn-mic {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: none;
  background: #2563eb;
  color: #ffffff;
  font-size: 18px;
  cursor: pointer;
  transition: 0.2s;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-mic:hover {
  transform: translateY(-2px);
}

/* ---------- RESPONSIVE: MÓVIL ---------- */
@media (max-width: 768px) {
  body{
    background: #ffffff;
  }

  .app{
    width: 100%;
    max-width: 100%;
    border-radius: 0;

    /* 👇 CLAVE: NO uses height fija en móvil */
    height: auto;
    min-height: 100svh;  /* iPhone moderno */
    min-height: 100vh;   /* fallback */

    overflow: hidden;
    display: flex;
    flex-direction: column;
    /* overflow: hidden; ← ELIMINADA */
  }



  .layout {
    grid-template-columns: 1fr;
  }

  .chat-area {
    display: none;
  }

  .app.mobile-chat .chat-area {
    display: flex;
  }

  .app.mobile-chat .sidebar {
    display: none;
  }

  .back-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}/* =========================
   FIX iPhone / MÓVIL (NO BORRAR)
   ========================= */
@media (max-width: 768px) {

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

  /* Evita el “corte” por alturas fijas y por el Safari de iPhone */
  body {
    padding-top: 0 !important;
    min-height: 100svh;
    min-height: 100dvh;
    overflow: hidden;
  }

  /* IMPORTANTÍSIMO: si tu .app tenía height: 650px o max-width: 1100px, aquí lo anulamos */
  .app {
    width: 100% !important;
    max-width: 100% !important;
    height: 100svh !important;
    height: 100dvh !important;
    border-radius: 0 !important;
    overflow: hidden !important;
  }

  /* Barra superior visible (safe area / notch) */
  .topbar {
    position: sticky !important;
    top: 0 !important;
    z-index: 999 !important;
    padding-top: env(safe-area-inset-top) !important;
  }

  /* Si tu layout es flex/grid, esto evita que el contenido “se salga” */
  .layout, .chat-area {
    min-height: 0 !important;
  }

  /* Área de mensajes: que sea la que scrollea, no toda la página */
  .chat-messages, .messages, .chatMessages {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  /* Input pegado abajo y respeta el safe area inferior */
  .chat-input, .input-area, .composer, .bottom-bar {
    padding-bottom: env(safe-area-inset-bottom) !important;
  }
/* =========================
   TOP TABS: scroll horizontal en móvil
   ========================= */

.top-tabs{
  display: flex;
  flex: 1 1 auto;
  min-width: 0;                 /* CLAVE: permite que el flex no "rompa" */
  gap: 8px;

  overflow-x: auto;             /* CLAVE: permite ver más botones */
  overflow-y: hidden;
  white-space: nowrap;

  -webkit-overflow-scrolling: touch;
  padding: 6px 8px;
}

.top-tabs::-webkit-scrollbar{
  display: none;
}

.top-tab{
  flex: 0 0 auto;               /* cada botón NO se encoge */
}


