/* ---------- Cartoes de disciplina ---------- */
.gate{
  border:1px solid var(--border);
  background: linear-gradient(180deg, rgba(20,26,53,0.6), rgba(16,21,42,0.6));
  border-radius: 10px;
  margin-bottom: 8px;
  overflow: hidden;
  transition: border-color .2s;
}
.gate.status-andamento{ border-color: rgba(91,141,255,0.5); box-shadow: 0 0 0 1px rgba(91,141,255,0.08); }
.gate.status-concluida{ border-color: rgba(79,220,142,0.35); }
.gate.status-bloqueada{ opacity: .6; }

/* linha superior: cabecalho + ferramentas + seta */
.gate-top{
  display:flex;
  flex-wrap: wrap;
  align-items: center;
  position: relative;
}
.gate-head{
  display:flex; align-items:center; gap:10px;
  flex: 1 1 0;        /* base 0: nunca empurra o ⋯ e o ▶ para a linha de baixo */
  min-width: 0;
  padding: 12px 4px 13px 12px;
  cursor: pointer;
  user-select:none;
}
.gate-idx{
  font-family: var(--font-mono);
  color: var(--muted);
  font-size: 11px;
  width: 18px;
  flex-shrink:0;
}
.gate-lock{
  color: var(--locked);
  font-size: 14px;
  flex-shrink:0;
}
.gate-main{ flex:1; min-width:0; }
.gate-name{
  font-weight: 600;
  font-size: 14.5px;
  line-height: 1.3;
  color: #fff;
  overflow-wrap: anywhere;
}
.gate-meta{
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  margin-top: 5px;
  display:flex; gap:8px; flex-wrap:wrap; align-items:center;
}
.badge{
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 3px 7px;
  border-radius: 4px;
  letter-spacing: .5px;
  text-transform: uppercase;
  white-space:nowrap;
}
.badge.andamento{ background: rgba(91,141,255,0.15); color: var(--accent-glow); border:1px solid rgba(91,141,255,0.4);}
.badge.concluida{ background: rgba(79,220,142,0.12); color: var(--green); border:1px solid rgba(79,220,142,0.35);}
.badge.bloqueada{ background: rgba(255,255,255,0.03); color: var(--muted); border:1px solid var(--border-soft);}

/* barra fina de progresso no rodape do cabecalho (celular) */
.gate-bar{
  flex: 0 0 100%;
  height: 3px;
  background: rgba(255,255,255,0.05);
  order: 9;
}
.gate-bar > div{
  height:100%;
  background: var(--accent);
  transition: width .4s ease;
}
.gate.status-concluida .gate-bar > div{ background: var(--green); }
.gate.status-bloqueada .gate-bar > div{ background: var(--locked); }

/* medidor lateral: so aparece em telas largas */
.gate-progress{ display:none; width: 70px; flex-shrink:0; }
.mini-bar{
  height: 6px; background:#05070f; border-radius:4px; overflow:hidden; border:1px solid var(--border-soft);
}
.mini-bar > div{ height:100%; background: var(--accent); }
.gate.status-concluida .mini-bar > div{ background: var(--green); }
.gate-progress .pct{ font-family: var(--font-mono); font-size:9.5px; color:var(--muted); text-align:right; margin-top:3px;}

.chev{
  color: var(--muted);
  font-size: 12px;
  transition: transform .2s;
  flex-shrink:0;
  width: 34px;
  min-height: 40px;
  display:flex; align-items:center; justify-content:center;
  cursor:pointer;
  background:none; border:none; padding:0;
}
.gate.open .chev{ transform: rotate(90deg); }

/* barra de ferramentas da disciplina */
.gate-toolbar{
  display:none;
  flex: 0 0 100%;
  gap:6px;
  justify-content:flex-end;
  padding: 0 12px 10px;
  order: 8;
}
.gate.tools-open .gate-toolbar{ display:flex; }
.tool-btn{
  background: rgba(255,255,255,0.03);
  border:1px solid var(--border-soft);
  color: var(--muted);
  border-radius:7px;
  width: 40px; height: 40px;
  font-size: 14px; line-height:1;
  cursor:pointer;
  display:flex; align-items:center; justify-content:center;
  padding:0;
  flex-shrink:0;
}
.tool-btn:active{ background: rgba(91,141,255,0.15); }
.tool-btn.danger:active{ background: rgba(255,107,107,0.15); }
.tool-btn.on{ color: var(--gold); border-color: var(--gold-dim); }
.tool-btn:disabled{ opacity:.25; }
.tool-more{
  width: 34px; min-height: 40px;
  background:none; border:none; color: var(--muted);
  font-size: 18px; line-height:1;
  cursor:pointer; flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
  padding:0;
}
.gate.tools-open .tool-more{ color: var(--accent-glow); }

.gate-locked-msg{
  font-family: var(--font-mono);
  font-size: 10.5px; color: var(--muted);
  line-height: 1.5;
  padding: 0 12px 12px 12px;
}
.gate-body{
  display:none;
  padding: 4px 12px 14px;
  border-top: 1px solid var(--border-soft);
}
.gate.open .gate-body{ display:block; }

