* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, Arial, sans-serif;
  background: #f2f4f7;
  color: #1f2937;
}

.app {
  max-width: 800px; /* Aumentado para acomodar o grid de cards */
  margin: 40px auto;
  padding: 24px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

header h1 {
  margin: 0 0 4px;
  font-size: 24px;
}

header p {
  margin: 0 0 20px;
  color: #6b7280;
  font-size: 14px;
}

.task-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 30px;
}

.task-form input[type="text"] {
  flex: 1;
  min-width: 160px;
}

.task-form input,
.task-form select,
.task-form button {
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
}

.task-form button {
  background: #4f46e5;
  color: #fff;
  border: none;
  cursor: pointer;
}

.task-form button:hover {
  background: #4338ca;
}

/* Transformando a lista em um Grid para os Cards */
.task-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

/* Estrutura do Card */
.task-item {
  display: flex;
  flex-direction: column;
  background: #f9fafb;
  border-radius: 10px;
  padding: 16px;
  border: 1px solid #e5e7eb;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
  transition: transform 0.2s, box-shadow 0.2s;
}

.task-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0,0,0,0.05);
}

/* Indicador de prioridade no topo do Card */
.task-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}
.task-item.priority-low::before { background: #10b981; }
.task-item.priority-medium::before { background: #f59e0b; }
.task-item.priority-high::before { background: #ef4444; }
.task-item.priority-urgent::before { background: #7c3aed; }

/* Tarefa concluída */
.task-item.done {
  opacity: 0.7;
}
.task-item.done .task-title {
  text-decoration: line-through;
  color: #9ca3af;
}

/* Cabeçalho do Card */
.task-card-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}

.checkbox {
  width: 20px;
  height: 20px;
  border: 2px solid #9ca3af;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
  cursor: pointer;
  margin-top: 2px;
}

.task-title {
  flex: 1;
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.btn-delete {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  font-size: 16px;
  padding: 0;
  margin-left: auto;
}

.btn-delete:hover {
  color: #ef4444;
}

/* Corpo do Card */
.task-card-body {
  flex: 1;
  margin-bottom: 16px;
}

.task-desc {
  margin: 0;
  font-size: 14px;
  color: #6b7280;
  line-height: 1.4;
}

/* Rodapé do Card */
.task-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: auto;
  border-top: 1px solid #e5e7eb;
  padding-top: 12px;
}

.task-date {
  font-size: 12px;
  color: #9ca3af;
}

.badge {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  text-transform: capitalize;
  color: #fff;
  font-weight: 500;
}

.badge-low { background: #10b981; }
.badge-medium { background: #f59e0b; }
.badge-high { background: #ef4444; }
.badge-urgent { background: #7c3aed; }

.empty {
  text-align: center;
  color: #9ca3af;
  padding: 24px 0;
  grid-column: 1 / -1; /* Garante que ocupe todo o grid se estiver vazio */
}