/* ============================================================
   Menti — mascota educativa del Sistema Contable (Mente Corporativa)
   Adaptado desde la version del Aula Virtual a la paleta de colores
   de este sistema (ver templates/base.html -> static/css/estilo.css).

   Fase 1: mascota global con mensajes rotativos (activa).
   Fase 2: desplazamiento hacia un campo de formulario (clases listas,
           se activa cuando exista static/js/mascota-simulador.js).
   ============================================================ */

:root {
  --mc-ink: #1F2937;        /* tinta */
  --mc-body-dark: #155F8C;  /* verde-mayor */
  --mc-body: #2A7CAA;       /* verde-mayor-claro */
  --mc-accent: #F59E0B;     /* oro-sol */
  --mc-line: #E5E7EB;       /* linea-regla */
  --mc-bg-alt: #F0F2F4;     /* papel */
  --mc-highlight: #E7EAED;  /* papel-oscuro */
  --mc-muted: #6B7280;      /* texto-suave */
}

.mc-menti {
  position: fixed;
  right: 18px;
  bottom: 18px;
  /* Por debajo de modales (z-index 1000 en este sistema), paneles y
     notificaciones, para que Menti nunca tape algo importante. */
  z-index: 350;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .4s ease, transform .4s ease;
  pointer-events: none;
  font-family: var(--fuente-cuerpo, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
}
.mc-menti--ready { opacity: 1; transform: translateY(0); pointer-events: auto; }

.mc-menti__bubble {
  position: relative;
  background: #fff;
  border: 1px solid var(--mc-line);
  border-radius: 16px;
  padding: 14px 34px 14px 16px;
  max-width: 260px;
  box-shadow: 0 12px 28px rgba(31, 41, 55, .14);
}
.mc-menti__name {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--mc-body-dark);
  margin-bottom: 4px;
}
.mc-menti__text {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--mc-ink);
  transition: opacity .22s ease;
}
.mc-menti__text--fading { opacity: 0; }

.mc-menti__close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: var(--mc-bg-alt);
  color: #4B5563;  /* antes var(--mc-muted) #6B7280: 4,31:1 sobre #F0F2F4; ahora 6,7:1 (auditoría 2026-10, U2-17) */
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}
.mc-menti__close:hover { background: var(--mc-line); color: var(--mc-ink); }

.mc-menti__robot-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: grab;
  line-height: 0;
}
.mc-menti__robot-btn:active { cursor: grabbing; }
.mc-menti__robot {
  width: 66px;
  height: auto;
  display: block;
  filter: drop-shadow(0 10px 18px rgba(31,41,55,.18));
  animation: mcMentiBob 2.6s ease-in-out infinite;
}
.mc-menti-light { animation: mcMentiPulse 1.8s ease-in-out infinite; }

@keyframes mcMentiBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes mcMentiPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}

.mc-menti--minimized .mc-menti__bubble { display: none; }
.mc-menti--minimized .mc-menti__robot { width: 44px; }

@media (max-width: 480px) { /* antes 560px (auditoría 2026-10, UX-20) */
  .mc-menti { right: 12px; bottom: 12px; }
  .mc-menti__bubble { max-width: 200px; padding: 12px 30px 12px 14px; }
  .mc-menti__robot { width: 54px; }
}

@media (prefers-reduced-motion: reduce) {
  .mc-menti__robot { animation: none; }
  .mc-menti-light { animation: none; }
}

/* ============================================================
   Fase 2 (futura): Menti desplazandose hacia un campo de formulario.
   ============================================================ */
.mc-menti--roaming {
  transition: left .55s cubic-bezier(.4,0,.2,1), top .55s cubic-bezier(.4,0,.2,1);
}
.mc-menti--walking .mc-menti__robot {
  animation: mcMentiWalk .5s ease-in-out infinite;
}
@keyframes mcMentiWalk {
  0%, 100% { transform: rotate(-4deg) translateY(0); }
  50% { transform: rotate(4deg) translateY(-3px); }
}

.mc-menti-tour-btn {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 350;
  background: var(--mc-body-dark);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 11px 20px;
  font-family: var(--fuente-cuerpo, 'Segoe UI', sans-serif);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(31,41,55,.22);
}
.mc-menti-tour-btn:hover { background: var(--mc-ink); }

@media (max-width: 480px) { /* antes 560px (auditoría 2026-10, UX-20) */
  .mc-menti-tour-btn { left: 12px; bottom: 12px; padding: 9px 16px; font-size: 12px; }
}

/* ============================================================
   Interruptor de activar/desactivar a Menti, dentro del menu de
   usuario en el banner (templates/base.html, .tb-avatar-panel).
   Usa los colores propios de ese menu (--iv-*, definidos en
   static/css/interior.css) para verse nativo del panel, en vez de
   los colores propios de Menti.
   ============================================================ */
.tb-avatar-panel-separador {
  height: 1px;
  background: var(--iv-line, #E4E9F2);
  margin: 0.3rem 0.2rem;
}

.mc-menti-switch-fila {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.5rem 0.7rem;
  border-radius: 0;
  font-size: 0.87rem;
  color: var(--iv-ink, #0F1B33);
  cursor: pointer;
}
.mc-menti-switch-fila:hover { background: var(--iv-surface, #EDEFF2); }

.mc-menti-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}
.mc-menti-switch input {
  position: absolute;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.mc-menti-switch__riel {
  position: absolute;
  inset: 0;
  background: var(--iv-line, #E4E9F2);
  border-radius: 999px;
  transition: background 0.15s ease;
}
.mc-menti-switch__bola {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(15, 27, 51, 0.3);
  transition: transform 0.15s ease;
}
.mc-menti-switch input:checked ~ .mc-menti-switch__riel { background: var(--iv-blue, #155F8C); }
.mc-menti-switch input:checked ~ .mc-menti-switch__riel .mc-menti-switch__bola { transform: translateX(16px); }
.mc-menti-switch input:focus-visible ~ .mc-menti-switch__riel { outline: 2px solid var(--iv-blue, #155F8C); outline-offset: 2px; }

/* (auditoría 2026-10, U2-01) Con Menti en pantalla (siempre minimizada al
   cargar), el final de cada página deja libre la altura del icono, para que
   nunca quede tapado el último botón o la última fila. En celular ya lo hace
   movil.css (5.5rem). */
@media (min-width: 768.02px) {
  body.mc-menti-presente main.contenido { padding-bottom: 6rem; }
}
