/* CONTAINER DO CHAT */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 5px;
  overflow-y: auto;
  
}

/* BASE DA MENSAGEM */
.chat-message {
  display: inline-block;
  width: fit-content;
  max-width: 85%;
  padding: 5px 10px;
  border-radius: 5px;
  line-height: 1.4;
  word-wrap: break-word;
  color: var(--color-black);
  font-size: 18px;
  background-color: var(--color-white);
}

/* PROFESSOR (ESQUERDA) */
.chat-message.system {
  align-self: flex-start;
  background-color: var(--color-white);
  color: var(--color-black);
  border-top-left-radius: 2px;
}

/* ALUNO (DIREITA) */
.chat-message.user {
  align-self: flex-end;
  background: var(--color-primary-light);
  color: var(--color-black);
  border-top-right-radius: 2px;
}

/* PROFESSOR ATIVO (FALANDO) */
.chat-message.system.active {
  box-shadow: 0 0 8px rgba(59,130,246,0.5);
}

/* FEEDBACK */
.chat-message.system.correto {
  background: var(--color-success-light);
  border-left: 4px solid var(--color-success);
}

.chat-message.system.errado {
  background: var(--color-danger-light);
  border-left: 4px solid var(--color-danger);
}

.chat-message.falando {
  background-color: var(--color-warning-light);
}

.info-lesson{
  background-color: var(--color-sidebar);
}

/* INPUT ENVIAR O CHAT */
.inline-input {
  display: flex;
  align-items: center;
  width: 100%;
  margin-top: 2px;
  padding: 2px;
  overflow: hidden;
  flex-shrink: 0;
}

.inline-input input {
  flex: 1 1 auto;     /* pode encolher */
  min-width: 0;       /* ESSENCIAL em mobile */
}

.inline-input input[type="text"] {
  flex: 1;
  height: 50px;
  padding: 10px;
  font-size: 20px;
  border-radius: 5px;
  border: 1px solid var(--color-secondary-light);
}

.inline-input input[type="text"]::placeholder {
  color: var(--color-secondary-light);
  opacity: 1;
}

#btnEnviar{
    font-size: 17px;
    height: 50px;
    margin-left: 3px;
}
#btn-mic{
   height: 50px;
   margin-left: 3px;
   font-size: 25px;
}

.painel-master {  
  justify-content: center;
  margin: 5px 0;
  background-color: var(--color-white);
  padding: 5px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  height: 60px;
  overflow: hidden; /* impede escapar */
  max-width: 100%; /* impede escapar */
  box-sizing: border-box; /* impede escapar */
}

.painel-master > * {
  min-width: 0;
}

.tempontos {
    background-color: var(--color-base-btn);
    padding: 1px 6px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* ou center */
    gap: 4px;
}

.play-m {
    background-color: var(--color-base-btn);
    padding: 3px 3px;
    border-radius: 10px;
    display: flex;
    align-items: center;
}

.mic-ready { background: var(--color-success); }
.mic-disabled { background: var(--color-secondary); opacity: .4; }
.mic-gravando { background: var(--color-danger); }

.btn-ready { background: var(--color-success); }
.btn-disabled { background: var(--color-secondary); opacity: .4; }


/* BOTAO AUTOCLICK */
#btnAutoMic {
  width: 55px;
  padding: 8px 8px;
  border-radius: 10px;
  font-size: 16px;
  cursor: pointer;
  border: none;

  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.2;
}

/* AUTO SKIP  */
#btnAutoSkip {
  width: 55px;
  padding: 8px 8px;
  border-radius: 10px;
  font-size: 16px;
  cursor: pointer;
  border: none;

  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.2;
}

.auto-on {
  background: var(--color-success-light);
  color: var(--color-black);
}

.auto-off {
  background: var(--color-base-btn);
  color: var(--color-sidebar);
  font-weight: 700;
}

.auto-on {
  background: var(--color-success-light);
  color: var(--color-black);
}

/* BOTÃO START DESABILITADO */
#btn-start:disabled {
  background: var(--color-secondary-light);
  color: var(--color-secondary);
  cursor: not-allowed;
  filter: grayscale(100%);
  opacity: 0.6;
  box-shadow: none;
}

