/* ============================================================
   Menti — el asistente del Sistema Contable (Mente Corporativa):
   el foco con audífonos del Aula Virtual, con los colores de este
   sistema en su globo (2026-10; antes era un robot).
   Ver static/js/mascota.js.
   ============================================================ */

.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; }
/* Pegado al borde izquierdo: el globo se alinea a la izquierda.
   Pegado arriba: el globo se abre debajo de Menti. */
.mc-menti--izq { align-items: flex-start; }
.mc-menti--arriba { flex-direction: column-reverse; }

.mc-menti__bubble {
  position: relative;
  background: #fff;
  border: 1px solid var(--iv-line, #E4E9F2);
  border-top: 3px solid var(--iv-blue, #155F8C);
  border-radius: 7px;
  padding: 14px 36px 12px 16px;
  width: max-content;
  max-width: 320px;
  overflow-y: auto;
  overscroll-behavior: contain;
  box-shadow: 0 14px 32px rgba(15, 27, 51, .16);
}
.mc-menti__name {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: #9E1B32;
  margin-bottom: 4px;
}
.mc-menti__text {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--iv-ink, #0F1B33);
  white-space: pre-line;   /* los textos de las casillas usan saltos de línea */
}
.mc-menti__titulo {
  display: block;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--iv-ink, #0F1B33);
  margin-bottom: 4px;
}
.mc-menti__parrafo { display: block; }
.mc-menti__parrafo + .mc-menti__parrafo { margin-top: 7px; }

.mc-menti__acciones {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 11px;
}
.mc-menti__acciones[hidden] { display: none; }
.mc-menti__btn {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--iv-line, #D9DEE8);
  background: #fff;
  color: var(--iv-blue-deep, #0F4A6E);
  border-radius: 4px;
  padding: 7px 11px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}
.mc-menti a.mc-menti__btn { color: var(--iv-blue-deep, #0F4A6E); }
.mc-menti__btn:hover, .mc-menti a.mc-menti__btn:hover { background: var(--iv-blue-pale, #EAF3F9); }
.mc-menti__btn--principal,
.mc-menti a.mc-menti__btn--principal { background: var(--iv-blue, #155F8C); border-color: var(--iv-blue, #155F8C); color: #fff; }
.mc-menti__btn--principal:hover,
.mc-menti a.mc-menti__btn--principal:hover { background: var(--iv-blue-deep, #0F4A6E); color: #fff; }
.mc-menti__btn--suave { border-color: transparent; background: var(--iv-surface, #EDEFF2); color: #4B5563; }

/* Atajos «Ir a:»: enlaces compactos. */
.mc-menti__ir {
  flex-basis: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  padding: 9px 0 4px;
  margin-top: 3px;
  border-top: 1px solid var(--iv-line, #E4E9F2);
  font-size: 12.5px;
}
.mc-menti__ir-t { color: #4B5563; font-weight: 700; }
.mc-menti .mc-menti__ir a { color: var(--iv-blue-deep, #0F4A6E); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.mc-menti .mc-menti__ir a:hover { color: #9E1B32; }
/* Ajustes (cambiar de lugar, no avisar hoy, apagar): discretos, al final. */
.mc-menti__btn--ajuste {
  border: none;
  background: none;
  padding: 4px 6px 2px 0;
  margin-right: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #4B5563;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.mc-menti__btn--ajuste:hover { background: none; color: var(--iv-ink, #0F1B33); }
.mc-menti__pie {
  display: block;
  margin-top: 8px;
  font-size: 11.5px;
  font-weight: 600;
  color: #4B5563;
}
.mc-menti__pie[hidden] { display: none; }
.mc-menti__btn:focus-visible, .mc-menti__close:focus-visible, .mc-menti__robot-btn:focus-visible,
.mc-menti .mc-menti__ir a:focus-visible {
  outline: 2px solid var(--iv-blue, #155F8C);
  outline-offset: 2px;
}

.mc-menti__close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: var(--iv-surface, #F0F2F4);
  color: #4B5563;  /* 6,7:1 sobre el fondo (auditoría 2026-10, U2-17) */
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}
.mc-menti__close:hover { background: var(--iv-line, #E5E7EB); color: var(--iv-ink, #0F1B33); }

.mc-menti__robot-btn {
  position: relative;
  background: none;
  border: none;
  padding: 0;
  cursor: grab;
  line-height: 0;
  touch-action: none;   /* para poder arrastrarlo en el celular */
}
.mc-menti--arrastrando { transition: none; }
.mc-menti--arrastrando .mc-menti__robot-btn { cursor: grabbing; }
.mc-menti--arrastrando .mc-menti__bubble { display: none; }
.mc-menti__robot {
  width: 72px;
  height: auto;
  display: block;
  overflow: visible;
  filter: drop-shadow(0 8px 14px rgba(11, 31, 58, .2));
}
/* Solo se mueve cuando habla: el movimiento significa «tengo algo que decirte». */
.mc-menti:not(.mc-menti--minimized) .mc-menti__robot,
.mc-menti__robot-btn:hover .mc-menti__robot { animation: mcMentiBob 2.6s ease-in-out infinite; }
.mc-menti__rayos { animation: mcMentiPulse 1.2s ease-in-out infinite; }

/* En reposo: solo la cabeza, sin globo. */
.mc-menti--minimized .mc-menti__bubble,
.mc-menti--sinburbuja .mc-menti__bubble { display: none; }
.mc-menti--minimized .mc-menti__sombra,
.mc-menti--minimized .mc-menti__cuerpo { display: none; }
.mc-menti--minimized .mc-menti__robot { width: 48px; }

/* Puntito: Menti tiene una explicación nueva de esta pantalla. */
.mc-menti__punto {
  position: absolute;
  top: 0;
  right: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #9E1B32;
  border: 2px solid #fff;
  animation: mcMentiPulse 1.8s ease-in-out infinite;
}
.mc-menti__punto[hidden] { display: none; }

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

/* Lo que Menti está señalando (recorridos y explicaciones). */
.mc-menti-foco {
  outline: 3px solid #F59E0B !important;
  outline-offset: 4px;
  border-radius: 4px;
  animation: mcMentiFoco 1.6s ease-in-out infinite;
}
@keyframes mcMentiFoco {
  0%, 100% { outline-color: rgba(245, 158, 11, 1); }
  50% { outline-color: rgba(245, 158, 11, .35); }
}

@media (max-width: 480px) {
  .mc-menti__bubble { max-width: calc(100vw - 24px); padding: 12px 32px 11px 14px; }
  .mc-menti__robot { width: 60px; }
  .mc-menti--minimized .mc-menti__robot { width: 44px; }
}

/* ============================================================
   Formularios: Menti desplazándose hacia una casilla
   (static/js/mascota-simulador.js).
   ============================================================ */
.mc-menti--roaming {
  transition: left .55s cubic-bezier(.4,0,.2,1), top .55s cubic-bezier(.4,0,.2,1);
}
.mc-menti.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(--iv-blue, #155F8C);
  color: #fff;
  border: none;
  border-radius: 6px;
  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(--iv-blue-deep, #0F4A6E); }

@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; }
}

/* Quien prefiere menos movimiento en pantalla: Menti se queda quieto. */
@media (prefers-reduced-motion: reduce) {
  .mc-menti, .mc-menti--roaming { transition: none; }
  .mc-menti__robot, .mc-menti__robot-btn:hover .mc-menti__robot,
  .mc-menti:not(.mc-menti--minimized) .mc-menti__robot,
  .mc-menti__rayos, .mc-menti__punto, .mc-menti--walking .mc-menti__robot, .mc-menti-foco { animation: none; }
}

@media print {
  .mc-menti, .mc-menti-tour-btn { display: none !important; }
}

/* Pantallas táctiles: botón de cerrar de 44 px. */
@media (pointer: coarse) {
  .mc-menti__close { top: 0; right: 0; width: 44px; height: 44px; background: transparent; font-size: 19px; }
  .mc-menti__bubble { padding-right: 44px; }
}

/* ============================================================
   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 pequeño 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; }
}
