/* Admin — mobile-first. Grid/forms do Bootstrap; aqui só o que é específico. */
.admin-body { min-height: 100vh; }

.admin-top {
  border-bottom: 1px solid var(--border);
  background: var(--card);
}
.admin-top h1 { font-size: 18px; margin: 0; font-weight: 600; }
.admin-top .muted { font-size: 13px; }

.admin-main { padding-top: 16px; padding-bottom: 48px; }

/* Lista lateral: no celular tem altura limitada para não empurrar o editor */
.lesson-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 8px;
  max-height: 40vh; overflow-y: auto;
}
.lesson-list .ll-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; cursor: pointer; font-size: 14px;
}
.lesson-list .ll-item:hover { background: var(--card2); }
.lesson-list .ll-item.active { border-color: var(--green); background: var(--good-bg); }
.ll-title { font-weight: 600; }
.ll-sub { font-size: 12px; color: var(--muted); }
.ll-del {
  flex: 0 0 auto;
  min-width: 40px; min-height: 40px;
  border: none; background: transparent; color: var(--red); cursor: pointer;
  font-size: 16px; padding: 2px 6px; border-radius: 6px;
}
.ll-del:hover { background: var(--bad-bg); }

.btn-new {
  --bs-btn-font-weight: 600;
  --bs-btn-color: var(--green);
  --bs-btn-bg: var(--good-bg);
  --bs-btn-border-color: rgba(46,204,113,.5);
  --bs-btn-hover-color: var(--green);
  --bs-btn-hover-bg: rgba(46,204,113,.22);
  --bs-btn-hover-border-color: var(--green);
  --bs-btn-active-color: var(--green);
  --bs-btn-active-bg: rgba(46,204,113,.28);
  --bs-btn-active-border-color: var(--green);
  border-style: dashed;
  margin-bottom: 14px;
}

/* Formulário */
.editor { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.editor h2 { margin: 0 0 16px; font-size: 18px; font-weight: 600; }
.field { margin-bottom: 14px; }
.field > label {
  display: block; font-size: 11px; color: var(--muted); margin-bottom: 5px;
  text-transform: uppercase; letter-spacing: .5px; font-weight: 600;
}
/* Linhas do grid do Bootstrap: o espaçamento vem do gutter (g-3) */
.form-row { margin-bottom: 14px; }
.form-row > .field { margin-bottom: 0; }

.audio-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 14px; }
.audio-row .field { flex: 1 1 220px; margin-bottom: 0; }
.audio-row input[type=file] { display: none; }
.btn-upload { white-space: nowrap; margin-bottom: 0; }
#audio-preview { margin-top: 8px; width: 100%; }

/* Frases */
.sentences-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 10px; margin: 20px 0 10px;
}
.sentences-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.sentences-head-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.sentence-item {
  border: 1px solid var(--border); border-radius: 8px; padding: 12px;
  margin-bottom: 10px; background: var(--card2);
}
.sentence-item .si-top { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.si-index { font-size: 12px; color: var(--muted); min-width: 20px; font-family: var(--mono); }
.si-times { display: flex; flex: 1 1 auto; gap: 6px; flex-wrap: wrap; }
.si-times .form-control { flex: 1 1 80px; min-width: 0; font-family: var(--mono); background: var(--card); }
.si-text, .si-trans { margin-bottom: 8px; }
.si-trans { margin-bottom: 0; }
.sentence-item .form-control { background-color: var(--card); }
.si-remove {
  min-width: 40px; min-height: 40px;
  margin-left: auto; border: none; background: transparent; color: var(--red);
  cursor: pointer; font-size: 16px; border-radius: 6px; padding: 2px 8px;
}
.si-remove:hover { background: var(--bad-bg); }

/* Botões ⏱ / ▶ em cada campo de tempo */
.si-grab, .si-play {
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  border-radius: 6px; min-width: 40px; height: 40px; padding: 0 9px; cursor: pointer; font-size: 13px;
}
.si-grab:hover, .si-play:hover { background: var(--hover); }
.si-grab:disabled, .si-play:disabled { opacity: .35; cursor: not-allowed; }

/* Frase ativa durante a marcação */
.sentence-item.marking { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue) inset; }

.editor-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; align-items: center; }
.btn-save:disabled { cursor: wait; }
.msg { font-size: 14px; flex: 1 1 100%; }
.msg:empty { display: none; }
.msg.ok { color: var(--green); }
.msg.err { color: var(--red); }

.empty-hint { color: var(--muted); padding: 32px 12px; text-align: center; }

/* Upload inteligente */
.smart-box {
  background: var(--card);
  border: 1px solid rgba(46,204,113,.4);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
}
.smart-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.smart-head h2 { margin: 0; font-size: 17px; color: var(--green); font-weight: 600; }
.smart-box p.muted { margin: 6px 0 14px; font-size: 13px; }
.smart-box textarea { resize: vertical; }
.smart-box.collapsed > *:not(.smart-head) { display: none; }
#s-audio-name { padding: 9px 0; font-size: 14px; }
.audio-mode { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.audio-mode .form-check { margin: 0; font-size: 14px; }
#s-tts-hint code {
  background: var(--card2); border: 1px solid var(--border); border-radius: 4px;
  padding: 0 4px; font-family: var(--mono); color: var(--text);
}
#s-rate { margin-top: 10px; }
#s-rate-val { font-family: var(--mono); }

/* ---------- Marcação por áudio ---------- */
.marker {
  border: 1px solid rgba(52,152,219,.5);
  background: rgba(52,152,219,.08);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 14px;
}
.marker-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.marker-head strong { font-size: 14px; color: var(--blue); }
.marker audio { width: 100%; margin-bottom: 10px; }

.marker-now { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin-bottom: 6px; }
.mk-clock {
  font-family: var(--mono); font-size: 24px; font-weight: 700;
  color: var(--text); letter-spacing: .5px;
}
.marker-now .muted { font-size: 13px; }

.marker-active {
  background: var(--card2); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; font-size: 15px; margin-bottom: 12px; min-height: 20px;
}

/* Celular: grade 2×2; a partir de sm, em linha */
.marker-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.mk-btn { min-height: 44px; }
.mk-btn kbd { display: none; }
.mk-hint { margin: 10px 0 0; font-size: 12px; }

/* ==========================================================================
   Breakpoints (mobile-first)
   ========================================================================== */
@media (min-width: 576px) {
  .marker-buttons { display: flex; flex-wrap: wrap; }
  .si-times { flex: 0 1 auto; flex-wrap: nowrap; }
  .si-times .form-control { flex: 0 0 90px; }
}

@media (min-width: 768px) {
  .admin-top h1 { font-size: 20px; }
  .admin-main { padding-top: 24px; padding-bottom: 60px; }
  .editor, .smart-box { padding: 20px 22px; }
  .marker { padding: 14px; }
  .mk-clock { font-size: 26px; }
  .mk-btn kbd { display: inline-block; }
  .msg { flex: 0 1 auto; }
}

@media (min-width: 992px) {
  .lesson-list { max-height: none; overflow: visible; }
  .mk-btn { min-height: 32px; }
  .si-grab, .si-play { height: 34px; min-width: 34px; }
  .ll-del, .si-remove { min-width: 32px; min-height: 32px; }
}