/* remove hover quando desabilitado */
#btn-start:disabled:hover {
  background: var(--color-secondary-light);
}

#btn-stop:disabled {
  background: var(--color-secondary-light);
  color: var(--color-secondary);
  cursor: not-allowed;
  filter: grayscale(100%);
  opacity: 0.6;
  box-shadow: none;
}

/* remove hover quando desabilitado */
#btn-stop:disabled:hover {
  background: var(--color-secondary-light);
}
/* FIM BOTÃO START DESABILITADO */

/* TOOLTIP — SOMENTE FRASES QUE EXIGEM RESPOSTA (data-expected) */
/* base da mensagem precisa permitir tooltip */
.chat-message {
  overflow: visible;
}

/* somente mensagens com expected */
.chat-message[data-expected]:not([data-expected=""]) {
  position: relative;
  cursor: help;
}

/* TOOLTIP PADRÃO — aparece EM CIMA */
.chat-message[data-expected]:not([data-expected=""]):hover::after {
  content: attr(data-expected);
  position: absolute;

  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 6px;

  background: var(--color-secondary);
  color: var(--color-warning-light);
  padding: 6px 10px;
  border-radius: 6px;

  font-size: 13px;
  white-space: nowrap;

  z-index: 9999;
  pointer-events: none;
}

/* SETINHA — PADRÃO (para cima) */
.chat-message[data-expected]:not([data-expected=""]):hover::before {
  content: "";
  position: absolute;

  bottom: calc(100% - 1px);
  left: 50%;
  transform: translateX(-50%);

  border-width: 6px;
  border-style: solid;
  border-color: #222 transparent transparent transparent;

  z-index: 9998;
}

.chat-area .chat-message:first-child[data-expected]:not([data-expected=""]):hover::after {
  bottom: auto;
  top: 100%;
  margin-bottom: 0;
  margin-top: 6px;
}

.chat-area .chat-message:first-child[data-expected]:not([data-expected=""]):hover::before {
  bottom: auto;
  top: calc(100% - 1px);
  border-color: transparent transparent #222 transparent;
}
/*FIM TOOLTIP — SOMENTE FRASES QUE EXIGEM RESPOSTA (data-expected) */

/* MODAL NIVEL */
.nivel-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 99999;
}

.nivel-box {
  position: fixed;
  top: 41%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #1c2533;
  color: #fff;
  width: 90%;
  max-width: 500px;
  padding: 24px 28px;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  text-align: center;
}

.nivel-box h3 {
  margin-bottom: 10px;
  font-size: 16px;
  font-weight: 600;
}

.nivel-box label {
  display: block;
  margin: 10px 0;
  font-size: 14px;
  cursor: pointer;
}

.nivel-box input[type="radio"] {
  margin-right: 8px;
}

#btn-salvar-nivel {
  margin-top: 18px;
  width: 100%;
  padding: 10px;
  background: #ffb300;
  color: #1c2533;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

#btn-salvar-nivel:hover {
  background: #ffc94d;
}

/* ANIMAÇÃO */
@keyframes modalFade {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.nivel-close {
  position: absolute;
  top: 10px;
  right: 12px;

  background: transparent;
  border: none;

  font-size: 22px;
  color: #ccc;
  cursor: pointer;
  line-height: 1;
}

.nivel-close:hover {
  color: #fff;
}
/* FIM MODAL NIVEL */

.mic-alert {
  animation: micFlash 2s ease-in-out 1;
  border: 2px solid #f5c400 !important;
}

@keyframes micFlash {
  0%   { box-shadow: 0 0 0 rgba(245,196,0,0); }
  50%  { box-shadow: 0 0 10px rgba(245,196,0,.9); }
  100% { box-shadow: 0 0 0 rgba(245,196,0,0); }
}

.mic-alert::after {
  content: " ⚠️";
}


/* MOBILE */
@media (max-width: 520px) {
  .chat-message {
    width: fit-content;
    max-width: 85%;
    font-size: 16px;
  }
}