/* Información mentora y nueva conversación */
.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(45, 27, 70, 0.35);
}

.modal.hidden {
  display: none;
}

.modal-content {
  width: min(100%, 460px);
  background: white;
  padding: 22px;
  border-radius: 30px;
  text-align: center;
  box-shadow: 0 25px 70px rgba(0,0,0,0.2);
}

.modal-content h3 {
  margin: 0 0 10px;
}

.modal-content p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.6;
}

.modal-buttons {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.mentor-info-card {
  background: linear-gradient(135deg, #f6eefe, #fff1f7);
  border-radius: 20px;
  padding: 10px 14px;
  margin-bottom: 8px;
  border: 1px solid #efdaf9;
}

.mentor-info-card h2 {
  font-size: 1.35rem;
}

.mentor-info-card p {
  font-size: 0.9rem;
  line-height: 1.35;
}
/* Fin información mentora y nueva conversación */

/* Botones */
.primary-button,
.secondary-button,
.brand {
  text-decoration: none;
}

.primary-button,
.secondary-button {
  border-radius: 999px;
  padding: 12px 18px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.primary-button,
.secondary-button {
  background: linear-gradient(135deg, var(--purple-700), var(--pink-500));
  color: white;
  box-shadow: 0 14px 30px rgba(124, 58, 237, 0.24);
}

.primary-button:hover,
.secondary-button:hover,
.brand:hover {
  text-decoration: none;
  transform: translateY(-2px);
}
/* Fin botones */

/* Chat */
.chat-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 16px;
  width: min(920px, calc(100% - 40px));
  margin: 18px auto 32px;
  align-items: start;
}

.chat-sidebar,
.chat-main {
  border-radius: 24px;
  padding: 14px;
}

.chat-sidebar {
  position: sticky;
  top: 18px;
}

.chat-sidebar h2 {
  margin: 0 0 10px;
  font-size: 1.4rem;
}

.agents-container {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 12px;
}

.agent-card {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px;
  text-align: left;
  border-radius: 22px;
  background: rgba(255,255,255,0.86);
  border: 2px solid transparent;
}

.agent-card.selected {
  border-color: rgba(124, 58, 237, 0.38);
  background: linear-gradient(135deg, rgba(124,58,237,0.12), rgba(236,72,153,0.12));
}

.agent-card img {
  width: 50px;
  height: 50px;
  border-radius: 18px;
  object-fit: cover;
  flex-shrink: 0;
}

.agent-card-text {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.agent-card-text span {
  font-size: 12.5px;
  color: var(--text-soft);
  line-height: 1.3;
}

.chat-toolbar {
  display: flex;
  justify-content: flex-end;
  padding: 8px 0 0;
}

.chat-container {
  background: white;
  border-radius: 24px;
  box-shadow: 0 18px 40px rgba(98, 44, 145, 0.12);
  display: flex;
  flex-direction: column;
  height: calc(100svh - 260px);
  min-height: 360px;
  max-height: 500px;
  overflow: hidden;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message {
  max-width: min(80%, 640px);
  padding: 11px 14px;
  border-radius: 24px;
  line-height: 1.45;
  font-size: 0.94rem;
}

.message.user {
  align-self: flex-end;
  color: white;
  background: linear-gradient(135deg, var(--purple-700), var(--pink-500));
  border-bottom-right-radius: 8px;
}

.message.bot {
  align-self: flex-start;
  background: #f8f4ff;
  color: var(--text-main);
  border-bottom-left-radius: 8px;
}

.input-container {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border-top: 1px solid #eadcf7;
  background: rgba(255,255,255,0.82);
}

.input-container input {
  flex: 1;
  min-width: 0;
  padding: 11px 14px;
  border-radius: 999px;
  border: 1px solid rgba(124, 58, 237, 0.16);
  outline: none;
  color: var(--text-main);
  background: white;
  font-size: 17px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

.input-container input:focus {
  border-color: rgba(124, 58, 237, 0.4);
  box-shadow: 0 0 0 4px rgba(124,58,237,0.08);
}

.mobile-input-proxy {
  display: none;
}
/* Fin chat */

/* Recordatorio control parental */
.chat-reminder {
  display: flex;
  align-items: center;
  gap: 8px;

  margin-top: 18px;   
  padding: 8px 10px;

  border-radius: 12px;
  background: rgba(122, 62, 234, 0.06);

  font-size: 0.78rem;
  color: var(--text-soft);
}

.chat-reminder img {
  width: 16px;
  height: 16px;
  opacity: 0.7;
}

.chat-reminder p {
  margin: 0;
}

.mobile-mentor-trigger {
  display: none;
}


/* Typing dots */
.typing-message {
  display: flex;
  align-items: center;
  width: fit-content;
  padding: 14px 18px;
}

.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--purple-700);
  opacity: 0.35;
  animation: typingDot 1.2s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes typingDot {
  0%, 80%, 100% {
    transform: translateY(0);
    opacity: 0.35;
  }

  40% {
    transform: translateY(-5px);
    opacity: 1;
  }
}
/* Fin typing dots */

@media (max-width: 760px) {
  html,
  body.chat-page {
    height: 100%;
    overflow-x: hidden;
    overflow-y: hidden;
  }

  body.chat-page {
    --chat-full-viewport-height: 100dvh;
    --chat-focused-viewport-height: 520px;
    --chat-viewport-height: var(--chat-full-viewport-height);
  }

  body.chat-keyboard-open {
    --chat-viewport-height: var(--chat-focused-viewport-height);
    overflow: hidden;
  }

  body.chat-page .page-shell {
    height: var(--chat-viewport-height);
    min-height: var(--chat-viewport-height);
    overflow: hidden;
  }

  body.chat-page .site-footer {
    display: none;
  }

  .chat-layout {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    grid-template-rows: 72px minmax(0, 1fr);
    gap: 8px;
    width: min(100% - 16px, 430px);
    height: calc(var(--chat-viewport-height) - 136px);
    margin: 10px auto 0;
    position: relative;
  }

  .chat-layout,
  .chat-container,
  .messages,
  .input-container {
    transition: none !important;
  }

  .chat-main {
    display: contents;
  }

  .mobile-mentor-trigger {
    position: relative;
    width: 68px;
    height: 68px;
    padding: 0;
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  .mobile-mentor-trigger::before {
    content: "";
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(122,62,234,.95);
    z-index: 10;
  }

  .mobile-mentor-trigger::after {
    content: "";
    position: absolute;
    top: 5px;
    right: 1px;
    width: 10px;
    height: 2px;
    border-radius: 999px;
    background: white;
    box-shadow: 0 4px 0 white, 0 8px 0 white;
    z-index: 11;
  }

  .mobile-mentor-trigger img {
    width: 68px;
    height: 68px;
    border-radius: 18px;
    object-fit: cover;
  }

  .mobile-mentor-trigger:active {
    transform: scale(0.96);
  }

  .chat-sidebar {
    display: none;
  }

  .chat-sidebar.is-open {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 270px;
    padding: 10px;
    border-radius: 22px;
    background: rgba(255,255,255,.97);
    box-shadow: 0 18px 46px rgba(105,63,170,.22);
    z-index: 60;
  }

  .chat-sidebar h2,
  .chat-reminder {
    display: none;
  }

  .agents-container {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .agent-card {
    display: flex;
    width: 100%;
    min-height: 58px;
    padding: 8px;
    gap: 10px;
    border-radius: 18px;
    align-items: center;
  }

  .agent-card img {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    object-fit: cover;
  }

  .agent-card-text {
    display: flex;
    flex-direction: column;
  }

  .agent-card-text span {
    font-size: .74rem;
    line-height: 1.2;
  }

  .mentor-info-card {
    grid-column: 2;
    grid-row: 1;
    height: 72px;
    margin: 0;
    padding: 8px 10px;
    border-radius: 18px;
    display: grid;
    grid-template-columns: minmax(0,1fr) 78px;
    grid-template-rows: auto auto;
    column-gap: 10px;
    align-items: center;
  }

  .mentor-info-card h2 {
    grid-column: 1;
    grid-row: 1;
    margin: 0;
    font-size: 1rem;
    line-height: 1;
  }

  .mentor-info-card p {
    grid-column: 1;
    grid-row: 2;
    margin: 0;
    font-size: .70rem;
    line-height: 1.15;
  }

  .chat-toolbar {
    grid-column: 2;
    grid-row: 1 / 3;
    padding: 0;
    align-self: center;
    justify-self: end;
  }

  .chat-toolbar .secondary-button {
    width: 86px;
    min-height: 42px;
    padding: 6px 10px;
    border-radius: 15px;

    font-size: .64rem;
    line-height: 1.08;
    white-space: normal;
    text-align: center;

    box-shadow: none;
  }
  .chat-container {
    grid-column: 1 / -1;
    grid-row: 2;
    height: 100%;
    min-height: 0;
    max-height: none;
    border-radius: 24px;
  }

  .messages {
    padding: 12px;
  }

  .message {
    max-width: 88%;
    padding: 10px 12px;
    font-size: .88rem;
    line-height: 1.4;
  }

  .input-container {
    padding: 8px;
    gap: 8px;
  }

  .input-container input {
    height: 42px;
    padding: 0 14px;
    font-size: 17px !important;
    line-height: 1.2;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    transform: none;
  }

  .input-container .chat-input-native {
    position: fixed;
    top: env(safe-area-inset-top, 0);
    left: 0;
    width: 1px;
    height: 44px;
    padding: 0;
    border: 0;
    opacity: 0;
    pointer-events: none;
  }

  .mobile-input-proxy {
    display: flex;
    flex: 1;
    min-width: 0;
    height: 42px;
    align-items: center;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid rgba(124, 58, 237, 0.16);
    background: white;
    color: #8f879c;
    font: inherit;
    font-size: 17px;
    line-height: 1.2;
    text-align: left;
    overflow: hidden;
  }

  .mobile-input-proxy span {
    display: block;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .mobile-input-proxy.has-text {
    color: var(--text-main);
  }

  .mobile-input-proxy.is-focused {
    border-color: rgba(124, 58, 237, 0.4);
    box-shadow: 0 0 0 4px rgba(124,58,237,0.08);
  }

  .input-container .primary-button {
    width: auto;
    min-width: 82px;
    height: 42px;
    padding: 0 16px;
    font-size: .9rem;
  }

  .input-container:focus-within {
    padding-bottom: 8px;
  }

}
