/* ============================================================
   schedule.css — Cronograma de Reta Final (21 dias — lista aberta)
   ============================================================ */

/* --- Container da aba cronograma --- */
#tab-cronograma {
  flex-direction: column;
  min-height: calc(100vh - var(--header-height) - var(--tab-nav-height));
  background: var(--bg);
}

#tab-cronograma.active {
  display: flex !important;
}

/* --- Barra de Stats do Cronograma --- */
.schedule-stats-bar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-xs);
  position: sticky;
  top: calc(var(--header-height) + var(--tab-nav-height));
  z-index: 80;
}

.stats-left {
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-label {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stat-value.accent {
  color: var(--accent-dark);
}

/* Barra de progresso geral */
.overall-progress-wrap {
  flex: 1;
  min-width: 220px;
  max-width: 380px;
}

.overall-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.overall-progress-label span:last-child {
  color: var(--accent-dark);
  font-weight: 800;
}

.overall-progress-track {
  height: 8px;
  background: var(--bg-alt);
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.overall-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-dark));
  border-radius: 99px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Botões de ação */
.stats-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  transition: all var(--transition);
  cursor: pointer;
  white-space: nowrap;
}

.btn-outline {
  background: var(--white);
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-xlight);
}

.btn-danger-outline {
  background: var(--white);
  border: 1px solid var(--mais-cobrado-border);
  color: var(--mais-cobrado);
}

.btn-danger-outline:hover {
  background: var(--mais-cobrado-bg);
}

/* --- Header de semana (oculto — layout agora é lista) --- */
.schedule-weeks-header {
  display: none;
}

/* --- Grade de dias — agora lista vertical por semanas --- */
.schedule-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 28px 32px 40px;
  background: var(--bg);
  flex: 1;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
}

/* Separador de semana */
.week-separator {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 0 12px;
  margin-bottom: 4px;
}

.week-separator:first-child {
  padding-top: 0;
}

.week-label {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  white-space: nowrap;
}

.week-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* --- Card de Dia --- */
.day-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
  overflow: hidden;
  transition: box-shadow var(--transition), border-color var(--transition);
}

.day-card:hover {
  box-shadow: var(--shadow-md);
}

.day-card.all-done {
  border-color: var(--accent);
  background: linear-gradient(135deg, #f0fdf4 0%, var(--white) 60%);
}

.day-card.day-simulado {
  border-color: #7c3aed;
  background: linear-gradient(135deg, #faf5ff 0%, var(--white) 60%);
}

/* Header do dia */
.day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light, #f3f4f6);
  background: var(--bg-alt);
}

.day-card.all-done .day-header {
  background: #ecfdf5;
}

.day-card.day-simulado .day-header {
  background: #f5f3ff;
}

.day-header-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.day-number-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.day-number {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 8px;
}

.day-card.all-done .day-number {
  background: var(--accent-light);
  color: var(--accent-dark);
  border-color: rgba(16, 185, 129, 0.3);
}

.day-done-icon {
  font-size: 0.95rem;
}

.day-foco {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.day-card.day-simulado .day-foco {
  color: #5b21b6;
}

.day-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.day-tempo-total {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 8px;
  white-space: nowrap;
}

.day-mini-progress {
  width: 80px;
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}

.day-mini-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-dark));
  border-radius: 99px;
  transition: width 0.4s ease;
}

.day-meta-count {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 28px;
  text-align: right;
}

/* --- Lista de metas dentro do dia --- */
.day-metas-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 8px 0;
}

/* --- Item de Meta (formato aberto) --- */
.meta-item {
  display: flex;
  align-items: flex-start;
  gap: 0;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-light, #f3f4f6);
  border-left: 4px solid transparent;
  transition: background var(--transition), opacity var(--transition);
}

.meta-item:last-child {
  border-bottom: none;
}

.meta-item:hover {
  background: var(--bg-alt);
}

.meta-item.done {
  opacity: 0.48;
}

.meta-item.done .meta-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* Cores de prioridade na borda esquerda */
.meta-item.prioridade-mais_cobrado {
  border-left-color: var(--mais-cobrado);
}