.disc-actions{
  display:flex; flex-direction:column; gap:8px;
  margin: 10px 0 4px;
}

/* ---------- Modulos e aulas ---------- */
.modulo{
  margin-top: 14px;
  padding-left: 10px;
  border-left: 2px solid var(--border-soft);
}
.modulo-head{
  display:flex; align-items:center; gap:8px; margin-bottom:6px; flex-wrap:wrap;
}
.modulo-name{
  font-weight:600; font-size: 13px; color: var(--accent-glow);
  overflow-wrap: anywhere;
}
.modulo-tag{
  font-family: var(--font-mono); font-size: 9px; color: var(--muted);
  margin-right: auto;
}
.modulo-head .tool-btn{ width: 34px; height: 34px; font-size: 12px; }

.aula{
  display:flex; align-items:flex-start; gap:10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.aula:last-of-type{ border-bottom:none; }
.aula-check{
  width:22px; height:22px; margin:0; margin-top:1px;
  accent-color: var(--accent);
  cursor:pointer; flex-shrink:0;
}
.aula-main{ flex:1; min-width:0; }
.aula-name{ font-size: 13.5px; line-height:1.4; overflow-wrap: anywhere; }
.aula-name.done{ color: var(--muted); text-decoration: line-through; }
.aula .tool-btn{ width: 32px; height: 32px; font-size: 12px; }

.aula-note{ margin-top:8px; }
.aula-note textarea{
  width:100%;
  background: #05070f;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;              /* 16px evita o zoom automatico do iOS */
  line-height: 1.45;
  padding: 10px;
  resize: vertical;
  min-height: 96px;
}
.aula-note textarea:focus{ outline:none; border-color: var(--accent); }
.aula-note-actions{
  display:flex; flex-direction:column; align-items:stretch; gap:8px; margin-top:8px;
  font-family: var(--font-mono); font-size: 10px; color: var(--muted);
}
.aula-note-actions > span{ display:flex; flex-direction:column; gap:8px; }
.btn-mini{
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--accent);
  color: #05070d;
  border:none;
  padding: 12px 14px;
  min-height: var(--tap);
  border-radius:8px;
  cursor:pointer;
  font-weight:600;
  letter-spacing:.3px;
  width: 100%;
}
.btn-mini:disabled{ background: var(--locked); color: var(--muted); }
.aula-saved-note{
  font-size:12.5px; color: var(--muted); font-style: italic;
  border-left: 2px solid var(--border);
  padding-left: 8px; margin-top: 6px;
  line-height:1.45;
  overflow-wrap: anywhere;
}

/* ---------- Campos de adicionar ---------- */
.add-row{
  display:flex; flex-direction:column; gap:8px; margin-top:12px;
}
.add-row input{
  width:100%;
  background: rgba(255,255,255,0.02);
  border: 1px dashed var(--border);
  border-radius:8px;
  padding: 12px 12px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  min-height: var(--tap);
}
.add-row input:focus{ outline:none; border-color: var(--accent); }
.btn-ghost{
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 12px 14px;
  min-height: var(--tap);
  border-radius:8px;
  cursor:pointer;
  width: 100%;
}
.btn-ghost:active{ color: var(--accent-glow); border-color: var(--accent); }

/* ---------- Bloco "nova disciplina" ---------- */
.new-disc{
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 14px 12px;
  margin-top: 14px;
  background: rgba(255,255,255,0.015);
}
.new-disc-title{
  font-family: var(--font-mono);
  font-size: 10.5px; letter-spacing:1.5px; text-transform:uppercase;
  color: var(--accent-glow); margin-bottom: 10px;
}
.new-disc-grid{
  display:flex; flex-direction:column; gap:8px;
}
.new-disc-grid input{
  width:100%;
  background:#05070f; border:1px solid var(--border); border-radius:8px;
  padding: 12px; color: var(--text);
  font-family: var(--font-body); font-size:16px;
  min-height: var(--tap);
}
.new-disc-grid input[type="date"]{ font-family: var(--font-mono); font-size:14px; }
.new-disc-grid input:focus{ outline:none; border-color: var(--accent); }
.new-disc .check-row{ margin-top: 12px; }
.new-disc .check-row span{ font-size: 12px; color: var(--muted); }


/* ============================================================
   Modulo concluido e disciplina bloqueada aberta
   ============================================================ */
.modulo.concluido{ border-left-color: rgba(79,220,142,0.5); }
.modulo.concluido .modulo-name{ color: var(--green); }
.modulo-head .tool-btn.feito{ color: var(--green); border-color: rgba(79,220,142,0.45); }

.gate.status-bloqueada.open{ opacity: .9; }
.aviso-bloqueio{
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height:1.5;
  color: var(--gold);
  background: rgba(240,185,84,0.07);
  border: 1px solid rgba(240,185,84,0.28);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 10px 0 4px;
}
.aula.travada .aula-name{ color: var(--muted); }
.aula-check:disabled{ cursor:not-allowed; opacity:.4; }