.meta-item.prioridade-cobrado {
  border-left-color: var(--cobrado);
}

.meta-item.prioridade-menos_cobrado {
  border-left-color: var(--menos-cobrado);
}

/* Coluna do checkbox */
.meta-check-col {
  flex-shrink: 0;
  padding-top: 2px;
  margin-right: 14px;
}

/* Checkbox da meta */
.meta-checkbox {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 2px solid var(--border-strong);
  flex-shrink: 0;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: all var(--transition);
  position: relative;
  display: block;
}

.meta-checkbox:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.meta-checkbox:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 10px;
  color: white;
  font-weight: 900;
  line-height: 1;
}

.meta-checkbox:hover:not(:checked) {
  border-color: var(--accent);
  background: var(--accent-light);
}

/* Conteúdo da meta */
.meta-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.meta-header-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.meta-disciplina-tag {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 5px;
}

.meta-topico-tag {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Cores por disciplina */
.disc-dir-const { background: #dbeafe; color: #1e40af; }
.disc-dir-adm   { background: #fce7f3; color: #9d174d; }
.disc-dir-pen   { background: #fff7ed; color: #9a3412; }
.disc-dir-proc  { background: #f0fdf4; color: #14532d; }
.disc-lpe       { background: #fdf2f8; color: #831843; }
.disc-dpm       { background: #ecfdf5; color: #065f46; }
.disc-dppm      { background: #f0f9ff; color: #0c4a6e; }
.disc-port      { background: #fef9c3; color: #713f12; }
.disc-dir-proc  { background: #f0fdf4; color: #14532d; }
.disc-leg       { background: #ede9fe; color: #5b21b6; }
.disc-df        { background: #e0f2fe; color: #0c4a6e; }
.disc-dh        { background: #fef3c7; color: #92400e; }
.disc-crim      { background: #fce4ec; color: #880e4f; }
.disc-rl        { background: #f3e8ff; color: #6b21a8; }
.disc-ing       { background: #ecfdf5; color: #065f46; }
.disc-adm       { background: #fff1f2; color: #9f1239; }
.disc-default   { background: var(--bg-alt); color: var(--text-muted); }

.meta-text {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.5;
  font-weight: 500;
}

/* Dica da meta */
.meta-dica {
  font-size: 0.8rem;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-left: 3px solid #f59e0b;
  border-radius: 0 6px 6px 0;
  padding: 6px 10px;
  line-height: 1.5;
}

.meta-dica-label {
  font-weight: 700;
  margin-right: 4px;
}

.meta-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.meta-time {
  font-size: 0.68rem;
  color: var(--text-muted);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: 5px;
  white-space: nowrap;
}

/* --- Legenda --- */
.schedule-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 32px;
  background: var(--white);
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.legend-title {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* --- Print --- */
@media print {
  .app-header,
  .tab-nav,
  .stats-actions,
  .schedule-legend {
    display: none !important;
  }

  #tab-cronograma {
    display: flex !important;
  }

  .schedule-stats-bar {
    position: static;
    border: none;
    box-shadow: none;
    padding: 8px 0;
  }

  .schedule-grid {
    padding: 8px 0;
  }

  .day-card {
    break-inside: avoid;
    margin-bottom: 8px;
    box-shadow: none;
  }

  .meta-item {
    padding: 8px 16px;
  }

  .meta-text {
    font-size: 0.82rem;
  }

  @page {
    size: A4 portrait;
    margin: 12mm;
  }
}

/* --- Responsivo --- */
@media (max-width: 768px) {
  .schedule-grid {
    padding: 16px 16px 32px;
  }

  .schedule-stats-bar {
    padding: 12px 16px;
    gap: 12px;
  }

  .stats-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .day-header {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 10px;
  }

  .day-header-right {
    width: 100%;
    justify-content: flex-end;
  }

  .meta-item {
    padding: 10px 16px;
  }

  .schedule-legend {
    padding: 10px 16px;
  }
}

@media (max-width: 480px) {
  .stats-left {
    gap: 16px;
  }

  .stat-value {
    font-size: 1.25rem;
  }

  .overall-progress-wrap {
    min-width: 160px;
  }
}
